diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e6eaa0320..abb8aef3c 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -7,9 +7,10 @@ on: - "release/**" pull_request: branches: - - main + - mainnet - testnet - "release/**" + - "feat/**" permissions: packages: read diff --git a/contracts/extensions/forwarder/Forwarder.sol b/contracts/extensions/forwarder/Forwarder.sol index 34f7f579d..620435e29 100644 --- a/contracts/extensions/forwarder/Forwarder.sol +++ b/contracts/extensions/forwarder/Forwarder.sol @@ -25,20 +25,20 @@ contract Forwarder is AccessControlEnumerable { /** * @dev Initializes the forwarder with an initial target address and a contract admin. */ - constructor(address[] memory _targets, address _admin, address _moderator) payable { - for (uint _i = 0; _i < _targets.length; ) { - _setupRole(TARGET_ROLE, _targets[_i]); + constructor(address[] memory targets, address admin, address moderator) payable { + for (uint i = 0; i < targets.length; ) { + _setupRole(TARGET_ROLE, targets[i]); unchecked { - ++_i; + ++i; } } - _setupRole(DEFAULT_ADMIN_ROLE, _admin); - _setupRole(MODERATOR_ROLE, _moderator); + _setupRole(DEFAULT_ADMIN_ROLE, admin); + _setupRole(MODERATOR_ROLE, moderator); } - modifier validTarget(address _target) { - _checkRole(TARGET_ROLE, _target); + modifier validTarget(address target) { + _checkRole(TARGET_ROLE, target); _; } @@ -61,12 +61,12 @@ contract Forwarder is AccessControlEnumerable { * - Only user with {MODERATOR_ROLE} can call this method. */ function functionCall( - address _target, - bytes memory _data, - uint256 _val - ) external payable validTarget(_target) onlyRole(MODERATOR_ROLE) { - if (_val > address(this).balance) revert ErrInvalidForwardValue(); - _call(_target, _data, _val); + address target, + bytes memory data, + uint256 val + ) external payable validTarget(target) onlyRole(MODERATOR_ROLE) { + if (val > address(this).balance) revert ErrInvalidForwardValue(); + _call(target, data, val); } /** @@ -74,8 +74,8 @@ contract Forwarder is AccessControlEnumerable { * * This function does not return to its internal call site, it will return directly to the external caller. */ - function _call(address _target, bytes memory _data, uint256 _value) internal { - (bool _success, bytes memory _res) = _target.call{ value: _value }(_data); - _success.handleRevert(bytes4(_data), _res); + function _call(address target, bytes memory data, uint256 value) internal { + (bool success, bytes memory res) = target.call{ value: value }(data); + success.handleRevert(bytes4(data), res); } } diff --git a/contracts/interfaces/IMaintenance.sol b/contracts/interfaces/IMaintenance.sol index e5add60fe..a85c5bf4f 100644 --- a/contracts/interfaces/IMaintenance.sol +++ b/contracts/interfaces/IMaintenance.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.9; +import { TConsensus } from "../udvts/Types.sol"; + interface IMaintenance { /** * @dev Error thrown when attempting to schedule an already scheduled event. @@ -61,9 +63,9 @@ interface IMaintenance { } /// @dev Emitted when a maintenance is scheduled. - event MaintenanceScheduled(address indexed consensusAddr, Schedule); + event MaintenanceScheduled(TConsensus indexed consensusAddr, Schedule); /// @dev Emitted when a schedule of maintenance is cancelled. - event MaintenanceScheduleCancelled(address indexed consensusAddr); + event MaintenanceScheduleCancelled(TConsensus indexed consensusAddr); /// @dev Emitted when the maintenance config is updated. event MaintenanceConfigUpdated( uint256 minMaintenanceDurationInBlock, @@ -75,52 +77,76 @@ interface IMaintenance { ); /** - * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`. + * @dev Returns whether the validator `consensusAddr` maintained at the block number `_block`. + */ + function checkMaintained(TConsensus consensusAddr, uint256 _block) external view returns (bool); + + /** + * @dev Returns whether the validator whose id `validatorId` maintained at the block number `_block`. */ - function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool); + function checkMaintainedById(address validatorId, uint256 _block) external view returns (bool); /** - * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks. + * @dev Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks. */ function checkMaintainedInBlockRange( - address _consensusAddr, + TConsensus consensusAddr, uint256 _fromBlock, uint256 _toBlock ) external view returns (bool); /** - * @dev Returns the bool array indicating the validators maintained at block number `_block` or not. + * @dev Returns the bool array indicating the validators maintained at block number `k` or not. */ - function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory); + function checkManyMaintained( + TConsensus[] calldata consensusAddrList, + uint256 atBlock + ) external view returns (bool[] memory); + + function checkManyMaintainedById( + address[] calldata candidateIdList, + uint256 atBlock + ) external view returns (bool[] memory); /** * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not. */ function checkManyMaintainedInBlockRange( - address[] calldata _addrList, + TConsensus[] calldata _consensusAddrList, uint256 _fromBlock, uint256 _toBlock ) external view returns (bool[] memory); + function checkManyMaintainedInBlockRangeById( + address[] calldata idList, + uint256 fromBlock, + uint256 toBlock + ) external view returns (bool[] memory); + /** - * @dev Returns whether the validator `_consensusAddr` has scheduled. + * @dev Returns whether the validator `consensusAddr` has finished cooldown. */ - function checkScheduled(address _consensusAddr) external view returns (bool); + function checkCooldownEnded(TConsensus consensusAddr) external view returns (bool); /** - * @dev Returns whether the validator `_consensusAddr` + * @dev Returns whether the validator `consensusAddr` has schedule. */ - function checkCooldownEnded(address _consensusAddr) external view returns (bool); + function checkScheduled(TConsensus consensusAddr) external view returns (bool); /** - * @dev Returns the detailed schedule of the validator `_consensusAddr`. + * @dev Returns the detailed schedule of the validator `consensusAddr`. */ - function getSchedule(address _consensusAddr) external view returns (Schedule memory); + function getSchedule(TConsensus consensusAddr) external view returns (Schedule memory); /** * @dev Returns the total of current schedules. */ - function totalSchedule() external view returns (uint256 _count); + function totalSchedule() external view returns (uint256 count); + + /** + * @dev Returns the cooldown to maintain in seconds. + */ + function cooldownSecsToMaintain() external view returns (uint256); /** * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance. @@ -134,12 +160,12 @@ interface IMaintenance { * */ function setMaintenanceConfig( - uint256 _minMaintenanceDurationInBlock, - uint256 _maxMaintenanceDurationInBlock, - uint256 _minOffsetToStartSchedule, - uint256 _maxOffsetToStartSchedule, - uint256 _maxSchedules, - uint256 _cooldownSecsToMaintain + uint256 minMaintenanceDurationInBlock_, + uint256 maxMaintenanceDurationInBlock_, + uint256 minOffsetToStartSchedule_, + uint256 maxOffsetToStartSchedule_, + uint256 maxSchedules_, + uint256 cooldownSecsToMaintain_ ) external; /** @@ -168,12 +194,12 @@ interface IMaintenance { function maxSchedule() external view returns (uint256); /** - * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. + * @dev Schedules for maintenance from `startedAtBlock` to `endedAtBlock`. * * Requirements: - * - The candidate `_consensusAddr` is the block producer. - * - The method caller is candidate admin of the candidate `_consensusAddr`. - * - The candidate `_consensusAddr` has no schedule yet or the previous is done. + * - The candidate `consensusAddr` is the block producer. + * - The method caller is candidate admin of the candidate `consensusAddr`. + * - The candidate `consensusAddr` has no schedule yet or the previous is done. * - The total number of schedules is not larger than `maxSchedules()`. * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. * - The end block is larger than the start block. @@ -184,17 +210,17 @@ interface IMaintenance { * Emits the event `MaintenanceScheduled`. * */ - function schedule(address _consensusAddr, uint256 _startedAtBlock, uint256 _endedAtBlock) external; + function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external; /** - * @dev Cancel the schedule of maintenance for the `_consensusAddr`. + * @dev Cancel the schedule of maintenance for the `consensusAddr`. * * Requirements: - * - The candidate `_consensusAddr` is the block producer. - * - The method caller is candidate admin of the candidate `_consensusAddr`. - * - A schedule for the `_consensusAddr` must be existent and not executed yet. + * - The candidate `consensusAddr` is the block producer. + * - The method caller is candidate admin of the candidate `consensusAddr`. + * - A schedule for the `consensusAddr` must be existent and not executed yet. * * Emits the event `MaintenanceScheduleCancelled`. */ - function cancelSchedule(address _consensusAddr) external; + function cancelSchedule(TConsensus consensusAddr) external; } diff --git a/contracts/interfaces/IProfile.sol b/contracts/interfaces/IProfile.sol index 245f352d8..2413cb604 100644 --- a/contracts/interfaces/IProfile.sol +++ b/contracts/interfaces/IProfile.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.9; +import { TPoolId, TConsensus } from "../udvts/Types.sol"; import "../utils/RoleAccess.sol"; interface IProfile { @@ -15,13 +16,13 @@ interface IProfile { */ address id; /// @dev Consensus address. - address consensus; + TConsensus consensus; /// @dev Pool admin address. address admin; /// @dev Treasury address. address payable treasury; /// @dev Address to voting proposal. - address governor; + address __reservedGovernor; /// @dev Public key for fast finality. bytes pubkey; } @@ -51,6 +52,15 @@ interface IProfile { /// @dev Getter to query full `profile` from `id` address. function getId2Profile(address id) external view returns (CandidateProfile memory profile); + /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist. + function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList); + + /// @dev Getter to backward query from `consensus` address to `id` address. + function getConsensus2Id(TConsensus consensus) external view returns (address id); + + /// @dev Getter to backward batch query from `consensus` address to `id` address. + function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory); + /** * @notice Add a new profile. * @@ -61,14 +71,34 @@ interface IProfile { function addNewProfile(CandidateProfile memory profile) external; /** - * @notice The candidate admin registers a new profile. + * @dev Cross-contract function to add/update new profile of a validator candidate when they + * applying for candidate role. * - * @dev Requirements: - * - The profile must not be existent before. - * - Only user with candidate admin role can call this method. + * Requirements: + * - Only `stakingContract` can call this method. */ + function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external; - function registerProfile(CandidateProfile memory profile) external; + /** + * @dev Updated the treasury address of candidate id `id` immediately without waiting time. + * + * Emit an {ProfileAddressChanged}. + */ + function requestChangeAdminAddress(address id, address newAdminAddr) external; + + /** + * @dev Updated the treasury address of candidate id `id` immediately without waiting time. + * + * Emit an {ProfileAddressChanged}. + */ + function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external; + + /** + * @dev Updated the treasury address of candidate id `id` immediately without waiting time. + * + * Emit an {ProfileAddressChanged}. + */ + function requestChangeTreasuryAddr(address id, address payable newTreasury) external; /** * @notice The candidate admin changes the public key. diff --git a/contracts/interfaces/IRoninGovernanceAdmin.sol b/contracts/interfaces/IRoninGovernanceAdmin.sol index e5753a726..83e0737d9 100644 --- a/contracts/interfaces/IRoninGovernanceAdmin.sol +++ b/contracts/interfaces/IRoninGovernanceAdmin.sol @@ -6,18 +6,18 @@ import "../utils/CommonErrors.sol"; interface IRoninGovernanceAdmin { /// @dev Emitted when an emergency exit poll is created. event EmergencyExitPollCreated( - bytes32 _voteHash, - address _consensusAddr, - address _recipientAfterUnlockedFund, - uint256 _requestedAt, - uint256 _expiredAt + bytes32 voteHash, + address validatorId, + address recipientAfterUnlockedFund, + uint256 requestedAt, + uint256 expiredAt ); /// @dev Emitted when an emergency exit poll is approved. - event EmergencyExitPollApproved(bytes32 _voteHash); + event EmergencyExitPollApproved(bytes32 voteHash); /// @dev Emitted when an emergency exit poll is expired. - event EmergencyExitPollExpired(bytes32 _voteHash); + event EmergencyExitPollExpired(bytes32 voteHash); /// @dev Emitted when an emergency exit poll is voted. - event EmergencyExitPollVoted(bytes32 indexed _voteHash, address indexed _voter); + event EmergencyExitPollVoted(bytes32 indexed voteHash, address indexed voter); /** * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a @@ -27,9 +27,9 @@ interface IRoninGovernanceAdmin { * */ function createEmergencyExitPoll( - address _consensusAddr, - address _recipientAfterUnlockedFund, - uint256 _requestedAt, - uint256 _expiredAt + address validatorId, + address recipientAfterUnlockedFund, + uint256 requestedAt, + uint256 expiredAt ) external; } diff --git a/contracts/interfaces/IRoninTrustedOrganization.sol b/contracts/interfaces/IRoninTrustedOrganization.sol index 720d46648..78a163772 100644 --- a/contracts/interfaces/IRoninTrustedOrganization.sol +++ b/contracts/interfaces/IRoninTrustedOrganization.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.9; import "./IQuorum.sol"; +import "../udvts/Types.sol"; interface IRoninTrustedOrganization is IQuorum { /** @@ -15,12 +16,6 @@ interface IRoninTrustedOrganization is IQuorum { */ error ErrQueryForNonExistentConsensusAddress(); - /** - * @dev Error indicating that a bridge voter has already been added. - * @param voter The address of the bridge voter that is already added. - */ - error ErrBridgeVoterIsAlreadyAdded(address voter); - /** * @dev Error indicating that a governor address has already been added. * @param addr The address of the governor that is already added. @@ -31,21 +26,21 @@ interface IRoninTrustedOrganization is IQuorum { * @dev Error indicating that a consensus address is not added. * @param addr The address of the consensus contract that is not added. */ - error ErrConsensusAddressIsNotAdded(address addr); + error ErrConsensusAddressIsNotAdded(TConsensus addr); /** * @dev Error indicating that a consensus address is already added. * @param addr The address of the consensus contract that is already added. */ - error ErrConsensusAddressIsAlreadyAdded(address addr); + error ErrConsensusAddressIsAlreadyAdded(TConsensus addr); struct TrustedOrganization { // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address. - address consensusAddr; + TConsensus consensusAddr; // Address to voting proposal address governor; // Address to voting bridge operators - address bridgeVoter; + address __deprecatedBridgeVoter; // Its Weight uint256 weight; // The block that the organization was added @@ -57,7 +52,9 @@ interface IRoninTrustedOrganization is IQuorum { /// @dev Emitted when the trusted organization is updated. event TrustedOrganizationsUpdated(TrustedOrganization[] orgs); /// @dev Emitted when the trusted organization is removed. - event TrustedOrganizationsRemoved(address[] orgs); + event TrustedOrganizationsRemoved(TConsensus[] orgs); + /// @dev Emitted when the consensus address of a trusted organization is changed. + event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus); /** * @dev Adds a list of addresses into the trusted organization. @@ -82,7 +79,7 @@ interface IRoninTrustedOrganization is IQuorum { * Emits the `TrustedOrganizationUpdated` event. * */ - function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external; + function updateTrustedOrganizations(TrustedOrganization[] calldata list) external; /** * @dev Removes a list of addresses from the trusted organization. @@ -92,9 +89,19 @@ interface IRoninTrustedOrganization is IQuorum { * * Emits the event `TrustedOrganizationRemoved` once an organization is removed. * - * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed. + * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed. + */ + function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external; + + /** + * @dev Fallback function of `Profile-requestChangeConsensusAddress`. + * + * Requirements: + * - The caller must be the Profile contract. + * + * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed. */ - function removeTrustedOrganizations(address[] calldata _consensusAddrs) external; + function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external; /** * @dev Returns total weights. @@ -104,52 +111,47 @@ interface IRoninTrustedOrganization is IQuorum { /** * @dev Returns the weight of a consensus. */ - function getConsensusWeight(address _consensusAddr) external view returns (uint256); + function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256); /** - * @dev Returns the weight of a governor. + * @dev Returns the weight of a consensus. */ - function getGovernorWeight(address _governor) external view returns (uint256); + function getConsensusWeightById(address cid) external view returns (uint256); /** - * @dev Returns the weight of a bridge voter. + * @dev Returns the weight of a governor. */ - function getBridgeVoterWeight(address _addr) external view returns (uint256); + function getGovernorWeight(address governor) external view returns (uint256); /** * @dev Returns the weights of a list of consensus addresses. */ - function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory); + function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory); /** - * @dev Returns the weights of a list of governor addresses. + * @dev Returns the weights of a list of consensus addresses. */ - function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory); + function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory); /** - * @dev Returns the weights of a list of bridge voter addresses. + * @dev Returns the weights of a list of governor addresses. */ - function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory); + function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory); /** * @dev Returns total weights of the consensus list. */ - function sumConsensusWeight(address[] calldata _list) external view returns (uint256 _res); + function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res); /** * @dev Returns total weights of the governor list. */ - function sumGovernorWeight(address[] calldata _list) external view returns (uint256 _res); - - /** - * @dev Returns total weights of the bridge voter list. - */ - function sumBridgeVoterWeight(address[] calldata _list) external view returns (uint256 _res); + function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res); /** * @dev Returns the trusted organization at `_index`. */ - function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory); + function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory); /** * @dev Returns the number of trusted organizations. @@ -166,5 +168,5 @@ interface IRoninTrustedOrganization is IQuorum { * * Reverts once the consensus address is non-existent. */ - function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory); + function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory); } diff --git a/contracts/interfaces/IStakingVesting.sol b/contracts/interfaces/IStakingVesting.sol index 025888033..8bf60d342 100644 --- a/contracts/interfaces/IStakingVesting.sol +++ b/contracts/interfaces/IStakingVesting.sol @@ -31,14 +31,14 @@ interface IStakingVesting { event FastFinalityRewardPercentageUpdated(uint256); /** - * @dev Returns the bonus amount for the block producer at `_block`. + * @dev Returns the bonus amount for the block producer at `blockNum`. */ - function blockProducerBlockBonus(uint256 _block) external view returns (uint256); + function blockProducerBlockBonus(uint256 blockNum) external view returns (uint256); /** - * @dev Returns the bonus amount for the bridge validator at `_block`. + * @dev Returns the bonus amount for the bridge validator at `blockNum`. */ - function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256); + function bridgeOperatorBlockBonus(uint256 blockNum) external view returns (uint256); /** * @dev Returns the percentage of fast finality reward. @@ -98,7 +98,7 @@ interface IStakingVesting { * - The method caller is admin. * */ - function setBlockProducerBonusPerBlock(uint256 _amount) external; + function setBlockProducerBonusPerBlock(uint256 amount) external; /** * @dev Sets the bonus amount per block for bridge operator. diff --git a/contracts/interfaces/slash-indicator/ICreditScore.sol b/contracts/interfaces/slash-indicator/ICreditScore.sol index 3f7c7a846..886f48fb7 100644 --- a/contracts/interfaces/slash-indicator/ICreditScore.sol +++ b/contracts/interfaces/slash-indicator/ICreditScore.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; +import { TConsensus } from "../../udvts/Types.sol"; interface ICreditScore { /** @@ -38,7 +39,7 @@ interface ICreditScore { /// @dev Emitted the credit score of validators is updated. event CreditScoresUpdated(address[] validators, uint256[] creditScores); /// @dev Emitted when a validator bailed out of jail. - event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore); + event BailedOut(TConsensus indexed consensus, uint256 period, uint256 usedCreditScore); /** * @dev Updates the credit score for the validators. @@ -50,7 +51,7 @@ interface ICreditScore { * Emits the event `CreditScoresUpdated`. * */ - function updateCreditScores(address[] calldata _validators, uint256 _period) external; + function execUpdateCreditScores(address[] calldata validatorIds, uint256 period) external; /** * @dev Resets the credit score for the revoked validators. @@ -62,7 +63,7 @@ interface ICreditScore { * Emits the event `CreditScoresUpdated`. * */ - function execResetCreditScores(address[] calldata _validators) external; + function execResetCreditScores(address[] calldata validatorIds) external; /** * @dev A slashed validator use this method to get out of jail. @@ -74,7 +75,7 @@ interface ICreditScore { * Emits the event `BailedOut`. * */ - function bailOut(address _consensusAddr) external; + function bailOut(TConsensus consensusAddr) external; /** * @dev Sets the configs to credit score. @@ -119,15 +120,17 @@ interface ICreditScore { /** * @dev Returns the current credit score of the validator. */ - function getCreditScore(address _validator) external view returns (uint256); + function getCreditScore(TConsensus consensus) external view returns (uint256); /** * @dev Returns the current credit score of a list of validators. */ - function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList); + function getManyCreditScores( + TConsensus[] calldata consensusAddrs + ) external view returns (uint256[] memory _resultList); /** - * @dev Returns the whether the `_validator` has been bailed out at the `_period`. + * @dev Returns the whether the `consensus` has been bailed out at the `period`. */ - function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool); + function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view returns (bool); } diff --git a/contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol b/contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol deleted file mode 100644 index 3ed81e3e2..000000000 --- a/contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol +++ /dev/null @@ -1,84 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.9; - -import "./IBaseSlash.sol"; - -interface ISlashBridgeOperator is IBaseSlash { - /** - * @dev Error thrown when invalid ratios are provided. - */ - error ErrInvalidRatios(); - - /** - * @dev Emitted when the configs to slash bridge operator is updated. See the method - * `getBridgeOperatorSlashingConfigs` for param details. - */ - event BridgeOperatorSlashingConfigsUpdated( - uint256 missingVotesRatioTier1, - uint256 missingVotesRatioTier2, - uint256 jailDurationForMissingVotesRatioTier2, - uint256 skipBridgeOperatorSlashingThreshold - ); - - /** - * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly. - * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1` - * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2` - * - * Requirements: - * - Only validator contract can invoke this method. - * - Should be called only at the end of period. - * - Should be called only when there is slash of bridge operator. - * - * Emits the event `Slashed`. - */ - function execSlashBridgeOperator(address _consensusAddr, uint256 _tier, uint256 _period) external; - - /** - * @dev Returns the configs related to bridge operator slashing. - * - * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. - * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding - * block producer will be put in jail if (s)he misses more than this ratio. - * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when - * its bridge operator is slashed tier-2. - * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total - * number of votes in the bridge is too small. - * - */ - function getBridgeOperatorSlashingConfigs() - external - view - returns ( - uint256 _missingVotesRatioTier1, - uint256 _missingVotesRatioTier2, - uint256 _jailDurationForMissingVotesRatioTier2, - uint256 _skipBridgeOperatorSlashingThreshold - ); - - /** - * @dev Sets the configs to slash bridge operators. - * - * Requirements: - * - The method caller is admin. - * - * Emits the event `BridgeOperatorSlashingConfigsUpdated`. - * - * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map - * to 0%-100%. - * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will - * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%. - * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is - * slashed tier-2. - * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes - * in the bridge is too small. - * - */ - function setBridgeOperatorSlashingConfigs( - uint256 _ratioTier1, - uint256 _ratioTier2, - uint256 _jailDurationTier2, - uint256 _skipSlashingThreshold - ) external; -} diff --git a/contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol b/contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol deleted file mode 100644 index e6c99eb50..000000000 --- a/contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.9; - -import "./IBaseSlash.sol"; - -interface ISlashBridgeVoting is IBaseSlash { - /** - * @dev Error thrown when an invalid slash is encountered. - */ - error ErrInvalidSlash(); - - /** - * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param - * details. - */ - event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount); - - /** - * @dev Slashes for bridge voter governance. - * - * Emits the event `Slashed`. - */ - function slashBridgeVoting(address _consensusAddr) external; - - /** - * @dev Returns the configs related to bridge voting slashing. - * - * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge - * operators. - * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting. - * - */ - function getBridgeVotingSlashingConfigs() - external - view - returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount); - - /** - * @dev Sets the configs to slash bridge voting. - * - * Requirements: - * - The method caller is admin. - * - * Emits the event `BridgeVotingSlashingConfigsUpdated`. - * - * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators. - * @param _slashAmount The amount of RON to slash bridge voting. - * - */ - function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external; -} diff --git a/contracts/interfaces/slash-indicator/ISlashDoubleSign.sol b/contracts/interfaces/slash-indicator/ISlashDoubleSign.sol index d9fb747c7..b705cfd9b 100644 --- a/contracts/interfaces/slash-indicator/ISlashDoubleSign.sol +++ b/contracts/interfaces/slash-indicator/ISlashDoubleSign.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.9; import "./IBaseSlash.sol"; +import { TConsensus } from "../../udvts/Types.sol"; interface ISlashDoubleSign is IBaseSlash { /** @@ -23,7 +24,7 @@ interface ISlashDoubleSign is IBaseSlash { * * Emits the event `Slashed` if the double signing evidence of the two headers valid. */ - function slashDoubleSign(address _validatorAddr, bytes calldata _header1, bytes calldata _header2) external; + function slashDoubleSign(TConsensus _validatorAddr, bytes calldata _header1, bytes calldata _header2) external; /** * @dev Returns the configs related to block producer slashing. diff --git a/contracts/interfaces/slash-indicator/ISlashFastFinality.sol b/contracts/interfaces/slash-indicator/ISlashFastFinality.sol index 134bbceff..3ab1fb62e 100644 --- a/contracts/interfaces/slash-indicator/ISlashFastFinality.sol +++ b/contracts/interfaces/slash-indicator/ISlashFastFinality.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.9; import "./IBaseSlash.sol"; +import { TConsensus } from "../../udvts/Types.sol"; interface ISlashFastFinality is IBaseSlash { /** @@ -20,7 +21,7 @@ interface ISlashFastFinality is IBaseSlash { * Emits the event `Slashed` if the fast finality evidence of the two headers valid. */ function slashFastFinality( - address consensusAddr, + TConsensus consensusAddr, bytes calldata voterPublicKey, uint256 targetBlockNumber, bytes32[2] calldata targetBlockHash, diff --git a/contracts/interfaces/slash-indicator/ISlashIndicator.sol b/contracts/interfaces/slash-indicator/ISlashIndicator.sol index 18a62dd81..7383bac00 100644 --- a/contracts/interfaces/slash-indicator/ISlashIndicator.sol +++ b/contracts/interfaces/slash-indicator/ISlashIndicator.sol @@ -3,15 +3,11 @@ pragma solidity ^0.8.9; import "./ISlashDoubleSign.sol"; -import "./ISlashBridgeVoting.sol"; -import "./ISlashBridgeOperator.sol"; import "./ISlashUnavailability.sol"; import "./ICreditScore.sol"; interface ISlashIndicator is ISlashDoubleSign, - ISlashBridgeVoting, - ISlashBridgeOperator, ISlashUnavailability, ICreditScore {} diff --git a/contracts/interfaces/slash-indicator/ISlashUnavailability.sol b/contracts/interfaces/slash-indicator/ISlashUnavailability.sol index 68f79b32b..9211c8601 100644 --- a/contracts/interfaces/slash-indicator/ISlashUnavailability.sol +++ b/contracts/interfaces/slash-indicator/ISlashUnavailability.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.9; import "./IBaseSlash.sol"; +import { TConsensus } from "../../udvts/Types.sol"; interface ISlashUnavailability is IBaseSlash { /** @@ -27,7 +28,7 @@ interface ISlashUnavailability is IBaseSlash { function lastUnavailabilitySlashedBlock() external view returns (uint256); /** - * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`. + * @dev Slashes for unavailability by increasing the counter of block producer `consensusAddr`. * * Requirements: * - The method caller is coinbase. @@ -35,28 +36,28 @@ interface ISlashUnavailability is IBaseSlash { * Emits the event `Slashed` when the threshold is reached. * */ - function slashUnavailability(address _consensusAddr) external; + function slashUnavailability(TConsensus consensusAddr) external; /** * @dev Returns the current unavailability indicator of a block producer. */ - function currentUnavailabilityIndicator(address _validator) external view returns (uint256); + function currentUnavailabilityIndicator(TConsensus consensusAddr) external view returns (uint256); /** - * @dev Returns the unavailability indicator in the period `_period` of a block producer. + * @dev Returns the unavailability indicator in the period `period` of a block producer. */ - function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256); + function getUnavailabilityIndicator(TConsensus consensusAddr, uint256 period) external view returns (uint256); /** * @dev Returns the configs related to block producer slashing. * - * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this + * @return unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this * threshold. This threshold is applied for tier-1 and tier-3 slash. - * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will + * @return unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash. - * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block + * @return slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block * producer when (s)he is slashed with tier-2 or tier-3. - * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is + * @return jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is * slashed with tier-2 or tier-3. * */ @@ -64,10 +65,10 @@ interface ISlashUnavailability is IBaseSlash { external view returns ( - uint256 _unavailabilityTier1Threshold, - uint256 _unavailabilityTier2Threshold, - uint256 _slashAmountForUnavailabilityTier2Threshold, - uint256 _jailDurationForUnavailabilityTier2Threshold + uint256 unavailabilityTier1Threshold, + uint256 unavailabilityTier2Threshold, + uint256 slashAmountForUnavailabilityTier2Threshold, + uint256 jailDurationForUnavailabilityTier2Threshold ); /** @@ -78,18 +79,18 @@ interface ISlashUnavailability is IBaseSlash { * * Emits the event `BridgeOperatorSlashingConfigsUpdated`. * - * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold. - * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted + * @param tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold. + * @param tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted * self-staking if (s)he misses more than this threshold. - * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he + * @param slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he * is slashed tier-2. - * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2. + * @param jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2. * */ function setUnavailabilitySlashingConfigs( - uint256 _tier1Threshold, - uint256 _tier2Threshold, - uint256 _slashAmountForTier2Threshold, - uint256 _jailDurationForTier2Threshold + uint256 tier1Threshold, + uint256 tier2Threshold, + uint256 slashAmountForTier2Threshold, + uint256 jailDurationForTier2Threshold ) external; } diff --git a/contracts/interfaces/staking/IBaseStaking.sol b/contracts/interfaces/staking/IBaseStaking.sol index fb783c102..4af1c62f6 100644 --- a/contracts/interfaces/staking/IBaseStaking.sol +++ b/contracts/interfaces/staking/IBaseStaking.sol @@ -2,19 +2,32 @@ pragma solidity ^0.8.9; +import { TPoolId, TConsensus } from "../../udvts/Types.sol"; + interface IBaseStaking { struct PoolDetail { - // Address of the pool i.e. consensus address of the validator - address addr; - // Pool admin address - address admin; - // Self-staking amount + /** + * @dev Address of the pool. + * @custom non-volatile-storage Permanently set to the first consensus address of the candidate. + */ + address pid; + + /** + * @dev The address of the pool admin. + * @custom shadowed-storage This storage slot is always kept in sync with the admin in `Profile-CandidateProfile`. + */ + address __shadowedPoolAdmin; + + /// @dev Self-staking amount uint256 stakingAmount; - // Total number of RON staking for the pool + + /// @dev Total number of RON staking for the pool uint256 stakingTotal; - // Mapping from delegator => delegating amount + + /// @dev Mapping from delegator => delegating amount mapping(address => uint256) delegatingAmount; - // Mapping from delegator => the last timestamp that delegator staked + + /// @dev Mapping from delegator => the last timestamp that delegator staked mapping(address => uint256) lastDelegatingTimestamp; } @@ -34,29 +47,40 @@ interface IBaseStaking { /// @dev Error of admin of any active pool cannot delegate. error ErrAdminOfAnyActivePoolForbidden(address admin); /// @dev Error of querying inactive pool. - error ErrInactivePool(address poolAddr); + error ErrInactivePool(TConsensus consensusAddr, address poolAddr); /// @dev Error of length of input arrays are not of the same. error ErrInvalidArrays(); /** - * @dev Returns whether the `_poolAdminAddr` is currently active. + * @dev Returns whether the `admin` is currently active. */ - function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool); + function isAdminOfActivePool(address admin) external view returns (bool); /** * @dev Returns the consensus address corresponding to the pool admin. */ - function getPoolAddressOf(address _poolAdminAddr) external view returns (address); + function getPoolAddressOf(address admin) external view returns (address); /** - * @dev Returns the staking pool detail. + * @dev Returns the staking pool details. + */ + function getPoolDetail( + TConsensus consensusAddr + ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal); + + function getPoolDetailById( + address poolId + ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal); + + /** + * @dev Returns the self-staking amounts of the pools. */ - function getPoolDetail(address) external view returns (address _admin, uint256 _stakingAmount, uint256 _stakingTotal); + function getManySelfStakings(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory); /** * @dev Returns the self-staking amounts of the pools. */ - function getManySelfStakings(address[] calldata) external view returns (uint256[] memory); + function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory); /** * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated. @@ -77,7 +101,7 @@ interface IBaseStaking { * Emits the event `CooldownSecsToUndelegateUpdated`. * */ - function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external; + function setCooldownSecsToUndelegate(uint256 cooldownSecs) external; /** * @dev Sets the number of seconds that a candidate must wait to be revoked. @@ -88,5 +112,5 @@ interface IBaseStaking { * Emits the event `WaitingSecsToRevokeUpdated`. * */ - function setWaitingSecsToRevoke(uint256 _secs) external; + function setWaitingSecsToRevoke(uint256 secs) external; } diff --git a/contracts/interfaces/staking/ICandidateStaking.sol b/contracts/interfaces/staking/ICandidateStaking.sol index 037ed065e..513630c50 100644 --- a/contracts/interfaces/staking/ICandidateStaking.sol +++ b/contracts/interfaces/staking/ICandidateStaking.sol @@ -11,9 +11,9 @@ interface ICandidateStaking is IRewardPool { event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate); /// @dev Emitted when the pool admin staked for themself. - event Staked(address indexed consensuAddr, uint256 amount); + event Staked(address indexed poolId, uint256 amount); /// @dev Emitted when the pool admin unstaked the amount of RON from themself. - event Unstaked(address indexed consensuAddr, uint256 amount); + event Unstaked(address indexed poolId, uint256 amount); /// @dev Emitted when the validator pool is approved. event PoolApproved(address indexed validator, address indexed admin); @@ -21,14 +21,14 @@ interface ICandidateStaking is IRewardPool { event PoolsDeprecated(address[] validator); /// @dev Emitted when the staking amount transfer failed. event StakingAmountTransferFailed( - address indexed validator, + address indexed poolId, address indexed admin, uint256 amount, uint256 contractBalance ); /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed. event StakingAmountDeductFailed( - address indexed validator, + address indexed poolId, address indexed recipient, uint256 amount, uint256 contractBalance @@ -57,7 +57,7 @@ interface ICandidateStaking is IRewardPool { /** * @dev Returns the commission rate range that the candidate can set. */ - function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange); + function getCommissionRateRange() external view returns (uint256 minRange, uint256 maxRange); /** * @dev Sets the minimum threshold for being a validator candidate. @@ -79,7 +79,7 @@ interface ICandidateStaking is IRewardPool { * Emits the `CommissionRateRangeUpdated` event. * */ - function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external; + function setCommissionRateRange(uint256 minRate, uint256 maxRate) external; /** * @dev Proposes a candidate to become a validator. @@ -91,15 +91,16 @@ interface ICandidateStaking is IRewardPool { * * Emits the event `PoolApproved`. * - * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects + * @param candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects * to its candidate, e.g. scheduling maintenance. * */ function applyValidatorCandidate( - address _candidateAdmin, - address _consensusAddr, - address payable _treasuryAddr, - uint256 _commissionRate + address candidateAdmin, + TConsensus consensusAddr, + address payable treasuryAddr, + uint256 commissionRate, + bytes calldata pubkey ) external payable; /** @@ -115,10 +116,10 @@ interface ICandidateStaking is IRewardPool { * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin. * */ - function execDeprecatePools(address[] calldata _pools, uint256 _period) external; + function execDeprecatePools(address[] calldata pools, uint256 period) external; /** - * @dev Self-delegates to the validator candidate `_consensusAddr`. + * @dev Self-delegates to the validator candidate `consensusAddr`. * * Requirements: * - The consensus address is a validator candidate. @@ -128,10 +129,10 @@ interface ICandidateStaking is IRewardPool { * Emits the event `Staked`. * */ - function stake(address _consensusAddr) external payable; + function stake(TConsensus consensusAddr) external payable; /** - * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`. + * @dev Unstakes from the validator candidate `consensusAddr` for `amount`. * * Requirements: * - The consensus address is a validator candidate. @@ -140,7 +141,7 @@ interface ICandidateStaking is IRewardPool { * Emits the event `Unstaked`. * */ - function unstake(address _consensusAddr, uint256 _amount) external; + function unstake(TConsensus consensusAddr, uint256 amount) external; /** * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager @@ -156,9 +157,9 @@ interface ICandidateStaking is IRewardPool { * */ function requestUpdateCommissionRate( - address _consensusAddr, - uint256 _effectiveDaysOnwards, - uint256 _commissionRate + TConsensus consensusAddr, + uint256 effectiveDaysOnwards, + uint256 commissionRate ) external; /** @@ -169,7 +170,7 @@ interface ICandidateStaking is IRewardPool { * - The method caller is the pool admin. * */ - function requestRenounce(address _consensusAddr) external; + function requestRenounce(TConsensus consensusAddr) external; /** * @dev Renounces being a validator candidate and takes back the delegating/staking amount. @@ -179,5 +180,5 @@ interface ICandidateStaking is IRewardPool { * - The method caller is the pool admin. * */ - function requestEmergencyExit(address _consensusAddr) external; + function requestEmergencyExit(TConsensus consensusAddr) external; } diff --git a/contracts/interfaces/staking/IDelegatorStaking.sol b/contracts/interfaces/staking/IDelegatorStaking.sol index 1d4fbe94d..01fc95fd3 100644 --- a/contracts/interfaces/staking/IDelegatorStaking.sol +++ b/contracts/interfaces/staking/IDelegatorStaking.sol @@ -6,9 +6,9 @@ import "./IRewardPool.sol"; interface IDelegatorStaking is IRewardPool { /// @dev Emitted when the delegator staked for a validator candidate. - event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount); + event Delegated(address indexed delegator, address indexed poolId, uint256 amount); /// @dev Emitted when the delegator unstaked from a validator candidate. - event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount); + event Undelegated(address indexed delegator, address indexed poolId, uint256 amount); /// @dev Error of undelegating zero amount. error ErrUndelegateZeroAmount(); @@ -27,7 +27,7 @@ interface IDelegatorStaking is IRewardPool { * Emits the `Delegated` event. * */ - function delegate(address _consensusAddr) external payable; + function delegate(TConsensus consensusAddr) external payable; /** * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`. @@ -38,7 +38,7 @@ interface IDelegatorStaking is IRewardPool { * Emits the `Undelegated` event. * */ - function undelegate(address _consensusAddr, uint256 _amount) external; + function undelegate(TConsensus consensusAddr, uint256 amount) external; /** * @dev Bulk unstakes from a list of candidates. @@ -49,7 +49,7 @@ interface IDelegatorStaking is IRewardPool { * Emits the events `Undelegated`. * */ - function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external; + function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external; /** * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. @@ -61,14 +61,14 @@ interface IDelegatorStaking is IRewardPool { * Emits the `Undelegated` event and the `Delegated` event. * */ - function redelegate(address _consensusAddrSrc, address _consensusAddrDst, uint256 _amount) external; + function redelegate(TConsensus consensusAddrSrc, TConsensus consensusAddrDst, uint256 amount) external; /** * @dev Returns the claimable reward of the user `_user`. */ function getRewards( - address _user, - address[] calldata _poolAddrList + address user, + TConsensus[] calldata consensusAddrList ) external view returns (uint256[] memory _rewards); /** @@ -77,7 +77,7 @@ interface IDelegatorStaking is IRewardPool { * Emits the `RewardClaimed` event. * */ - function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount); + function claimRewards(TConsensus[] calldata consensusAddrList) external returns (uint256 amount); /** * @dev Claims the rewards and delegates them to the consensus address. @@ -90,7 +90,7 @@ interface IDelegatorStaking is IRewardPool { * */ function delegateRewards( - address[] calldata _consensusAddrList, - address _consensusAddrDst - ) external returns (uint256 _amount); + TConsensus[] calldata consensusAddrList, + TConsensus consensusAddrDst + ) external returns (uint256 amount); } diff --git a/contracts/interfaces/staking/IRewardPool.sol b/contracts/interfaces/staking/IRewardPool.sol index 29de6072e..02e9217d0 100644 --- a/contracts/interfaces/staking/IRewardPool.sol +++ b/contracts/interfaces/staking/IRewardPool.sol @@ -4,6 +4,8 @@ pragma solidity ^0.8.9; import "../../interfaces/consumers/PeriodWrapperConsumer.sol"; +import { TPoolId, TConsensus } from "../../udvts/Types.sol"; + interface IRewardPool is PeriodWrapperConsumer { struct UserRewardFields { // Recorded reward amount. @@ -43,28 +45,37 @@ interface IRewardPool is PeriodWrapperConsumer { /** * @dev Returns the reward amount that user claimable. */ - function getReward(address _poolAddr, address _user) external view returns (uint256); + function getReward(TConsensus consensusAddr, address user) external view returns (uint256); /** * @dev Returns the staking amount of an user. */ - function getStakingAmount(address _poolAddr, address _user) external view returns (uint256); + function getStakingAmount(TConsensus consensusAddr, address user) external view returns (uint256); /** * @dev Returns the staking amounts of the users. */ function getManyStakingAmounts( - address[] calldata _poolAddrs, - address[] calldata _userList + TConsensus[] calldata consensusAddrs, + address[] calldata userList + ) external view returns (uint256[] memory); + + function getManyStakingAmountsById( + address[] calldata poolIds, + address[] calldata userList ) external view returns (uint256[] memory); /** * @dev Returns the total staking amount of all users for a pool. */ - function getStakingTotal(address _poolAddr) external view returns (uint256); + function getStakingTotal(TConsensus consensusAddr) external view returns (uint256); /** * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`. */ - function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory); + function getManyStakingTotals(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory); + + function getManyStakingTotalsById( + address[] calldata poolIds + ) external view returns (uint256[] memory stakingAmounts_); } diff --git a/contracts/interfaces/staking/IStaking.sol b/contracts/interfaces/staking/IStaking.sol index 63e31ceeb..b3e35dadf 100644 --- a/contracts/interfaces/staking/IStaking.sol +++ b/contracts/interfaces/staking/IStaking.sol @@ -3,10 +3,11 @@ pragma solidity ^0.8.9; import "./IBaseStaking.sol"; +import "./IStakingCallback.sol"; import "./ICandidateStaking.sol"; import "./IDelegatorStaking.sol"; -interface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking { +interface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking, IStakingCallback { /** * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. * @@ -20,11 +21,7 @@ interface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorSt * Note: This method should be called once at the period ending. * */ - function execRecordRewards( - address[] calldata _consensusAddrs, - uint256[] calldata _rewards, - uint256 _period - ) external payable; + function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards, uint256 period) external payable; /** * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`. @@ -35,8 +32,5 @@ interface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorSt * Emits the event `Unstaked`. * */ - function execDeductStakingAmount( - address _consensusAddr, - uint256 _amount - ) external returns (uint256 _actualDeductingAmount); + function execDeductStakingAmount(address poolId, uint256 amount) external returns (uint256 actualDeductingAmount); } diff --git a/contracts/interfaces/staking/IStakingCallback.sol b/contracts/interfaces/staking/IStakingCallback.sol new file mode 100644 index 000000000..ac16f8218 --- /dev/null +++ b/contracts/interfaces/staking/IStakingCallback.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.9; + +import { TPoolId } from "../../udvts/Types.sol"; + +interface IStakingCallback { + /** + * @dev Requirements: + * - Only Profile contract can call this method. + */ + function execChangeAdminAddress(address poolAddr, address newAdminAddr) external; +} diff --git a/contracts/interfaces/validator/ICandidateManager.sol b/contracts/interfaces/validator/ICandidateManager.sol index 2ccb5bee3..1c556330b 100644 --- a/contracts/interfaces/validator/ICandidateManager.sol +++ b/contracts/interfaces/validator/ICandidateManager.sol @@ -2,29 +2,42 @@ pragma solidity ^0.8.9; +import { TConsensus } from "../../udvts/Types.sol"; + interface ICandidateManager { struct ValidatorCandidate { - // Admin of the candidate - address admin; - // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address. - address consensusAddr; - // Address that receives mining reward of the validator - address payable treasuryAddr; - // Address of the bridge operator corresponding to the candidate - address ______deprecatedbridgeOperatorAddr; - // The percentage of reward that validators can be received, the rest goes to the delegators. - // Values in range [0; 100_00] stands for 0-100% + /** + * @dev The address of the candidate admin. + * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin. + */ + address __shadowedAdmin; + /** + * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address. + * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus. + */ + TConsensus __shadowedConsensus; + /** + * @dev Address that receives mining reward of the validator + * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury. + */ + address payable __shadowedTreasury; + /// @dev Address of the bridge operator corresponding to the candidate + address ____deprecatedBridgeOperatorAddr; + /** + * @dev The percentage of reward that validators can be received, the rest goes to the delegators. + * Values in range [0; 100_00] stands for 0-100% + */ uint256 commissionRate; - // The timestamp that scheduled to revoke the candidate (no schedule=0) + /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0) uint256 revokingTimestamp; - // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0) + /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0) uint256 topupDeadline; } struct CommissionSchedule { - // The timestamp that the commission schedule gets affected (no schedule=0). + /// @dev The timestamp that the commission schedule gets affected (no schedule=0). uint256 effectiveTimestamp; - // The new commission rate. Value is in range [0; 100_00], stands for 0-100% + /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100% uint256 commissionRate; } @@ -35,17 +48,14 @@ interface ICandidateManager { /// @dev Emitted when the validator candidate is granted. event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin); /// @dev Emitted when the revoking timestamp of a candidate is updated. - event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp); + event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp); /// @dev Emitted when the topup deadline of a candidate is updated. - event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline); + event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline); /// @dev Emitted when the validator candidate is revoked. event CandidatesRevoked(address[] consensusAddrs); - /// @dev Emitted when a schedule for updating commission rate is set. - event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate); /// @dev Emitted when the commission rate of a validator is updated. event CommissionRateUpdated(address indexed consensusAddr, uint256 rate); - /// @dev Error of exceeding maximum number of candidates. error ErrExceedsMaxNumberOfCandidate(); /// @dev Error of querying for already existent candidate. @@ -53,21 +63,13 @@ interface ICandidateManager { /// @dev Error of querying for non-existent candidate. error ErrNonExistentCandidate(); /// @dev Error of candidate admin already exists. - error ErrExistentCandidateAdmin(address _candidateAdminAddr); + error ErrExistentCandidateAdmin(address candidateAdminAddr); /// @dev Error of treasury already exists. error ErrExistentTreasury(address _treasuryAddr); /// @dev Error of invalid commission rate. error ErrInvalidCommissionRate(); - /// @dev Error of invalid effective days onwards. - error ErrInvalidEffectiveDaysOnwards(); - /// @dev Error of invalid min effective days onwards. + /// @dev Error of invalid min effective days onwards. error ErrInvalidMinEffectiveDaysOnwards(); - /// @dev Error of already requested revoking candidate before. - error ErrAlreadyRequestedRevokingCandidate(); - /// @dev Error of commission change schedule exists. - error ErrAlreadyRequestedUpdatingCommissionRate(); - /// @dev Error of trusted org cannot renounce. - error ErrTrustedOrgCannotRenounce(); /** * @dev Returns the maximum number of validator candidate. @@ -101,50 +103,10 @@ interface ICandidateManager { */ function setMinEffectiveDaysOnwards(uint256 _numOfDays) external; - /** - * @dev Grants a validator candidate. - * - * Requirements: - * - The method caller is staking contract. - * - * Emits the event `CandidateGranted`. - * - */ - function execApplyValidatorCandidate( - address _admin, - address _consensusAddr, - address payable _treasuryAddr, - uint256 _commissionRate - ) external; - - /** - * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds. - * - * Requirements: - * - The method caller is staking contract. - * - * Emits the event `CandidateRevokingTimestampUpdated`. - * - */ - function execRequestRenounceCandidate(address, uint256 _secsLeft) external; - - /** - * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`. - * - * Requirements: - * - The method caller is the staking contract. - * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - * - The `_rate` must be in range of [0_00; 100_00]. - * - * Emits the event `CommissionRateUpdateScheduled`. - * - */ - function execRequestUpdateCommissionRate(address _consensusAddr, uint256 _effectiveTimestamp, uint256 _rate) external; - /** * @dev Returns whether the address is a validator (candidate). */ - function isValidatorCandidate(address _addr) external view returns (bool); + function isValidatorCandidate(TConsensus consensus) external view returns (bool); /** * @dev Returns the validator candidate. @@ -159,15 +121,15 @@ interface ICandidateManager { /** * @dev Returns the info of a candidate. */ - function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory); + function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory); /** * @dev Returns whether the address is the candidate admin. */ - function isCandidateAdmin(address _candidate, address _admin) external view returns (bool); + function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool); /** * @dev Returns the schedule of changing commission rate of a candidate address. */ - function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory); + function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory); } diff --git a/contracts/interfaces/validator/ICandidateManagerCallback.sol b/contracts/interfaces/validator/ICandidateManagerCallback.sol new file mode 100644 index 000000000..27b9baf5c --- /dev/null +++ b/contracts/interfaces/validator/ICandidateManagerCallback.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.9; + +import { TConsensus } from "../../udvts/Types.sol"; + +interface ICandidateManagerCallback { + /// @dev Emitted when a schedule for updating commission rate is set. + event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate); + /// @dev Error of already requested revoking candidate before. + error ErrAlreadyRequestedRevokingCandidate(); + /// @dev Error of commission change schedule exists. + error ErrAlreadyRequestedUpdatingCommissionRate(); + /// @dev Error of trusted org cannot renounce. + error ErrTrustedOrgCannotRenounce(); + /// @dev Error of invalid effective days onwards. + error ErrInvalidEffectiveDaysOnwards(); + + /** + * @dev Grants a validator candidate. + * + * Requirements: + * - The method caller is staking contract. + * + * Emits the event `CandidateGranted`. + * + */ + function execApplyValidatorCandidate( + address candidateAdmin, + address cid, + address payable treasuryAddr, + uint256 commissionRate + ) external; + + /** + * @dev Requests to revoke a validator candidate in next `secsLeft` seconds. + * + * Requirements: + * - The method caller is staking contract. + * + * Emits the event `CandidateRevokingTimestampUpdated`. + * + */ + function execRequestRenounceCandidate(address, uint256 secsLeft) external; + + /** + * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`. + * + * Requirements: + * - The method caller is the staking contract. + * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards + * - The `rate` must be in range of [0_00; 100_00]. + * + * Emits the event `CommissionRateUpdateScheduled`. + * + */ + function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external; + + /** + * @dev Fallback function of `Profile-requestChangeAdminAddress`. + * This updates the shadow storage slot of "shadowedAdmin" for candidate id `id` to `newAdmin`. + * + * Requirements: + * - The caller must be the Profile contract. + */ + function execChangeAdminAddress(address cid, address newAdmin) external; + + /** + * @dev Fallback function of `Profile-requestChangeConsensusAddress`. + * This updates the shadow storage slot of "shadowedConsensus" for candidate id `id` to `newAdmin`. + * + * Requirements: + * - The caller must be the Profile contract. + */ + function execChangeConsensusAddress(address cid, TConsensus newConsensus) external; + + /** + * @dev Fallback function of `Profile-requestChangeTreasuryAddress`. + * This updates the shadow storage slot of "shadowedTreasury" for candidate id `id` to `newAdmin`. + * + * Requirements: + * - The caller must be the Profile contract. + */ + function execChangeTreasuryAddress(address cid, address payable newTreasury) external; +} diff --git a/contracts/interfaces/validator/IEmergencyExit.sol b/contracts/interfaces/validator/IEmergencyExit.sol index d6a2cb5e8..cdc93a28e 100644 --- a/contracts/interfaces/validator/IEmergencyExit.sol +++ b/contracts/interfaces/validator/IEmergencyExit.sol @@ -26,6 +26,10 @@ interface IEmergencyExit { /// @dev Error of already requested emergency exit before. error ErrAlreadyRequestedEmergencyExit(); + /// @dev Error thrown when the info of releasing locked fund not exist. + error ErrLockedFundReleaseInfoNotFound(address cid); + /// @dev Error thrown when the the locked fund of emergency exit might be recycled. + error ErrLockedFundMightBeRecycled(address cid); /** * @dev Returns the amount of RON to lock from a consensus address. @@ -69,7 +73,7 @@ interface IEmergencyExit { * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock. * */ - function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external; + function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external; /** * @dev Fallback function of `IStaking-requestEmergencyExit`. @@ -78,5 +82,5 @@ interface IEmergencyExit { * - The method caller is staking contract. * */ - function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external; + function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external; } diff --git a/contracts/interfaces/validator/IRoninValidatorSet.sol b/contracts/interfaces/validator/IRoninValidatorSet.sol index 6628bf136..62ba508a0 100644 --- a/contracts/interfaces/validator/IRoninValidatorSet.sol +++ b/contracts/interfaces/validator/IRoninValidatorSet.sol @@ -3,12 +3,14 @@ pragma solidity ^0.8.9; import "./ICandidateManager.sol"; +import "./ICandidateManagerCallback.sol"; import "./info-fragments/ICommonInfo.sol"; import "./ICoinbaseExecution.sol"; import "./ISlashingExecution.sol"; import "./IEmergencyExit.sol"; interface IRoninValidatorSet is + ICandidateManagerCallback, ICandidateManager, ICommonInfo, ISlashingExecution, diff --git a/contracts/interfaces/validator/ISlashingExecution.sol b/contracts/interfaces/validator/ISlashingExecution.sol index 5a8900ef6..f55b2bcc2 100644 --- a/contracts/interfaces/validator/ISlashingExecution.sol +++ b/contracts/interfaces/validator/ISlashingExecution.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.9; interface ISlashingExecution { /// @dev Emitted when the validator is punished. event ValidatorPunished( - address indexed consensusAddr, + address indexed cid, uint256 indexed period, uint256 jailedUntil, uint256 deductedStakingAmount, @@ -13,7 +13,7 @@ interface ISlashingExecution { bool bridgeOperatorRewardDeprecated ); /// @dev Emitted when the validator get out of jail by bailout. - event ValidatorUnjailed(address indexed validator, uint256 period); + event ValidatorUnjailed(address indexed cid, uint256 period); /// @dev Error of cannot bailout due to high tier slash. error ErrCannotBailout(address validator); @@ -27,7 +27,7 @@ interface ISlashingExecution { * Emits the event `ValidatorPunished`. * */ - function execSlash(address validatorAddr, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external; + function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external; /** * @dev Finalize the bailout request from slash indicator contract. @@ -38,5 +38,5 @@ interface ISlashingExecution { * Emits the event `ValidatorUnjailed`. * */ - function execBailOut(address _validatorAddr, uint256 _period) external; + function execBailOut(address cid, uint256 period) external; } diff --git a/contracts/interfaces/validator/info-fragments/ICommonInfo.sol b/contracts/interfaces/validator/info-fragments/ICommonInfo.sol index 4bf226288..96ac29828 100644 --- a/contracts/interfaces/validator/info-fragments/ICommonInfo.sol +++ b/contracts/interfaces/validator/info-fragments/ICommonInfo.sol @@ -31,5 +31,5 @@ interface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 { /** * @dev Returns the emergency exit request. */ - function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory); + function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory); } diff --git a/contracts/interfaces/validator/info-fragments/IJailingInfo.sol b/contracts/interfaces/validator/info-fragments/IJailingInfo.sol index e838df9c9..dd0d9571b 100644 --- a/contracts/interfaces/validator/info-fragments/IJailingInfo.sol +++ b/contracts/interfaces/validator/info-fragments/IJailingInfo.sol @@ -2,44 +2,48 @@ pragma solidity ^0.8.9; +import "../../../udvts/Types.sol"; + interface IJailingInfo { /** * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period. */ - function checkJailed(address) external view returns (bool); + function checkJailed(TConsensus) external view returns (bool); /** * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail. */ function getJailedTimeLeft( - address _addr + TConsensus addr ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_); /** * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block. */ - function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool); + function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool); /** * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail. */ function getJailedTimeLeftAtBlock( - address _addr, - uint256 _blockNum + TConsensus addr, + uint256 blockNum ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_); /** * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period. */ - function checkManyJailed(address[] calldata) external view returns (bool[] memory); + function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory); + + function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory); /** * @dev Returns whether the incoming reward of the block producer is deprecated during the current period. */ - function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool); + function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool); /** * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period. */ - function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool); + function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool); } diff --git a/contracts/interfaces/validator/info-fragments/IValidatorInfo.sol b/contracts/interfaces/validator/info-fragments/IValidatorInfo.sol deleted file mode 100644 index 133f56378..000000000 --- a/contracts/interfaces/validator/info-fragments/IValidatorInfo.sol +++ /dev/null @@ -1,113 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.9; - -import "../../../libraries/EnumFlags.sol"; - -interface IValidatorInfo { - /** - * @dev Error thrown when an invalid maximum prioritized validator number is provided. - */ - error ErrInvalidMaxPrioritizedValidatorNumber(); - - /// @dev Emitted when the number of max validator is updated. - event MaxValidatorNumberUpdated(uint256); - /// @dev Emitted when the number of reserved slots for prioritized validators is updated. - event MaxPrioritizedValidatorNumberUpdated(uint256); - - /** - * @dev Returns the maximum number of validators in the epoch. - */ - function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber); - - /** - * @dev Returns the number of reserved slots for prioritized validators. - */ - function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber); - - /** - * @dev Returns the current validator list. - */ - function getValidators() - external - view - returns ( - address[] memory _validatorList, - address[] memory _bridgeOperators, - EnumFlags.ValidatorFlag[] memory _flags - ); - - /** - * @dev Returns whether the address is either a bridge operator or a block producer. - */ - function isValidator(address _addr) external view returns (bool); - - /** - * @dev Returns the current block producer list. - */ - function getBlockProducers() external view returns (address[] memory); - - /** - * @dev Returns whether the address is block producer or not. - */ - function isBlockProducer(address _addr) external view returns (bool); - - /** - * @dev Returns total numbers of the block producers. - */ - function totalBlockProducer() external view returns (uint256); - - /** - * @dev Returns the current on-working bridge operator list. - * @param bridgeOperatorList The list of working bridge operators. - * @param validatorList The list of corresponding validators. - */ - function getBridgeOperators() - external - view - returns (address[] memory bridgeOperatorList, address[] memory validatorList); - - /** - * @dev Returns the bridge operator list corresponding to validator address list. - */ - function getBridgeOperatorsOf( - address[] memory _validatorAddrs - ) external view returns (address[] memory bridgeOperatorList); - - /** - * @dev Returns whether the address is bridge operator. - */ - function isBridgeOperator(address _addr) external view returns (bool isOperator); - - /** - * @dev Returns whether the consensus address is operating the bridge or not. - */ - function isOperatingBridge(address _consensusAddr) external view returns (bool); - - /** - * @dev Returns total numbers of the bridge operators. - */ - function totalBridgeOperator() external view returns (uint256); - - /** - * @dev Updates the max validator number - * - * Requirements: - * - The method caller is admin - * - * Emits the event `MaxValidatorNumberUpdated` - * - */ - function setMaxValidatorNumber(uint256 _maxValidatorNumber) external; - - /** - * @dev Updates the number of reserved slots for prioritized validators - * - * Requirements: - * - The method caller is admin - * - * Emits the event `MaxPrioritizedValidatorNumberUpdated` - * - */ - function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external; -} diff --git a/contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol b/contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol index 0f8e6ba55..1d73cfd5f 100644 --- a/contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol +++ b/contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol @@ -3,13 +3,11 @@ pragma solidity ^0.8.9; import "../../../libraries/EnumFlags.sol"; +import { TConsensus } from "../../../udvts/Types.sol"; interface IValidatorInfoV2 { - /** - * @dev Error thrown when an invalid maximum prioritized validator number is provided. - */ + /// @dev Error thrown when an invalid maximum prioritized validator number is provided. error ErrInvalidMaxPrioritizedValidatorNumber(); - /// @dev Emitted when the number of max validator is updated. event MaxValidatorNumberUpdated(uint256); /// @dev Emitted when the number of reserved slots for prioritized validators is updated. @@ -38,7 +36,7 @@ interface IValidatorInfoV2 { /** * @dev Returns whether the address is block producer or not. */ - function isBlockProducer(address _addr) external view returns (bool); + function isBlockProducer(TConsensus consensusAddr) external view returns (bool); /** * @dev Returns total numbers of the block producers. diff --git a/contracts/libraries/EmergencyExitBallot.sol b/contracts/libraries/EmergencyExitBallot.sol index 1df9aa869..10d79271d 100644 --- a/contracts/libraries/EmergencyExitBallot.sol +++ b/contracts/libraries/EmergencyExitBallot.sol @@ -4,6 +4,9 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; library EmergencyExitBallot { + // NOTE: The "address consensusAddress" is not changed in order to preserve the type hash. Since the EmergencyExitBallot + // is not a library and is hashed by param feeds, not change the type hash still assure the contract to works correctly. + // keccak256("EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)"); bytes32 private constant EMERGENCY_EXIT_BALLOT_TYPEHASH = 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027; @@ -12,30 +15,30 @@ library EmergencyExitBallot { * @dev Returns hash of the ballot. */ function hash( - address _consensusAddress, - address _recipientAfterUnlockedFund, - uint256 _requestedAt, - uint256 _expiredAt + address validatorId, + address recipientAfterUnlockedFund, + uint256 requestedAt, + uint256 expiredAt ) internal pure returns (bytes32 digest) { /* * return * keccak256( * abi.encode( * EMERGENCY_EXIT_BALLOT_TYPEHASH, - * _consensusAddress, - * _recipientAfterUnlockedFund, - * _requestedAt, - * _expiredAt + * validatorId, + * recipientAfterUnlockedFund, + * requestedAt, + * expiredAt * ) * ); */ assembly { let ptr := mload(0x40) mstore(ptr, EMERGENCY_EXIT_BALLOT_TYPEHASH) - mstore(add(ptr, 0x20), _consensusAddress) - mstore(add(ptr, 0x40), _recipientAfterUnlockedFund) - mstore(add(ptr, 0x60), _requestedAt) - mstore(add(ptr, 0x80), _expiredAt) + mstore(add(ptr, 0x20), validatorId) + mstore(add(ptr, 0x40), recipientAfterUnlockedFund) + mstore(add(ptr, 0x60), requestedAt) + mstore(add(ptr, 0x80), expiredAt) digest := keccak256(ptr, 0xa0) } } diff --git a/contracts/mocks/MockStaking.sol b/contracts/mocks/MockStaking.sol index 283e6c6c4..2e71e0afb 100644 --- a/contracts/mocks/MockStaking.sol +++ b/contracts/mocks/MockStaking.sol @@ -27,11 +27,11 @@ contract MockStaking is RewardCalculation, GlobalConfigConsumer { } function endPeriod() external { - address[] memory _addrs = new address[](1); + address[] memory _consensusAddrs = new address[](1); uint256[] memory _rewards = new uint256[](1); - _addrs[0] = poolAddr; + _consensusAddrs[0] = poolAddr; _rewards[0] = pendingReward; - this.execRecordRewards(_addrs, _rewards); + this.execRecordRewards(_consensusAddrs, _rewards); pendingReward = 0; lastUpdatedPeriod++; @@ -65,8 +65,8 @@ contract MockStaking is RewardCalculation, GlobalConfigConsumer { pendingReward -= _amount; } - function execRecordRewards(address[] calldata _addrList, uint256[] calldata _rewards) external { - _recordRewards(_addrList, _rewards, _currentPeriod()); + function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards) external { + _recordRewards(poolIds, rewards, _currentPeriod()); } function getPeriod() public view returns (uint256) { @@ -77,22 +77,39 @@ contract MockStaking is RewardCalculation, GlobalConfigConsumer { _amount = _claimReward(poolAddr, _user, getPeriod()); } - function getStakingAmount(address, address _user) public view override returns (uint256) { - return _stakingAmount[_user]; + function getStakingAmount(TConsensus, address _user) public view override returns (uint256) { + return _getStakingAmount(address(0), _user); } function getManyStakingAmounts( - address[] calldata _poolAddrs, - address[] calldata _userList + TConsensus[] calldata consensusAddrs, + address[] calldata userList + ) external view override returns (uint256[] memory) {} + + function getManyStakingAmountsById( + address[] calldata poolIds, + address[] calldata userList ) external view override returns (uint256[] memory) {} - function getStakingTotal(address _addr) public view virtual override returns (uint256) { - return _addr == poolAddr ? _stakingTotal : 0; + function _getStakingAmount(address, address _user) internal view override returns (uint256) { + return _stakingAmount[_user]; + } + + function getStakingTotal(TConsensus addr) external view virtual override returns (uint256) { + return _getStakingTotal(TConsensus.unwrap(addr)); + } + + function _getStakingTotal(address poolId) internal view virtual override returns (uint256) { + return poolId == poolAddr ? _stakingTotal : 0; } function _currentPeriod() internal view override returns (uint256 _period) { return lastUpdatedPeriod; } - function getManyStakingTotals(address[] calldata _poolAddr) external view override returns (uint256[] memory) {} + function getManyStakingTotals(TConsensus[] calldata _poolAddr) external view override returns (uint256[] memory) {} + + function getManyStakingTotalsById( + address[] calldata poolIds + ) external view returns (uint256[] memory stakingAmounts_) {} } diff --git a/contracts/mocks/validator/MockRoninValidatorSetExtended.sol b/contracts/mocks/validator/MockRoninValidatorSetExtended.sol index 5cbc7ae8f..e26b1442c 100644 --- a/contracts/mocks/validator/MockRoninValidatorSetExtended.sol +++ b/contracts/mocks/validator/MockRoninValidatorSetExtended.sol @@ -48,8 +48,9 @@ contract MockRoninValidatorSetExtended is MockRoninValidatorSetOverridePrecompil function addValidators(address[] calldata _addrs) public { for (uint _i = 0; _i < _addrs.length; _i++) { - _validators[_i] = _addrs[_i]; - _validatorMap[_addrs[_i]] = EnumFlags.ValidatorFlag.Both; + address _cAddr = _addrs[_i]; + _validatorIds[_i] = _cAddr; + _validatorMap[_cAddr] = EnumFlags.ValidatorFlag.Both; } } } diff --git a/contracts/mocks/validator/MockValidatorSet.sol b/contracts/mocks/validator/MockValidatorSet.sol index ddd76a5b5..fcc231361 100644 --- a/contracts/mocks/validator/MockValidatorSet.sol +++ b/contracts/mocks/validator/MockValidatorSet.sol @@ -3,12 +3,12 @@ pragma solidity ^0.8.9; import "../../interfaces/validator/IRoninValidatorSet.sol"; -import "../../ronin/validator/CandidateManager.sol"; +import "../../ronin/validator/CandidateManagerCallback.sol"; import { HasStakingVestingDeprecated, HasSlashIndicatorDeprecated } from "../../utils/DeprecatedSlots.sol"; contract MockValidatorSet is IRoninValidatorSet, - CandidateManager, + CandidateManagerCallback, HasStakingVestingDeprecated, HasSlashIndicatorDeprecated { @@ -18,16 +18,18 @@ contract MockValidatorSet is mapping(uint256 => bool) internal _periodSlashed; constructor( - address __stakingContract, + address _stakingContract, address _slashIndicatorContract, address _stakingVestingContract, + address _profileContract, uint256 __maxValidatorCandidate, uint256 __numberOfBlocksInEpoch, uint256 __minEffectiveDaysOnwards ) { - _setContract(ContractType.STAKING, __stakingContract); + _setContract(ContractType.STAKING, _stakingContract); _setContract(ContractType.SLASH_INDICATOR, _slashIndicatorContract); _setContract(ContractType.STAKING_VESTING, _stakingVestingContract); + _setContract(ContractType.PROFILE, _profileContract); _setMaxValidatorCandidate(__maxValidatorCandidate); _numberOfBlocksInEpoch = __numberOfBlocksInEpoch; _minEffectiveDaysOnwards = __minEffectiveDaysOnwards; @@ -42,14 +44,16 @@ contract MockValidatorSet is function getLastUpdatedBlock() external view override returns (uint256) {} - function checkManyJailed(address[] calldata) external view override returns (bool[] memory) {} + function checkManyJailed(TConsensus[] calldata) external view override returns (bool[] memory) {} - function checkMiningRewardDeprecatedAtPeriod(address, uint256 _period) external view override returns (bool) {} + function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory) {} - function checkMiningRewardDeprecated(address) external view override returns (bool) {} + function checkMiningRewardDeprecated(TConsensus) external view override returns (bool) {} + + function checkMiningRewardDeprecatedAtPeriod(TConsensus, uint256 period) external view override returns (bool) {} function checkBridgeRewardDeprecatedAtPeriod( - address _consensusAddr, + TConsensus _consensusAddr, uint256 _period ) external view returns (bool _result) {} @@ -59,12 +63,7 @@ contract MockValidatorSet is function epochEndingAt(uint256 _block) external view override returns (bool) {} - function execSlash( - address validatorAddr, - uint256 newJailedUntil, - uint256 slashAmount, - bool cannotBailout - ) external override {} + function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external override {} function execBailOut(address, uint256) external override {} @@ -87,7 +86,7 @@ contract MockValidatorSet is function getBlockProducers() external view override returns (address[] memory) {} - function isBlockProducer(address) external pure override returns (bool) { + function isBlockProducer(TConsensus) external pure override returns (bool) { return true; } @@ -103,23 +102,31 @@ contract MockValidatorSet is return block.timestamp / 86400; } - function checkJailed(address) external view override returns (bool) {} + function checkJailed(TConsensus) external view override returns (bool) {} - function getJailedTimeLeft(address) external view override returns (bool, uint256, uint256) {} + function getJailedTimeLeft(TConsensus) external view override returns (bool, uint256, uint256) {} function currentPeriodStartAtBlock() external view override returns (uint256) {} - function checkJailedAtBlock(address _addr, uint256 _blockNum) external view override returns (bool) {} + function checkJailedAtBlock(TConsensus _addr, uint256 _blockNum) external view override returns (bool) {} function getJailedTimeLeftAtBlock( - address _addr, + TConsensus _addr, uint256 _blockNum ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {} function totalDeprecatedReward() external view override returns (uint256) {} + function __css2cid(TConsensus consensusAddr) internal view override returns (address) { + return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr); + } + + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view override returns (address[] memory) { + return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs); + } + function execReleaseLockedFundForEmergencyExitRequest( - address _consensusAddr, + address _candidateId, address payable _recipient ) external override {} @@ -131,13 +138,13 @@ contract MockValidatorSet is function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external override {} - function getEmergencyExitInfo(address _consensusAddr) external view override returns (EmergencyExitInfo memory) {} + function getEmergencyExitInfo(TConsensus consensus) external view override returns (EmergencyExitInfo memory) {} - function execEmergencyExit(address, uint256) external {} + function execRequestEmergencyExit(address, uint256) external {} - function isOperatingBridge(address) external view returns (bool) {} + function isOperatingBridge(TConsensus) external view returns (bool) {} function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {} - function _isTrustedOrg(address _consensusAddr) internal virtual override returns (bool) {} + function _isTrustedOrg(address validatorId) internal virtual override returns (bool) {} } diff --git a/contracts/multi-chains/RoninTrustedOrganization.sol b/contracts/multi-chains/RoninTrustedOrganization.sol index e5e78116e..9b4f8978c 100644 --- a/contracts/multi-chains/RoninTrustedOrganization.sol +++ b/contracts/multi-chains/RoninTrustedOrganization.sol @@ -5,43 +5,50 @@ pragma solidity ^0.8.9; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../libraries/AddressArrayUtils.sol"; import "../interfaces/IRoninTrustedOrganization.sol"; +import "../interfaces/IProfile.sol"; import "../extensions/collections/HasProxyAdmin.sol"; +import "../extensions/collections/HasContracts.sol"; +import "../udvts/Types.sol"; -contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable { +contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, HasContracts, Initializable { uint256 internal _num; uint256 internal _denom; uint256 internal _totalWeight; uint256 internal _nonce; /// @dev Mapping from consensus address => weight - mapping(address => uint256) internal _consensusWeight; + mapping(TConsensus => uint256) internal _consensusWeight; /// @dev Mapping from governor address => weight mapping(address => uint256) internal _governorWeight; /// @dev Mapping from bridge voter address => weight - mapping(address => uint256) internal _bridgeVoterWeight; + mapping(address => uint256) internal __deprecatedBridgeVoterWeight; /// @dev Mapping from consensus address => added block - mapping(address => uint256) internal _addedBlock; + mapping(TConsensus => uint256) internal _addedBlock; /// @dev Consensus array - address[] internal _consensusList; + TConsensus[] internal _consensusList; /// @dev Governors array address[] internal _governorList; /// @dev Bridge voters array - address[] internal _bridgeVoterList; + address[] internal __deprecatedBridgeVoterList; /** * @dev Initializes the contract storage. */ - function initialize( - TrustedOrganization[] calldata _trustedOrgs, - uint256 __num, - uint256 __denom - ) external initializer { - if (_trustedOrgs.length > 0) { - _addTrustedOrganizations(_trustedOrgs); + function initialize(TrustedOrganization[] calldata trustedOrgs, uint256 num, uint256 denom) external initializer { + if (trustedOrgs.length > 0) { + _addTrustedOrganizations(trustedOrgs); } - _setThreshold(__num, __denom); + _setThreshold(num, denom); + } + + function initializeV2(address profileContract) external reinitializer(2) { + _setContract(ContractType.PROFILE, profileContract); + for (uint i; i < __deprecatedBridgeVoterList.length; ++i) { + delete __deprecatedBridgeVoterWeight[__deprecatedBridgeVoterList[i]]; + } + delete __deprecatedBridgeVoterList; } /** @@ -100,17 +107,17 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I /** * @inheritdoc IRoninTrustedOrganization */ - function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin { - if (_list.length == 0) revert ErrEmptyArray(); + function removeTrustedOrganizations(TConsensus[] calldata list) external override onlyAdmin { + if (list.length == 0) revert ErrEmptyArray(); - for (uint _i = 0; _i < _list.length; ) { - _removeTrustedOrganization(_list[_i]); + for (uint _i = 0; _i < list.length; ) { + _removeTrustedOrganization(list[_i]); unchecked { ++_i; } } - emit TrustedOrganizationsRemoved(_list); + emit TrustedOrganizationsRemoved(list); } /** @@ -123,59 +130,57 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I /** * @inheritdoc IRoninTrustedOrganization */ - function getConsensusWeight(address _consensusAddr) external view returns (uint256) { - return _consensusWeight[_consensusAddr]; + function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256) { + return _getConsensusWeightByConsensus(consensusAddr); } /** * @inheritdoc IRoninTrustedOrganization */ - function getGovernorWeight(address _governor) external view returns (uint256) { - return _governorWeight[_governor]; + function getConsensusWeightById(address cid) external view returns (uint256) { + return _getConsensusWeightByConsensus(__cid2css(cid)); + } + + function _getConsensusWeightByConsensus(TConsensus consensusAddr) internal view returns (uint256) { + return _consensusWeight[consensusAddr]; } /** * @inheritdoc IRoninTrustedOrganization */ - function getBridgeVoterWeight(address _addr) external view returns (uint256) { - return _bridgeVoterWeight[_addr]; + function getGovernorWeight(address _governor) external view returns (uint256) { + return _governorWeight[_governor]; } /** * @inheritdoc IRoninTrustedOrganization */ - function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) { - _res = new uint256[](_list.length); - for (uint _i = 0; _i < _res.length; ) { - _res[_i] = _consensusWeight[_list[_i]]; - - unchecked { - ++_i; - } - } + function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory) { + return _getManyConsensusWeightsByConsensus(list); } /** * @inheritdoc IRoninTrustedOrganization */ - function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) { - _res = new uint256[](_list.length); - for (uint _i = 0; _i < _res.length; ) { - _res[_i] = _governorWeight[_list[_i]]; + function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory) { + TConsensus[] memory consensusList = __cid2cssBatch(cids); + return _getManyConsensusWeightsByConsensus(consensusList); + } - unchecked { - ++_i; - } + function _getManyConsensusWeightsByConsensus(TConsensus[] memory list) internal view returns (uint256[] memory res) { + res = new uint256[](list.length); + for (uint i = 0; i < res.length; ++i) { + res[i] = _getConsensusWeightByConsensus(list[i]); } } /** * @inheritdoc IRoninTrustedOrganization */ - function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) { + function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) { _res = new uint256[](_list.length); for (uint _i = 0; _i < _res.length; ) { - _res[_i] = _bridgeVoterWeight[_list[_i]]; + _res[_i] = _governorWeight[_list[_i]]; unchecked { ++_i; @@ -186,7 +191,7 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I /** * @inheritdoc IRoninTrustedOrganization */ - function sumConsensusWeight(address[] calldata _list) external view returns (uint256 _res) { + function sumConsensusWeight(TConsensus[] calldata _list) external view returns (uint256 _res) { for (uint _i = 0; _i < _list.length; ) { _res += _consensusWeight[_list[_i]]; @@ -209,19 +214,6 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I } } - /** - * @inheritdoc IRoninTrustedOrganization - */ - function sumBridgeVoterWeight(address[] calldata _list) external view returns (uint256 _res) { - for (uint _i = 0; _i < _list.length; ) { - _res += _bridgeVoterWeight[_list[_i]]; - - unchecked { - ++_i; - } - } - } - /** * @inheritdoc IRoninTrustedOrganization */ @@ -232,15 +224,15 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I /** * @inheritdoc IRoninTrustedOrganization */ - function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) { - _list = new TrustedOrganization[](_consensusList.length); - address _addr; - for (uint256 _i; _i < _list.length; ) { - _addr = _consensusList[_i]; - _list[_i].consensusAddr = _addr; - _list[_i].governor = _governorList[_i]; - _list[_i].bridgeVoter = _bridgeVoterList[_i]; - _list[_i].weight = _consensusWeight[_addr]; + function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory list) { + list = new TrustedOrganization[](_consensusList.length); + TConsensus consensus; + for (uint256 _i; _i < list.length; ) { + consensus = _consensusList[_i]; + list[_i].consensusAddr = consensus; + list[_i].governor = _governorList[_i]; + list[_i].__deprecatedBridgeVoter = address(0); + list[_i].weight = _consensusWeight[consensus]; unchecked { ++_i; @@ -251,34 +243,46 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I /** * @inheritdoc IRoninTrustedOrganization */ - function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) { - for (uint _i = 0; _i < _consensusList.length; ) { - if (_consensusList[_i] == _consensusAddr) { - return getTrustedOrganizationAt(_i); - } - - unchecked { - ++_i; + function getTrustedOrganization(TConsensus _consensusAddr) external view returns (TrustedOrganization memory) { + for (uint i = 0; i < _consensusList.length; ++i) { + if (_consensusList[i] == _consensusAddr) { + return getTrustedOrganizationAt(i); } } - revert ErrQueryForNonExistentConsensusAddress(); } /** * @inheritdoc IRoninTrustedOrganization */ function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) { - address _addr = _consensusList[_idx]; + TConsensus consensus = _consensusList[_idx]; return TrustedOrganization( - _addr, + consensus, _governorList[_idx], - _bridgeVoterList[_idx], - _consensusWeight[_addr], - _addedBlock[_addr] + address(0), + _consensusWeight[consensus], + _addedBlock[consensus] ); } + /** + * @inheritdoc IRoninTrustedOrganization + */ + function execChangeConsensusAddressForTrustedOrg( + TConsensus oldAddr, + TConsensus newAddr + ) external override onlyContract(ContractType.PROFILE) { + uint256 index = _findTrustedOrgIndexByConsensus(oldAddr); + _consensusList[index] = newAddr; + _consensusWeight[newAddr] = _consensusWeight[oldAddr]; + _addedBlock[newAddr] = block.number; + + _deleteConsensusInMappings(oldAddr); + + emit ConsensusAddressOfTrustedOrgChanged(getTrustedOrganizationAt(index), oldAddr); + } + /** * @dev Adds a list of trusted organizations. */ @@ -299,7 +303,7 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I * Requirements: * - The weight is larger than 0. * - The consensus address is not added. - * - The govenor address is not added. + * - The governor address is not added. * - The bridge voter address is not added. * */ @@ -311,24 +315,20 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I if (_governorWeight[_v.governor] > 0) revert ErrGovernorAddressIsAlreadyAdded(_v.governor); - if (_bridgeVoterWeight[_v.bridgeVoter] > 0) revert ErrBridgeVoterIsAlreadyAdded(_v.bridgeVoter); - _consensusList.push(_v.consensusAddr); _consensusWeight[_v.consensusAddr] = _v.weight; _governorList.push(_v.governor); _governorWeight[_v.governor] = _v.weight; - _bridgeVoterList.push(_v.bridgeVoter); - _bridgeVoterWeight[_v.bridgeVoter] = _v.weight; - _addedBlock[_v.consensusAddr] = block.number; _totalWeight += _v.weight; } /** - * @dev Updates a trusted organization. + * @dev Updates info of an existing trusted org. + * Replace the governor address if they are different, set all weights to the new weight. * * Requirements: * - The weight is larger than 0. @@ -347,6 +347,7 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I _totalWeight -= _weight; _totalWeight += _v.weight; + // Replace governor address if (_governorList[_i] != _v.governor) { if (_governorWeight[_v.governor] != 0) revert ErrQueryForDupplicated(); @@ -354,16 +355,9 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I _governorList[_i] = _v.governor; } - if (_bridgeVoterList[_i] != _v.bridgeVoter) { - if (_bridgeVoterWeight[_v.bridgeVoter] != 0) revert ErrQueryForDupplicated(); - - delete _bridgeVoterWeight[_bridgeVoterList[_i]]; - _bridgeVoterList[_i] = _v.bridgeVoter; - } - + // Add new weight for both consensus and governor address _consensusWeight[_v.consensusAddr] = _v.weight; _governorWeight[_v.governor] = _v.weight; - _bridgeVoterWeight[_v.bridgeVoter] = _v.weight; return; } @@ -374,43 +368,42 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I } /** - * @dev Removes a trusted organization. + * @dev Removes a trusted organization by consensus address. * * Requirements: * - The consensus address is added. * */ - function _removeTrustedOrganization(address _addr) internal virtual { - uint256 _weight = _consensusWeight[_addr]; - if (_weight == 0) revert ErrConsensusAddressIsNotAdded(_addr); + function _removeTrustedOrganization(TConsensus addr) internal virtual { + uint256 weight = _consensusWeight[addr]; + if (weight == 0) revert ErrConsensusAddressIsNotAdded(addr); - uint256 _index; - uint256 _count = _consensusList.length; - for (uint256 _i = 0; _i < _count; ) { - if (_consensusList[_i] == _addr) { - _index = _i; - break; - } + uint256 index = _findTrustedOrgIndexByConsensus(addr); - unchecked { - ++_i; - } - } + _totalWeight -= weight; + _deleteConsensusInMappings(addr); - _totalWeight -= _weight; - - delete _addedBlock[_addr]; - delete _consensusWeight[_addr]; - _consensusList[_index] = _consensusList[_count - 1]; + uint256 count = _consensusList.length; + _consensusList[index] = _consensusList[count - 1]; _consensusList.pop(); - delete _governorWeight[_governorList[_index]]; - _governorList[_index] = _governorList[_count - 1]; + delete _governorWeight[_governorList[index]]; + _governorList[index] = _governorList[count - 1]; _governorList.pop(); + } - delete _bridgeVoterWeight[_bridgeVoterList[_index]]; - _bridgeVoterList[_index] = _bridgeVoterList[_count - 1]; - _bridgeVoterList.pop(); + function _findTrustedOrgIndexByConsensus(TConsensus addr) private view returns (uint256 index) { + uint256 count = _consensusList.length; + for (uint256 i = 0; i < count; i++) { + if (_consensusList[i] == addr) { + return i; + } + } + } + + function _deleteConsensusInMappings(TConsensus addr) private { + delete _addedBlock[addr]; + delete _consensusWeight[addr]; } /** @@ -445,10 +438,18 @@ contract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, I if (_v.weight == 0) revert ErrInvalidVoteWeight(msg.sig); address[] memory _addresses = new address[](3); - _addresses[0] = _v.consensusAddr; + _addresses[0] = TConsensus.unwrap(_v.consensusAddr); _addresses[1] = _v.governor; - _addresses[2] = _v.bridgeVoter; + _addresses[2] = _v.__deprecatedBridgeVoter; if (AddressArrayUtils.hasDuplicate(_addresses)) revert AddressArrayUtils.ErrDuplicated(msg.sig); } + + function __cid2css(address cid) internal view returns (TConsensus) { + return (IProfile(getContract(ContractType.PROFILE)).getId2Profile(cid)).consensus; + } + + function __cid2cssBatch(address[] memory cids) internal view returns (TConsensus[] memory) { + return IProfile(getContract(ContractType.PROFILE)).getManyId2Consensus(cids); + } } diff --git a/contracts/ronin/Maintenance.sol b/contracts/ronin/Maintenance.sol index 74aee802b..072f33ee3 100644 --- a/contracts/ronin/Maintenance.sol +++ b/contracts/ronin/Maintenance.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.9; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../interfaces/IMaintenance.sol"; +import "../interfaces/IProfile.sol"; import "../interfaces/validator/IRoninValidatorSet.sol"; import "../extensions/collections/HasContracts.sol"; import "../libraries/Math.sol"; @@ -13,21 +14,21 @@ import { ErrUnauthorized, RoleAccess } from "../utils/CommonErrors.sol"; contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Initializable { using Math for uint256; - /// @dev Mapping from consensus address => maintenance schedule. + /// @dev Mapping from candidate id => maintenance schedule. mapping(address => Schedule) internal _schedule; /// @dev The min duration to maintenance in blocks. - uint256 public minMaintenanceDurationInBlock; + uint256 internal _minMaintenanceDurationInBlock; /// @dev The max duration to maintenance in blocks. - uint256 public maxMaintenanceDurationInBlock; + uint256 internal _maxMaintenanceDurationInBlock; /// @dev The offset to the min block number that the schedule can start. - uint256 public minOffsetToStartSchedule; + uint256 internal _minOffsetToStartSchedule; /// @dev The offset to the max block number that the schedule can start. - uint256 public maxOffsetToStartSchedule; + uint256 internal _maxOffsetToStartSchedule; /// @dev The max number of scheduled maintenances. - uint256 public maxSchedule; + uint256 internal _maxSchedule; /// @dev The cooldown time to request new schedule. - uint256 public cooldownSecsToMaintain; + uint256 internal _cooldownSecsToMaintain; constructor() { _disableInitializers(); @@ -37,22 +38,22 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init * @dev Initializes the contract storage. */ function initialize( - address __validatorContract, - uint256 _minMaintenanceDurationInBlock, - uint256 _maxMaintenanceDurationInBlock, - uint256 _minOffsetToStartSchedule, - uint256 _maxOffsetToStartSchedule, - uint256 _maxSchedules, - uint256 _cooldownSecsToMaintain + address validatorContract, + uint256 minMaintenanceDurationInBlock_, + uint256 maxMaintenanceDurationInBlock_, + uint256 minOffsetToStartSchedule_, + uint256 maxOffsetToStartSchedule_, + uint256 maxSchedule_, + uint256 cooldownSecsToMaintain_ ) external initializer { - _setContract(ContractType.VALIDATOR, __validatorContract); + _setContract(ContractType.VALIDATOR, validatorContract); _setMaintenanceConfig( - _minMaintenanceDurationInBlock, - _maxMaintenanceDurationInBlock, - _minOffsetToStartSchedule, - _maxOffsetToStartSchedule, - _maxSchedules, - _cooldownSecsToMaintain + minMaintenanceDurationInBlock_, + maxMaintenanceDurationInBlock_, + minOffsetToStartSchedule_, + maxOffsetToStartSchedule_, + maxSchedule_, + cooldownSecsToMaintain_ ); } @@ -61,97 +62,162 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init delete ______deprecatedValidator; } + function initializeV3(address profileContract_) external reinitializer(3) { + _setContract(ContractType.PROFILE, profileContract_); + } + + /** + * @inheritdoc IMaintenance + */ + function minMaintenanceDurationInBlock() external view returns (uint256) { + return _minMaintenanceDurationInBlock; + } + + /** + * @inheritdoc IMaintenance + */ + function maxMaintenanceDurationInBlock() external view returns (uint256) { + return _maxMaintenanceDurationInBlock; + } + + /** + * @inheritdoc IMaintenance + */ + function minOffsetToStartSchedule() external view returns (uint256) { + return _minOffsetToStartSchedule; + } + + /** + * @inheritdoc IMaintenance + */ + function maxOffsetToStartSchedule() external view returns (uint256) { + return _maxOffsetToStartSchedule; + } + + /** + * @inheritdoc IMaintenance + */ + function maxSchedule() external view returns (uint256) { + return _maxSchedule; + } + + /** + * @inheritdoc IMaintenance + */ + function cooldownSecsToMaintain() external view returns (uint256) { + return _cooldownSecsToMaintain; + } + /** * @inheritdoc IMaintenance */ function setMaintenanceConfig( - uint256 _minMaintenanceDurationInBlock, - uint256 _maxMaintenanceDurationInBlock, - uint256 _minOffsetToStartSchedule, - uint256 _maxOffsetToStartSchedule, - uint256 _maxSchedules, - uint256 _cooldownSecsToMaintain + uint256 minMaintenanceDurationInBlock_, + uint256 maxMaintenanceDurationInBlock_, + uint256 minOffsetToStartSchedule_, + uint256 maxOffsetToStartSchedule_, + uint256 maxSchedule_, + uint256 cooldownSecsToMaintain_ ) external onlyAdmin { _setMaintenanceConfig( - _minMaintenanceDurationInBlock, - _maxMaintenanceDurationInBlock, - _minOffsetToStartSchedule, - _maxOffsetToStartSchedule, - _maxSchedules, - _cooldownSecsToMaintain + minMaintenanceDurationInBlock_, + maxMaintenanceDurationInBlock_, + minOffsetToStartSchedule_, + maxOffsetToStartSchedule_, + maxSchedule_, + cooldownSecsToMaintain_ ); } /** * @inheritdoc IMaintenance */ - function schedule(address _consensusAddr, uint256 _startedAtBlock, uint256 _endedAtBlock) external override { - IRoninValidatorSet _validator = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external override { + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + address candidateId = __css2cid(consensusAddr); - if (!_validator.isBlockProducer(_consensusAddr)) revert ErrUnauthorized(msg.sig, RoleAccess.BLOCK_PRODUCER); - if (!_validator.isCandidateAdmin(_consensusAddr, msg.sender)) + if (!validatorContract.isBlockProducer(consensusAddr)) revert ErrUnauthorized(msg.sig, RoleAccess.BLOCK_PRODUCER); + if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender)) revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN); - if (checkScheduled(_consensusAddr)) revert ErrAlreadyScheduled(); - if (!checkCooldownEnded(_consensusAddr)) revert ErrCooldownTimeNotYetEnded(); - if (totalSchedule() >= maxSchedule) revert ErrTotalOfSchedulesExceeded(); - if (!_startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule)) { + if (_checkScheduledById(candidateId)) revert ErrAlreadyScheduled(); + if (!_checkCooldownEndedById(candidateId)) revert ErrCooldownTimeNotYetEnded(); + if (totalSchedule() >= _maxSchedule) revert ErrTotalOfSchedulesExceeded(); + if (!startedAtBlock.inRange(block.number + _minOffsetToStartSchedule, block.number + _maxOffsetToStartSchedule)) { revert ErrStartBlockOutOfRange(); } - if (_startedAtBlock >= _endedAtBlock) revert ErrStartBlockOutOfRange(); + if (startedAtBlock >= endedAtBlock) revert ErrStartBlockOutOfRange(); - uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1; + uint256 maintenanceElapsed = endedAtBlock - startedAtBlock + 1; - if (!_maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock)) { + if (!maintenanceElapsed.inRange(_minMaintenanceDurationInBlock, _maxMaintenanceDurationInBlock)) { revert ErrInvalidMaintenanceDuration(); } - if (!_validator.epochEndingAt(_startedAtBlock - 1)) revert ErrStartBlockOutOfRange(); - if (!_validator.epochEndingAt(_endedAtBlock)) revert ErrEndBlockOutOfRange(); + if (!validatorContract.epochEndingAt(startedAtBlock - 1)) revert ErrStartBlockOutOfRange(); + if (!validatorContract.epochEndingAt(endedAtBlock)) revert ErrEndBlockOutOfRange(); - Schedule storage _sSchedule = _schedule[_consensusAddr]; - _sSchedule.from = _startedAtBlock; - _sSchedule.to = _endedAtBlock; + Schedule storage _sSchedule = _schedule[candidateId]; + _sSchedule.from = startedAtBlock; + _sSchedule.to = endedAtBlock; _sSchedule.lastUpdatedBlock = block.number; _sSchedule.requestTimestamp = block.timestamp; - emit MaintenanceScheduled(_consensusAddr, _sSchedule); + emit MaintenanceScheduled(consensusAddr, _sSchedule); } /** * @inheritdoc IMaintenance */ - function cancelSchedule(address _consensusAddr) external override { - if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(_consensusAddr, msg.sender)) { + function cancelSchedule(TConsensus consensusAddr) external override { + if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(consensusAddr, msg.sender)) { revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN); } - if (!checkScheduled(_consensusAddr)) revert ErrUnexistedSchedule(); - if (checkMaintained(_consensusAddr, block.number)) revert ErrAlreadyOnMaintenance(); - Schedule storage _sSchedule = _schedule[_consensusAddr]; + address candidateId = __css2cid(consensusAddr); + + if (!_checkScheduledById(candidateId)) revert ErrUnexistedSchedule(); + if (_checkMaintainedById(candidateId, block.number)) revert ErrAlreadyOnMaintenance(); + + Schedule storage _sSchedule = _schedule[candidateId]; delete _sSchedule.from; delete _sSchedule.to; _sSchedule.lastUpdatedBlock = block.number; - emit MaintenanceScheduleCancelled(_consensusAddr); + emit MaintenanceScheduleCancelled(consensusAddr); } /** * @inheritdoc IMaintenance */ - function getSchedule(address _consensusAddr) external view override returns (Schedule memory) { - return _schedule[_consensusAddr]; + function getSchedule(TConsensus consensusAddr) external view override returns (Schedule memory) { + return _schedule[__css2cid(consensusAddr)]; } /** * @inheritdoc IMaintenance */ function checkManyMaintained( - address[] calldata _addrList, - uint256 _block - ) external view override returns (bool[] memory _resList) { - _resList = new bool[](_addrList.length); - for (uint _i = 0; _i < _addrList.length; ) { - _resList[_i] = checkMaintained(_addrList[_i], _block); + TConsensus[] calldata addrList, + uint256 atBlock + ) external view override returns (bool[] memory) { + address[] memory idList = __css2cidBatch(addrList); + return _checkManyMaintainedById(idList, atBlock); + } + + function checkManyMaintainedById( + address[] calldata idList, + uint256 atBlock + ) external view override returns (bool[] memory) { + return _checkManyMaintainedById(idList, atBlock); + } + + function _checkManyMaintainedById( + address[] memory idList, + uint256 atBlock + ) internal view returns (bool[] memory resList) { + resList = new bool[](idList.length); + for (uint i = 0; i < idList.length; ) { + resList[i] = _checkMaintainedById(idList[i], atBlock); unchecked { - ++_i; + ++i; } } } @@ -160,16 +226,33 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init * @inheritdoc IMaintenance */ function checkManyMaintainedInBlockRange( - address[] calldata _addrList, - uint256 _fromBlock, - uint256 _toBlock - ) external view override returns (bool[] memory _resList) { - _resList = new bool[](_addrList.length); - for (uint _i = 0; _i < _addrList.length; ) { - _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock); + TConsensus[] calldata addrList, + uint256 fromBlock, + uint256 toBlock + ) external view override returns (bool[] memory) { + address[] memory idList = __css2cidBatch(addrList); + return _checkManyMaintainedInBlockRangeById(idList, fromBlock, toBlock); + } + + function checkManyMaintainedInBlockRangeById( + address[] calldata idList, + uint256 fromBlock, + uint256 toBlock + ) external view override returns (bool[] memory) { + return _checkManyMaintainedInBlockRangeById(idList, fromBlock, toBlock); + } + + function _checkManyMaintainedInBlockRangeById( + address[] memory idList, + uint256 fromBlock, + uint256 toBlock + ) internal view returns (bool[] memory resList) { + resList = new bool[](idList.length); + for (uint i = 0; i < idList.length; ) { + resList[i] = _maintainingInBlockRange(idList[i], fromBlock, toBlock); unchecked { - ++_i; + ++i; } } } @@ -177,12 +260,12 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init /** * @inheritdoc IMaintenance */ - function totalSchedule() public view override returns (uint256 _count) { - address[] memory _validators = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).getValidators(); + function totalSchedule() public view override returns (uint256 count) { + address[] memory validatorIds = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).getValidators(); unchecked { - for (uint _i = 0; _i < _validators.length; _i++) { - if (checkScheduled(_validators[_i])) { - _count++; + for (uint i = 0; i < validatorIds.length; i++) { + if (_checkScheduledById(validatorIds[i])) { + count++; } } } @@ -191,34 +274,50 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init /** * @inheritdoc IMaintenance */ - function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) { - Schedule storage _s = _schedule[_consensusAddr]; - return _s.from <= _block && _block <= _s.to; + function checkMaintained(TConsensus consensusAddr, uint256 atBlock) external view override returns (bool) { + return _checkMaintainedById(__css2cid(consensusAddr), atBlock); + } + + function checkMaintainedById(address candidateId, uint256 atBlock) external view override returns (bool) { + return _checkMaintainedById(candidateId, atBlock); + } + + function _checkMaintainedById(address candidateId, uint256 atBlock) internal view returns (bool) { + Schedule storage _s = _schedule[candidateId]; + return _s.from <= atBlock && atBlock <= _s.to; } /** * @inheritdoc IMaintenance */ function checkMaintainedInBlockRange( - address _consensusAddr, - uint256 _fromBlock, - uint256 _toBlock + TConsensus consensusAddr, + uint256 fromBlock, + uint256 toBlock ) public view override returns (bool) { - return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock); + return _maintainingInBlockRange(__css2cid(consensusAddr), fromBlock, toBlock); } /** * @inheritdoc IMaintenance */ - function checkScheduled(address _consensusAddr) public view override returns (bool) { - return block.number <= _schedule[_consensusAddr].to; + function checkScheduled(TConsensus consensusAddr) external view override returns (bool) { + return _checkScheduledById(__css2cid(consensusAddr)); + } + + function _checkScheduledById(address candidateId) internal view returns (bool) { + return block.number <= _schedule[candidateId].to; } /** * @inheritdoc IMaintenance */ - function checkCooldownEnded(address _consensusAddr) public view override returns (bool) { - return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain; + function checkCooldownEnded(TConsensus consensusAddr) external view override returns (bool) { + return _checkCooldownEndedById(__css2cid(consensusAddr)); + } + + function _checkCooldownEndedById(address candidateId) internal view returns (bool) { + return block.timestamp > _schedule[candidateId].requestTimestamp + _cooldownSecsToMaintain; } /** @@ -231,29 +330,29 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init * */ function _setMaintenanceConfig( - uint256 _minMaintenanceDurationInBlock, - uint256 _maxMaintenanceDurationInBlock, - uint256 _minOffsetToStartSchedule, - uint256 _maxOffsetToStartSchedule, - uint256 _maxSchedule, - uint256 _cooldownSecsToMaintain + uint256 minMaintenanceDurationInBlock_, + uint256 maxMaintenanceDurationInBlock_, + uint256 minOffsetToStartSchedule_, + uint256 maxOffsetToStartSchedule_, + uint256 maxSchedule_, + uint256 cooldownSecsToMaintain_ ) internal { - if (_minMaintenanceDurationInBlock >= _maxMaintenanceDurationInBlock) revert ErrInvalidMaintenanceDurationConfig(); - if (_minOffsetToStartSchedule >= _maxOffsetToStartSchedule) revert ErrInvalidOffsetToStartScheduleConfigs(); - - minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock; - maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock; - minOffsetToStartSchedule = _minOffsetToStartSchedule; - maxOffsetToStartSchedule = _maxOffsetToStartSchedule; - maxSchedule = _maxSchedule; - cooldownSecsToMaintain = _cooldownSecsToMaintain; + if (minMaintenanceDurationInBlock_ >= maxMaintenanceDurationInBlock_) revert ErrInvalidMaintenanceDurationConfig(); + if (minOffsetToStartSchedule_ >= maxOffsetToStartSchedule_) revert ErrInvalidOffsetToStartScheduleConfigs(); + + _minMaintenanceDurationInBlock = minMaintenanceDurationInBlock_; + _maxMaintenanceDurationInBlock = maxMaintenanceDurationInBlock_; + _minOffsetToStartSchedule = minOffsetToStartSchedule_; + _maxOffsetToStartSchedule = maxOffsetToStartSchedule_; + _maxSchedule = maxSchedule_; + _cooldownSecsToMaintain = cooldownSecsToMaintain_; emit MaintenanceConfigUpdated( - _minMaintenanceDurationInBlock, - _maxMaintenanceDurationInBlock, - _minOffsetToStartSchedule, - _maxOffsetToStartSchedule, - _maxSchedule, - _cooldownSecsToMaintain + minMaintenanceDurationInBlock_, + maxMaintenanceDurationInBlock_, + minOffsetToStartSchedule_, + maxOffsetToStartSchedule_, + maxSchedule_, + cooldownSecsToMaintain_ ); } @@ -263,11 +362,19 @@ contract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Init * Note: This method should be called at the end of the period. */ function _maintainingInBlockRange( - address _consensusAddr, - uint256 _fromBlock, - uint256 _toBlock + address candidateId, + uint256 fromBlock, + uint256 toBlock ) private view returns (bool) { - Schedule storage _s = _schedule[_consensusAddr]; - return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to); + Schedule storage s = _schedule[candidateId]; + return Math.twoRangeOverlap(fromBlock, toBlock, s.from, s.to); + } + + function __css2cid(TConsensus consensusAddr) internal view returns (address) { + return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr); + } + + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view returns (address[] memory) { + return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs); } } diff --git a/contracts/ronin/RoninGovernanceAdmin.sol b/contracts/ronin/RoninGovernanceAdmin.sol index b5d39b909..327a0fa62 100644 --- a/contracts/ronin/RoninGovernanceAdmin.sol +++ b/contracts/ronin/RoninGovernanceAdmin.sol @@ -168,16 +168,16 @@ contract RoninGovernanceAdmin is * @inheritdoc IRoninGovernanceAdmin */ function createEmergencyExitPoll( - address _consensusAddr, - address _recipientAfterUnlockedFund, - uint256 _requestedAt, - uint256 _expiredAt + address validatorId, + address recipientAfterUnlockedFund, + uint256 requestedAt, + uint256 expiredAt ) external onlyContract(ContractType.VALIDATOR) { - bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt); - IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash]; + bytes32 ballotHash = EmergencyExitBallot.hash(validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt); + IsolatedGovernance.Vote storage _v = _emergencyExitPoll[ballotHash]; _v.createdAt = block.timestamp; - _v.expiredAt = _expiredAt; - emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt); + _v.expiredAt = expiredAt; + emit EmergencyExitPollCreated(ballotHash, validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt); } /** @@ -190,15 +190,15 @@ contract RoninGovernanceAdmin is * */ function voteEmergencyExit( - bytes32 _voteHash, - address _consensusAddr, - address _recipientAfterUnlockedFund, - uint256 _requestedAt, - uint256 _expiredAt + bytes32 voteHash, + address validatorId, + address recipientAfterUnlockedFund, + uint256 requestedAt, + uint256 expiredAt ) external onlyGovernor { address _voter = msg.sender; - bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt); - if (_voteHash != _hash) revert ErrInvalidVoteHash(); + bytes32 _hash = EmergencyExitBallot.hash(validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt); + if (voteHash != _hash) revert ErrInvalidVoteHash(); IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash]; if (_v.createdAt == 0) revert ErrQueryForNonExistentVote(); @@ -210,7 +210,7 @@ contract RoninGovernanceAdmin is address[] memory _voters = _v.filterByHash(_hash); VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeight(_voters), _hash); if (_stt == VoteStatus.Approved) { - _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund); + _execReleaseLockedFundForEmergencyExitRequest(validatorId, recipientAfterUnlockedFund); emit EmergencyExitPollApproved(_hash); _v.status = VoteStatus.Executed; } else if (_stt == VoteStatus.Expired) { @@ -237,13 +237,13 @@ contract RoninGovernanceAdmin is /** * @dev Returns the total weight of a list address of governors. */ - function _sumGovernorWeight(address[] memory _governors) internal view virtual returns (uint256) { + function _sumGovernorWeight(address[] memory governors) internal view virtual returns (uint256) { bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeight.selector; (bool _success, bytes memory _returndata) = getContract(ContractType.RONIN_TRUSTED_ORGANIZATION).staticcall( abi.encodeWithSelector( // TransparentUpgradeableProxyV2.functionDelegateCall.selector, 0x4bb5274a, - abi.encodeWithSelector(_selector, _governors) + abi.encodeWithSelector(_selector, governors) ) ); @@ -252,18 +252,18 @@ contract RoninGovernanceAdmin is } /** - * @dev Trigger function from validator contract to unlock fund for emeregency exit request. + * @dev Trigger function from validator contract to unlock fund for emergency exit request. */ function _execReleaseLockedFundForEmergencyExitRequest( - address _consensusAddr, - address _recipientAfterUnlockedFund + address validatorId, + address recipientAfterUnlockedFund ) internal virtual { bytes4 _selector = IEmergencyExit.execReleaseLockedFundForEmergencyExitRequest.selector; (bool _success, bytes memory _returndata) = getContract(ContractType.VALIDATOR).call( abi.encodeWithSelector( // TransparentUpgradeableProxyV2.functionDelegateCall.selector, 0x4bb5274a, - abi.encodeWithSelector(_selector, _consensusAddr, _recipientAfterUnlockedFund) + abi.encodeWithSelector(_selector, validatorId, recipientAfterUnlockedFund) ) ); _success.handleRevert(_selector, _returndata); diff --git a/contracts/ronin/StakingVesting.sol b/contracts/ronin/StakingVesting.sol index 92845e263..ed5948918 100644 --- a/contracts/ronin/StakingVesting.sol +++ b/contracts/ronin/StakingVesting.sol @@ -23,7 +23,7 @@ contract StakingVesting is /// @dev The block bonus for the bridge operator whenever a new block is mined. uint256 internal _bridgeOperatorBonusPerBlock; /// @dev The last block number that the staking vesting sent. - uint256 public lastBlockSendingBonus; + uint256 internal _lastBlockSendingBonus; /// @dev The percentage that extracted from reward of block producer for fast finality. uint256 internal _fastFinalityRewardPercentage; @@ -35,13 +35,13 @@ contract StakingVesting is * @dev Initializes the contract storage. */ function initialize( - address __validatorContract, - uint256 __blockProducerBonusPerBlock, - uint256 __bridgeOperatorBonusPerBlock + address validatorContract, + uint256 blockProducerBonusPerBlock, + uint256 bridgeOperatorBonusPerBlock ) external payable initializer { - _setContract(ContractType.VALIDATOR, __validatorContract); - _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock); - _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock); + _setContract(ContractType.VALIDATOR, validatorContract); + _setBlockProducerBonusPerBlock(blockProducerBonusPerBlock); + _setBridgeOperatorBonusPerBlock(bridgeOperatorBonusPerBlock); } function initializeV2() external reinitializer(2) { @@ -72,6 +72,13 @@ contract StakingVesting is return _bridgeOperatorBonusPerBlock; } + /** + * @inheritdoc IStakingVesting + */ + function lastBlockSendingBonus() external view returns (uint256) { + return _lastBlockSendingBonus; + } + /** * @inheritdoc IStakingVesting */ @@ -91,9 +98,9 @@ contract StakingVesting is onlyContract(ContractType.VALIDATOR) returns (bool success, uint256 blockProducerBonus, uint256 bridgeOperatorBonus, uint256 fastFinalityRewardPercent) { - if (block.number <= lastBlockSendingBonus) revert ErrBonusAlreadySent(); + if (block.number <= _lastBlockSendingBonus) revert ErrBonusAlreadySent(); - lastBlockSendingBonus = block.number; + _lastBlockSendingBonus = block.number; blockProducerBonus = forBlockProducer ? blockProducerBlockBonus(block.number) : 0; bridgeOperatorBonus = forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0; @@ -124,15 +131,15 @@ contract StakingVesting is /** * @inheritdoc IStakingVesting */ - function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin { - _setBlockProducerBonusPerBlock(_amount); + function setBlockProducerBonusPerBlock(uint256 amount) external override onlyAdmin { + _setBlockProducerBonusPerBlock(amount); } /** * @inheritdoc IStakingVesting */ - function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin { - _setBridgeOperatorBonusPerBlock(_amount); + function setBridgeOperatorBonusPerBlock(uint256 amount) external override onlyAdmin { + _setBridgeOperatorBonusPerBlock(amount); } /** @@ -149,9 +156,9 @@ contract StakingVesting is * Emits the event `BlockProducerBonusPerBlockUpdated`. * */ - function _setBlockProducerBonusPerBlock(uint256 _amount) internal { - _blockProducerBonusPerBlock = _amount; - emit BlockProducerBonusPerBlockUpdated(_amount); + function _setBlockProducerBonusPerBlock(uint256 amount) internal { + _blockProducerBonusPerBlock = amount; + emit BlockProducerBonusPerBlockUpdated(amount); } /** @@ -160,9 +167,9 @@ contract StakingVesting is * Emits the event `BridgeOperatorBonusPerBlockUpdated`. * */ - function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal { - _bridgeOperatorBonusPerBlock = _amount; - emit BridgeOperatorBonusPerBlockUpdated(_amount); + function _setBridgeOperatorBonusPerBlock(uint256 amount) internal { + _bridgeOperatorBonusPerBlock = amount; + emit BridgeOperatorBonusPerBlockUpdated(amount); } /** diff --git a/contracts/ronin/VaultForwarder.sol b/contracts/ronin/VaultForwarder.sol index f8a5333de..fea1598e3 100644 --- a/contracts/ronin/VaultForwarder.sol +++ b/contracts/ronin/VaultForwarder.sol @@ -14,9 +14,9 @@ import "../extensions/RONTransferHelper.sol"; */ contract VaultForwarder is Forwarder, RONTransferHelper { /// @dev Emitted when the admin withdraws all RON from the forwarder contract. - event ForwarderRONWithdrawn(address indexed _recipient, uint256 _value); + event ForwarderRONWithdrawn(address indexed recipient, uint256 value); - constructor(address[] memory _targets, address _admin, address _mod) Forwarder(_targets, _admin, _mod) {} + constructor(address[] memory targets, address admin, address mod) Forwarder(targets, admin, mod) {} /** * @dev Withdraws all balance from the transfer to the admin. @@ -25,8 +25,8 @@ contract VaultForwarder is Forwarder, RONTransferHelper { * - Only the admin can call this method. */ function withdrawAll() external onlyRole(DEFAULT_ADMIN_ROLE) { - uint256 _value = address(this).balance; - emit ForwarderRONWithdrawn(msg.sender, _value); - _transferRON(payable(msg.sender), _value); + uint256 value = address(this).balance; + emit ForwarderRONWithdrawn(msg.sender, value); + _transferRON(payable(msg.sender), value); } } diff --git a/contracts/ronin/profile/Profile.sol b/contracts/ronin/profile/Profile.sol index 4d74bcd54..761ce1d04 100644 --- a/contracts/ronin/profile/Profile.sol +++ b/contracts/ronin/profile/Profile.sol @@ -3,14 +3,16 @@ import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../../interfaces/validator/ICandidateManager.sol"; import "../../interfaces/validator/IRoninValidatorSet.sol"; +import "../../interfaces/IRoninTrustedOrganization.sol"; +import "../../interfaces/staking/IStaking.sol"; import "../../interfaces/IProfile.sol"; +import "./ProfileXComponents.sol"; import { ErrUnauthorized, RoleAccess } from "../../utils/CommonErrors.sol"; import { ContractType } from "../../utils/ContractType.sol"; -import "./ProfileHandler.sol"; pragma solidity ^0.8.9; -contract Profile is IProfile, ProfileHandler, Initializable { +contract Profile is IProfile, ProfileXComponents, Initializable { constructor() { _disableInitializers(); } @@ -19,49 +21,28 @@ contract Profile is IProfile, ProfileHandler, Initializable { _setContract(ContractType.VALIDATOR, validatorContract); } - function migrateMainnetV2() external { - require(block.chainid == 2020, "mismatch chainID"); - require(msg.sender == 0x4d58Ea7231c394d5804e8B06B1365915f906E27F, "not mainnet deployer"); - - address[29] memory consensusList = [ - 0x52C0dcd83aa1999BA6c3b0324C8299E30207373C, - 0xf41Af21F0A800dc4d86efB14ad46cfb9884FDf38, - 0xE07D7e56588a6FD860c5073c70a099658C060F3D, - 0x52349003240770727900b06a3B3a90f5c0219ADe, - 0x2bdDcaAE1C6cCd53E436179B3fc07307ee6f3eF8, - 0xeC702628F44C31aCc56C3A59555be47e1f16eB1e, - 0xbD4bf317Da1928CC2f9f4DA9006401f3944A0Ab5, - 0xd11D9842baBd5209b9B1155e46f5878c989125b7, - 0x61089875fF9e506ae78C7FE9f7c388416520E386, - 0xD7fEf73d95ccEdb26483fd3C6C48393e50708159, - 0x47cfcb64f8EA44d6Ea7FAB32f13EFa2f8E65Eec1, - 0x8Eec4F1c0878F73E8e09C1be78aC1465Cc16544D, - 0x9B959D27840a31988410Ee69991BCF0110D61F02, - 0xEE11d2016e9f2faE606b2F12986811F4abbe6215, - 0xca54a1700e0403Dcb531f8dB4aE3847758b90B01, - 0x4E7EA047EC7E95c7a02CB117128B94CCDd8356bf, - 0x6E46924371d0e910769aaBE0d867590deAC20684, - 0xae53daAC1BF3c4633d4921B8C3F8d579e757F5Bc, - 0x05ad3Ded6fcc510324Af8e2631717af6dA5C8B5B, - 0x32D619Dc6188409CebbC52f921Ab306F07DB085b, - 0x210744C64Eea863Cf0f972e5AEBC683b98fB1984, - 0xedCafC4Ad8097c2012980A2a7087d74B86bDDAf9, - 0xFc3e31519B551bd594235dd0eF014375a87C4e21, - 0x6aaABf51C5F6D2D93212Cf7DAD73D67AFa0148d0, - 0x22C23429e46e7944D2918F2B368b799b11C417C1, - 0x03A7B98C226225e330d11D1B9177891391Fa4f80, - 0x20238eB5643d4D7b7Ab3C30f3bf7B8E2B85cA1e7, - 0x07d28F88D677C4056EA6722aa35d92903b2a63da, - 0x262B9fcfe8CFA900aF4D1f5c20396E969B9655DD - ]; - - CandidateProfile storage _profile; - for (uint i; i < consensusList.length; i++) { - _profile = _id2Profile[consensusList[i]]; - _profile.id = consensusList[i]; + function initializeV2(address stakingContract, address trustedOrgContract) external reinitializer(2) { + _setContract(ContractType.STAKING, stakingContract); + _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, trustedOrgContract); + + address[] memory validatorCandidates = IRoninValidatorSet(getContract(ContractType.VALIDATOR)) + .getValidatorCandidates(); + TConsensus[] memory consensuses; + assembly ("memory-safe") { + consensuses := validatorCandidates + } + for (uint256 i; i < validatorCandidates.length; ++i) { + _consensus2Id[consensuses[i]] = validatorCandidates[i]; } + + __migrationRenouncedCandidates(); } + /** + * @dev Add addresses of renounced candidates into registry. Only called during {initializeV2}F. + */ + function __migrationRenouncedCandidates() internal virtual {} + /** * @inheritdoc IProfile */ @@ -69,6 +50,37 @@ contract Profile is IProfile, ProfileHandler, Initializable { return _id2Profile[id]; } + /** + * @inheritdoc IProfile + */ + function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList) { + consensusList = new TConsensus[](idList.length); + unchecked { + for (uint i; i < idList.length; ++i) { + consensusList[i] = _id2Profile[idList[i]].consensus; + } + } + } + + /** + * @inheritdoc IProfile + */ + function getConsensus2Id(TConsensus consensus) external view returns (address id) { + id = _consensus2Id[consensus]; + } + + /** + * @inheritdoc IProfile + */ + function getManyConsensus2Id(TConsensus[] calldata consensusList) external view returns (address[] memory idList) { + idList = new address[](consensusList.length); + unchecked { + for (uint i; i < consensusList.length; ++i) { + idList[i] = _consensus2Id[consensusList[i]]; + } + } + } + /** * @inheritdoc IProfile */ @@ -80,19 +92,94 @@ contract Profile is IProfile, ProfileHandler, Initializable { /** * @inheritdoc IProfile + * + * @dev Side-effects on other contracts: + * - Update Staking contract: + * + [x] Update (id => PoolDetail) mapping in {BaseStaking.sol}. + * + [x] Update `_adminOfActivePoolMapping` in {BaseStaking.sol}. + * - Update Validator contract: + * + [x] Update (id => ValidatorCandidate) mapping */ - function registerProfile(CandidateProfile memory profile) external { - if (profile.id != profile.consensus) revert ErrIdAndConsensusDiffer(); + function requestChangeAdminAddress(address id, address newAdminAddr) external { + CandidateProfile storage _profile = _getId2ProfileHelper(id); + _requireCandidateAdmin(_profile); + _requireNonZeroAndNonDuplicated(RoleAccess.ADMIN, newAdminAddr); + _setAdmin(_profile, newAdminAddr); - CandidateProfile storage _profile = _id2Profile[profile.id]; - if (_profile.id != address(0)) revert ErrExistentProfile(); - if ( - msg.sender != profile.admin || - !IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(profile.consensus, profile.admin) - ) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN); - _checkDuplicatedInRegistry(profile); + IStaking stakingContract = IStaking(getContract(ContractType.STAKING)); + stakingContract.execChangeAdminAddress(id, newAdminAddr); - _addNewProfile(_profile, profile); + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + validatorContract.execChangeAdminAddress(id, newAdminAddr); + + emit ProfileAddressChanged(id, RoleAccess.ADMIN); + } + + /** + * @inheritdoc IProfile + * + * @dev Side-effects on other contracts: + * - Update in Staking contract for Consensus address mapping: + * + [x] Keep the same previous pool address. + * - Update in Validator contract for: + * + [x] Consensus Address mapping + * + [x] Bridge Address mapping + * + [x] Jail mapping + * + [x] Pending reward mapping + * + [x] Schedule mapping + * - Update in Slashing contract for: + * + [x] Handling slash indicator + * + [x] Handling slash fast finality + * + [x] Handling slash double sign + * - Update in Proposal contract for: + * + [-] Preserve the consensus address and recipient target of locked amount of emergency exit + * - Update Trusted Org contracts: + * + [x] Remove and delete weight of the old consensus + * + [x] Replace and add weight for the new consensus + */ + function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external { + CandidateProfile storage _profile = _getId2ProfileHelper(id); + _requireCandidateAdmin(_profile); + _requireNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(newConsensusAddr)); + + TConsensus oldConsensusAddr = _profile.consensus; + _setConsensus(_profile, newConsensusAddr); + + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + validatorContract.execChangeConsensusAddress(id, newConsensusAddr); + + IRoninTrustedOrganization trustedOrgContract = IRoninTrustedOrganization( + getContract(ContractType.RONIN_TRUSTED_ORGANIZATION) + ); + trustedOrgContract.execChangeConsensusAddressForTrustedOrg({ + oldConsensusAddr: oldConsensusAddr, + newConsensusAddr: newConsensusAddr + }); + + emit ProfileAddressChanged(id, RoleAccess.CONSENSUS); + } + + /** + * @inheritdoc IProfile + * + * @dev Side-effects on other contracts: + * - Update Validator contract: + * + [x] Update (id => ValidatorCandidate) mapping + * - Update governance admin: + * + [-] Update recipient in the EmergencyExitBallot to the newTreasury. + * Cannot impl since we cannot cancel the previous the ballot and + * create a new ballot on behalf of the validator contract. + */ + function requestChangeTreasuryAddr(address id, address payable newTreasury) external { + CandidateProfile storage _profile = _getId2ProfileHelper(id); + _requireCandidateAdmin(_profile); + _requireNonZeroAndNonDuplicated(RoleAccess.TREASURY, newTreasury); + _setTreasury(_profile, newTreasury); + + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + validatorContract.execChangeTreasuryAddress(id, newTreasury); + + emit ProfileAddressChanged(id, RoleAccess.TREASURY); } /** @@ -100,10 +187,17 @@ contract Profile is IProfile, ProfileHandler, Initializable { */ function changePubkey(address id, bytes memory pubkey) external { CandidateProfile storage _profile = _getId2ProfileHelper(id); - if (msg.sender != _profile.admin) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN); - _checkNonDuplicatedPubkey(pubkey); + _requireCandidateAdmin(_profile); + _requireNonDuplicatedPubkey(pubkey); _setPubkey(_profile, pubkey); emit PubkeyChanged(id, pubkey); } + + function _requireCandidateAdmin(CandidateProfile storage sProfile) internal view { + if ( + msg.sender != sProfile.admin || + !IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(sProfile.consensus, msg.sender) + ) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN); + } } diff --git a/contracts/ronin/profile/ProfileHandler.sol b/contracts/ronin/profile/ProfileHandler.sol index e21baff17..5dc7a3e12 100644 --- a/contracts/ronin/profile/ProfileHandler.sol +++ b/contracts/ronin/profile/ProfileHandler.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.9; +import "../../udvts/Types.sol"; import "../../utils/RoleAccess.sol"; import { ProfileStorage } from "./ProfileStorage.sol"; @@ -9,28 +10,36 @@ abstract contract ProfileHandler is ProfileStorage { /** * @dev Checks each element in the new profile and reverts if there is duplication with any existing profile. */ - function _checkDuplicatedInRegistry(CandidateProfile memory profile) internal view { - _checkNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, profile.consensus); - _checkNonZeroAndNonDuplicated(RoleAccess.CANDIDATE_ADMIN, profile.admin); - _checkNonZeroAndNonDuplicated(RoleAccess.TREASURY, profile.treasury); - _checkNonDuplicated(RoleAccess.TREASURY, profile.governor); - _checkNonDuplicatedPubkey(profile.pubkey); + function _requireNonDuplicatedInRegistry(CandidateProfile memory profile) internal view { + _requireNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(profile.consensus)); + _requireNonZeroAndNonDuplicated(RoleAccess.CANDIDATE_ADMIN, profile.admin); + _requireNonZeroAndNonDuplicated(RoleAccess.TREASURY, profile.treasury); + _requireNonDuplicated(RoleAccess.TREASURY, profile.__reservedGovernor); + _requireNonDuplicatedPubkey(profile.pubkey); } - function _checkNonZeroAndNonDuplicated(RoleAccess addressType, address addr) internal view { + function _requireNonZeroAndNonDuplicated(RoleAccess addressType, address addr) internal view { if (addr == address(0)) revert ErrZeroAddress(addressType); - _checkNonDuplicated(addressType, addr); + _requireNonDuplicated(addressType, addr); } - function _checkNonDuplicated(RoleAccess addressType, address addr) internal view { - if (_registry[uint256(uint160(addr))]) { + function _requireNonDuplicated(RoleAccess addressType, address addr) internal view { + if (_checkNonDuplicatedAddr(addr)) { revert ErrDuplicatedInfo(addressType, uint256(uint160(addr))); } } - function _checkNonDuplicatedPubkey(bytes memory pubkey) internal view { - if (_registry[_hashPubkey(pubkey)]) { + function _checkNonDuplicatedAddr(address addr) internal view returns (bool) { + return _registry[uint256(uint160(addr))]; + } + + function _requireNonDuplicatedPubkey(bytes memory pubkey) internal view { + if (_checkNonDuplicatedPubkey(pubkey)) { revert ErrDuplicatedPubkey(pubkey); } } + + function _checkNonDuplicatedPubkey(bytes memory pubkey) internal view returns (bool) { + return _registry[_hashPubkey(pubkey)]; + } } diff --git a/contracts/ronin/profile/ProfileStorage.sol b/contracts/ronin/profile/ProfileStorage.sol index 98c033123..6eb8e69cc 100644 --- a/contracts/ronin/profile/ProfileStorage.sol +++ b/contracts/ronin/profile/ProfileStorage.sol @@ -2,20 +2,26 @@ pragma solidity ^0.8.9; +import "../../udvts/Types.sol"; import "../../extensions/collections/HasContracts.sol"; import { IProfile } from "../../interfaces/IProfile.sol"; abstract contract ProfileStorage is IProfile, HasContracts { /// @dev Mapping from id address => candidate profile. mapping(address => CandidateProfile) internal _id2Profile; + /** * @dev Mapping from any address or keccak256(pubkey) => whether it is already registered. * This registry can only be toggled to `true` and NOT vice versa. All registered values * cannot be reused. */ mapping(uint256 => bool) internal _registry; + + /// @dev Mapping from consensus address => id address. + mapping(TConsensus => address) internal _consensus2Id; + /// @dev Upgradeable gap. - bytes32[49] __gap; + bytes32[48] __gap; /** * @dev Add a profile from memory to storage. @@ -26,15 +32,18 @@ abstract contract ProfileStorage is IProfile, HasContracts { _setConsensus(_profile, newProfile.consensus); _setAdmin(_profile, newProfile.admin); _setTreasury(_profile, newProfile.treasury); - _setGovernor(_profile, newProfile.governor); + _setGovernor(_profile, newProfile.__reservedGovernor); _setPubkey(_profile, newProfile.pubkey); emit ProfileAdded(newProfile.id); } - function _setConsensus(CandidateProfile storage _profile, address consensus) internal { + function _setConsensus(CandidateProfile storage _profile, TConsensus consensus) internal { + delete _consensus2Id[_profile.consensus]; + _consensus2Id[consensus] = _profile.id; + _profile.consensus = consensus; - _registry[uint256(uint160(consensus))] = true; + _registry[uint256(uint160(TConsensus.unwrap(consensus)))] = true; } function _setAdmin(CandidateProfile storage _profile, address admin) internal { @@ -51,7 +60,7 @@ abstract contract ProfileStorage is IProfile, HasContracts { * @dev Allow to registry a profile without governor address since not all validators are governing validators. */ function _setGovernor(CandidateProfile storage _profile, address governor) internal { - _profile.governor = governor; + _profile.__reservedGovernor = governor; if (governor != address(0)) { _registry[uint256(uint160(governor))] = true; } diff --git a/contracts/ronin/profile/ProfileXComponents.sol b/contracts/ronin/profile/ProfileXComponents.sol new file mode 100644 index 000000000..fe1878782 --- /dev/null +++ b/contracts/ronin/profile/ProfileXComponents.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: MIT + +import "../../interfaces/IProfile.sol"; +import { ContractType } from "../../utils/ContractType.sol"; +import "./ProfileHandler.sol"; + +pragma solidity ^0.8.9; + +abstract contract ProfileXComponents is IProfile, ProfileHandler { + /** + * @inheritdoc IProfile + */ + function execApplyValidatorCandidate( + address admin, + address id, + address treasury, + bytes calldata pubkey + ) external override onlyContract(ContractType.STAKING) { + // Check existent profile + CandidateProfile storage _profile = _id2Profile[id]; + if (_profile.id != address(0)) revert ErrExistentProfile(); + + // Validate the info and add the profile + CandidateProfile memory profile = CandidateProfile({ + id: id, + consensus: TConsensus.wrap(id), + admin: admin, + treasury: payable(treasury), + __reservedGovernor: address(0), + pubkey: pubkey + }); + _requireNonDuplicatedInRegistry(profile); + _addNewProfile(_profile, profile); + } +} diff --git a/contracts/ronin/profile/Profile_Mainnet.sol b/contracts/ronin/profile/Profile_Mainnet.sol new file mode 100644 index 000000000..94721d8b4 --- /dev/null +++ b/contracts/ronin/profile/Profile_Mainnet.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: MIT + +import "./Profile.sol"; + +pragma solidity ^0.8.9; + +contract Profile_Mainnet is Profile { + function __migrationRenouncedCandidates() internal override onlyInitializing { + if (block.chainid != 2020) return; + + CandidateProfile storage _profile; + + address[4] memory lConsensus = __consensuses(); + address[4] memory lAdmin = __admins(); + address[4] memory lTreasury = __treasuries(); + + for (uint i; i < lConsensus.length; ++i) { + address id = lConsensus[i]; + + _profile = _id2Profile[id]; + _profile.id = id; + _setConsensus(_profile, TConsensus.wrap(id)); + _setAdmin(_profile, lAdmin[i]); + _setTreasury(_profile, payable(lTreasury[i])); + } + } + + function __admins() private pure returns (address[4] memory list) { + return [ + 0xdb3b1F69259f88Ce9d58f3738e15e3CC1B5A8563, + 0x335fE9EF827a9F27CBAb819b31e5eE182c2081d7, + 0xbCcB3FDa2B9e3Ab5b824AA9D5c1C4A62A98Da937, + 0x9bc1946f1Aa6DA4667a6Ee966e66b9ec60637E10 + ]; + } + + function __consensuses() private pure returns (address[4] memory list) { + return [ + 0x07d28F88D677C4056EA6722aa35d92903b2a63da, + 0x262B9fcfe8CFA900aF4D1f5c20396E969B9655DD, + 0x20238eB5643d4D7b7Ab3C30f3bf7B8E2B85cA1e7, + 0x03A7B98C226225e330d11D1B9177891391Fa4f80 + ]; + } + + function __treasuries() private pure returns (address[4] memory list) { + return [ + 0xdb3b1F69259f88Ce9d58f3738e15e3CC1B5A8563, + 0x335fE9EF827a9F27CBAb819b31e5eE182c2081d7, + 0xbCcB3FDa2B9e3Ab5b824AA9D5c1C4A62A98Da937, + 0x9bc1946f1Aa6DA4667a6Ee966e66b9ec60637E10 + ]; + } +} diff --git a/contracts/ronin/profile/Profile_Testnet.sol b/contracts/ronin/profile/Profile_Testnet.sol new file mode 100644 index 000000000..d9250276d --- /dev/null +++ b/contracts/ronin/profile/Profile_Testnet.sol @@ -0,0 +1,264 @@ +// SPDX-License-Identifier: MIT + +import "./Profile.sol"; + +pragma solidity ^0.8.9; + +contract Profile_Testnet is Profile { + function __migrationRenouncedCandidates() internal override onlyInitializing { + if (block.chainid != 2021) return; + + CandidateProfile storage _profile; + + address[74] memory lConsensus = __consensuses(); + address[74] memory lAdmin = __admins(); + address[74] memory lTreasury = __treasuries(); + + for (uint i; i < lConsensus.length; ++i) { + address id = lConsensus[i]; + + _profile = _id2Profile[id]; + _profile.id = id; + _setConsensus(_profile, TConsensus.wrap(id)); + _setAdmin(_profile, lAdmin[i]); + _setTreasury(_profile, payable(lTreasury[i])); + } + } + + function __admins() private pure returns (address[74] memory list) { + return [ + 0xD682DC6D64710D6191512133dE957e146e9AA58f, + 0xEFeaFf1d9f1E4EDB00c6084aE4016143B29Ed924, + 0xC2caE7311FC0fe400A838d2dDe06A89E1d3e9Da7, + 0xf90a912Fdb7Fd37572cD83325392d729e60Ef682, + 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf, + 0x8dA9d88F90141a03292d5e554691B1F6e7c6212c, + 0xA87F9A2F0C7082FA2f1E3de1090D36047C7cD017, + 0x6693dc258BDAAc5052ab678BA5de2440CA1cdAbe, + 0x0B67dF5847aF7476B2EB46da328638E0fB2C6B29, + 0xe91d1DCd0232BDa301379dE27bd0edE47Db3F750, + 0xDc3de716C4430d598AC504c4685d69D0DcE1412F, + 0x795CF28E5b71f1A50cC9E01077891C18D6587e53, + 0xa3B3c71371331fD1901e316B67df2d16bF5535a0, + 0x32Be208dE8A1595cC0ccf8E984CAB8759Ea1e5b2, + 0x8136c74e94b08300d71Fa6C22087b821F73568c5, + 0xda6c7342E90B77c5C77A8F7292765360099e30Ed, + 0x95fC818CD7709fb6aD8920d0d14925010504876F, + 0xe8E66b241414a40a3Db539eC7d864cD61938f817, + 0xfD575770A68D5Af983b2A374981f604DdAD9D684, + 0x9A54EDCb1D9a44e9f4235ea05c75B45b26679680, + 0x6108570A29f500D6950fEbffC99ECB66a264A048, + 0xdA071F710b0f82443866616E8a96069012A73ccf, + 0x8A4ac64764238C71Ddf82F870BE6526e297Dc4Cd, + 0x33f1727CaA54AE24CAdB2949881C3725eB61a100, + 0x34DB532F09Ee1285DFEf26eD696c4eA25dcFce72, + 0x302d51189FD89D7e72bcb26a65D16941d043F089, + 0xFeb247F76E6F6C1Ec3455d04e6E3B694a577D57C, + 0x05955d9e99f57E5574A1a9b73361DD14aEc8D641, + 0xcf9F44dDB18a5538Efe2a2A28eF20300333f5a71, + 0x779dCE1ddc28941Ec85bf2aE0dAC9F0f12836281, + 0x0Bb270e5268a9E9a0742DdB027Fab7405Af56Fa7, + 0x5b92Ea265597a7cf20C8dA56E6beb8485c1BA993, + 0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3, + 0xf6fd5FcA4Bd769BA495B29B98dba5F2eCF4CEED3, + 0x8d0a639BDD3b81dF264c4dB46476658858231510, + 0xBB046932fEFCDD3Be4368444a1014F25DfEE83f2, + 0x54e09bF04810f387347dA6D9687D6a37EC2aadC7, + 0xDE5e1554e2bF5d0E54BafC74C932b8F2aD4e273F, + 0xc68d0255e1b9C549C43c7181BD29684DC477edfc, + 0x37920733DB9A5b45fC9CD5e3C80825bEfFC1a014, + 0x7e9107480Bf92dd56c97118E20CdB3c1Ae9dD866, + 0xC4F83A7b369070E32CEd4Bd6Fd647D19AEf828AC, + 0x412D4d69122839FcCAd0180e9358d157C3876f3C, + 0x355503B8E64205FDE9dBBAD269110991cf736a50, + 0x306f23c32fdfC07850Bf242E8Ff59C5E79BFf812, + 0x467c5425042C9D9f025265b72C93D73E0F2978C5, + 0xEE992B0F5E9746fdb8e584Efa01AF79f6B1C0940, + 0xBD6342c0009f55131b7a51f627CE8Cc87879DD66, + 0x57018e929Eb6fe50355bF1BF9D1d39cA466b7Fa0, + 0xAd4e3D2F85b4C095742B500751CEE5c4B8f65A5b, + 0x89A6A074dB8BcD3Fd60626107eA2aE576693F7c5, + 0xCB742186fA056444766fA7cc52a0479E8F6DEDEA, + 0x60C8117901Ab35738fcFd7157D393207eFCe8055, + 0xAD70AD152E27E0923C4f11C63490FCFD904A4C36, + 0xd8b47b81648d9e81e50b8cA21EA81F2E1B6929BB, + 0xeCB1374172970a613A1970370B3ddeAD8F844733, + 0x0472dCa02318B532Fcb0B056661EE7fD2Adc8a20, + 0xdd00ACc07F3F7AFa90B5a22cFd56c0808b6444dd, + 0x4d3302c69fac489E2F7373bCB2f101d3B378c4Ce, + 0xe7685E437F34De2D36eA2e9AB13E5Ab871711A2C, + 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf, + 0x3F9Df0717099BAaA95A14B3CAA285DAdDAFb0609, + 0x23Dffc4a93c374A91Fbc1c33075af012b68663F7, + 0x79eC4d83D40c1Bd1419D8f561BE851FDa1EA32a6, + 0x2D3f28780bFb7Ed6FB5547c309E1a6837e5bD12B, + 0xa164e8B5F90ce42B0F531E3882cdE3F698e1121f, + 0x4a4bc674A97737376cFE990aE2fE0d2B6E738393, + 0xF61806B65278fFDbF8b04f832C59b65076798Fb6, + 0x836eeEdd931575CCE4285c74C15DBdA9Edc3Dc4F, + 0xbd95B0581585E4151793b183ee75d509fDE528B6, + 0xA75B1Ce2f8C447caB6c13F313dfd806287aA47e2, + 0x4D546475321b4cA2a91B101f26750092C05350cF, + 0xFC2d29Da710F45168DE11e5C051CaA558088D52a, + 0x1C70B8160E92D56E550caf02e1f2e5EC0Fdb551A + ]; + } + + function __consensuses() private pure returns (address[74] memory list) { + return [ + 0xD682dc6D64710D6191512133De957e146e9Aa58e, + 0xEFeaFf1d9f1e4eDB00C6084ae4016143B29eD925, + 0x57b572A9de68Bd29074e1C51c790Fc45C592ba39, + 0xC0C2A56F9606bA109d37A0d18AF8E5bAA1e1C0aD, + 0xaFB9554299491a34d303F2C5A91bebb162f6b2C1, + 0x533f61B360e81f58919faB5C653724F71faf12ab, + 0xa87F9A2F0C7082FA2f1E3De1090d36047c7cD018, + 0x6693Dc258bDAaC5052aB678Ba5de2440ca1cDAb2, + 0x96f78323481fc9abdb8Cc4D8aa50C1500AC93b92, + 0xe91D1DcD0232BDa301379de27BD0edE47Db3f751, + 0x981676e5E5164524e70f79AC45b52099EbDA8781, + 0x795cf28e5B71f1A50cc9E01077891C18D6587E54, + 0xa3b3C71371331fD1901e316B67DF2d16Bf5535A1, + 0x32be208de8A1595cC0CcF8E984Cab8759Ea1e5b9, + 0x2dc14d542B5478f206B296AcbCBfBCCEE6E8D248, + 0xDA6C7342E90B77c5c77a8F7292765360099E30EE, + 0x9D7EA2223e89A55a4ef69Ca993eae6FDE6E63371, + 0xe8e66b241414a40a3db539EC7d864cD61938f818, + 0x8fFF45d4a6A27F8256dF19D0DaDF7787CfbE56AA, + 0x9a54EdCb1D9a44e9F4235EA05C75B45B26679681, + 0x6108570A29F500D6950FEbFFc99eCB66a264a049, + 0xDA071f710B0f82443866616E8a96069012A73cCE, + 0x5f7f2AE316ec5C092d201744fe8337353ADB2BB3, + 0x771DEc03db66a566a1DfE3fd635B3f8D404b9291, + 0x71f9154ADc0bef39Bbe8dB1D060E6F239D2E10AE, + 0x95908d03bA55c2a44688330b59E746Fdb2f17E3E, + 0x3DB3abc65F203788836C8D50F6923C56f3f0FF7c, + 0x05955D9e99f57E5574a1A9B73361Dd14aEC8D642, + 0x283b4Baa1d0415603C81edc1C68FadD3C790837C, + 0x2A5EB3f9CD4D6Ef49dc2a30041e4421af3303929, + 0x3B9F2587d55E96276B09b258ac909D809961F6C2, + 0x2576e6BC92A493F4DA6335C5E69BC0c272381C3A, + 0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3, + 0xf6fd5FcA4Bd769BA495B29B98dba5F2eCF4CEED3, + 0xd9299FA321407a5d10c73d71C57Ca687A2A38Af6, + 0x877eFEfFE7A23E42C39e2C99b977e4AA4BEC7517, + 0x071b510C415d3f84C6F4C6291C49887cC56cac41, + 0xDE5e1554e2bF5d0e54bAFC74c932b8f2Ad4E2730, + 0xc68d0255E1b9C549C43C7181bd29684DC477eDf0, + 0xC3fB7b95b874bfcBD1E722A2061f3adf217121d3, + 0x36Fd0d4A075507a4E742631aA37DAD46a1F4c0da, + 0x661549d7717C20ffa62AD359B7667Bbf5c82053B, + 0x412d4d69122839fcCAd0180e9358D157C3876F3D, + 0x355503B8E64205FDE9dBbAd269110991CF736a51, + 0x12Cf444bf83Ed5B610d0089927EcD3baBC81Ff88, + 0x467C5425042c9d9f025265b72c93D73e0f2978C6, + 0xB6bc5bc0410773A3F86B1537ce7495C52e38f88B, + 0xBd6342C0009f55131b7A51F627ce8Cc87879dD67, + 0x35C78DefBd03E96b4E3eE6a73e9CD4C49d2b885a, + 0xAD4e3d2f85b4C095742B500751CeE5C4b8F65A5C, + 0x42c535deCcc071D9039b177Cb3AbF30411531b05, + 0xb212F24D850a0Ed90F2889dee31870E7FF3fED6c, + 0x60C8117901AB35738FcfD7157D393207Efce8056, + 0x30b0215a442Ea3D3088Acd83cD5Fe2aA2bcd775A, + 0xD21BeCe2D8206A3fFdBAeDb827f4D4bD0FF79e3d, + 0x4EfA5C5Bbe7a257743335F200E86cD44eEa4dcD9, + 0x0472dcA02318B532fcB0B056661ee7Fd2aDc8A21, + 0xDD00ACc07f3f7Afa90B5A22CFd56c0808b6444Df, + 0x4d3302c69fAc489E2f7373bCB2f101d3b378C4cF, + 0x8c29604e1caE4af683c4fBdAD951F3F855890EA0, + 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf, + 0xF48C06c56D78F5106b8c5Fa234fCeB1d1c50096B, + 0x626ECe2ad62F59700D2734A523FC6177005aC8b0, + 0xc6C15480855add4eeBE365c89a9bb6f278E18254, + 0xF6071F7905D4e4B6eBd27b819aAF8923d542FDDF, + 0x8872fe6335267aDB4C40b9f8667095667B55dCD9, + 0x4a4bc674A97737376cFE990aE2fE0d2B6E738393, + 0x27550f4B37f0309C56ea67578Eb924B4c19eEEB7, + 0x181A053fd961DC1377B84BE4E551ce277053e4C0, + 0xf44C500a8515a5ACc900C921bC888b5b62DA6556, + 0xF20293d569f0Ee7ECcdEF266D86EE382F8932866, + 0xb1D4782962A407343Aa3765a599637932d241305, + 0x7F53d703836abCaF1ca3D5607d80dd7d96e50d02, + 0x78fD38faa30ea66702cc39383D2E84f9a4A56fA6 + ]; + } + + function __treasuries() private pure returns (address[74] memory list) { + return [ + 0xD682DC6D64710D6191512133dE957e146e9AA58f, + 0xEFeaFf1d9f1E4EDB00c6084aE4016143B29Ed924, + 0xC2caE7311FC0fe400A838d2dDe06A89E1d3e9Da7, + 0xf90a912Fdb7Fd37572cD83325392d729e60Ef682, + 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf, + 0x8dA9d88F90141a03292d5e554691B1F6e7c6212c, + 0xA87F9A2F0C7082FA2f1E3de1090D36047C7cD017, + 0x6693dc258BDAAc5052ab678BA5de2440CA1cdAbe, + 0x0B67dF5847aF7476B2EB46da328638E0fB2C6B29, + 0xe91d1DCd0232BDa301379dE27bd0edE47Db3F750, + 0xDc3de716C4430d598AC504c4685d69D0DcE1412F, + 0x795CF28E5b71f1A50cC9E01077891C18D6587e53, + 0xa3B3c71371331fD1901e316B67df2d16bF5535a0, + 0x32Be208dE8A1595cC0ccf8E984CAB8759Ea1e5b2, + 0x8136c74e94b08300d71Fa6C22087b821F73568c5, + 0xda6c7342E90B77c5C77A8F7292765360099e30Ed, + 0x95fC818CD7709fb6aD8920d0d14925010504876F, + 0xe8E66b241414a40a3Db539eC7d864cD61938f817, + 0xfD575770A68D5Af983b2A374981f604DdAD9D684, + 0x9A54EDCb1D9a44e9f4235ea05c75B45b26679680, + 0x6108570A29f500D6950fEbffC99ECB66a264A048, + 0xdA071F710b0f82443866616E8a96069012A73ccf, + 0x8A4ac64764238C71Ddf82F870BE6526e297Dc4Cd, + 0x33f1727CaA54AE24CAdB2949881C3725eB61a100, + 0x34DB532F09Ee1285DFEf26eD696c4eA25dcFce72, + 0x302d51189FD89D7e72bcb26a65D16941d043F089, + 0xFeb247F76E6F6C1Ec3455d04e6E3B694a577D57C, + 0x05955d9e99f57E5574A1a9b73361DD14aEc8D641, + 0xcf9F44dDB18a5538Efe2a2A28eF20300333f5a71, + 0x779dCE1ddc28941Ec85bf2aE0dAC9F0f12836281, + 0x0Bb270e5268a9E9a0742DdB027Fab7405Af56Fa7, + 0x5b92Ea265597a7cf20C8dA56E6beb8485c1BA993, + 0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3, + 0xf6fd5FcA4Bd769BA495B29B98dba5F2eCF4CEED3, + 0x8d0a639BDD3b81dF264c4dB46476658858231510, + 0xBB046932fEFCDD3Be4368444a1014F25DfEE83f2, + 0x54e09bF04810f387347dA6D9687D6a37EC2aadC7, + 0xDE5e1554e2bF5d0E54BafC74C932b8F2aD4e273F, + 0xc68d0255e1b9C549C43c7181BD29684DC477edfc, + 0x37920733DB9A5b45fC9CD5e3C80825bEfFC1a014, + 0x7e9107480Bf92dd56c97118E20CdB3c1Ae9dD866, + 0xC4F83A7b369070E32CEd4Bd6Fd647D19AEf828AC, + 0x412D4d69122839FcCAd0180e9358d157C3876f3C, + 0x355503B8E64205FDE9dBBAD269110991cf736a50, + 0x306f23c32fdfC07850Bf242E8Ff59C5E79BFf812, + 0x467c5425042C9D9f025265b72C93D73E0F2978C5, + 0xEE992B0F5E9746fdb8e584Efa01AF79f6B1C0940, + 0xBD6342c0009f55131b7a51f627CE8Cc87879DD66, + 0x57018e929Eb6fe50355bF1BF9D1d39cA466b7Fa0, + 0xAd4e3D2F85b4C095742B500751CEE5c4B8f65A5b, + 0x89A6A074dB8BcD3Fd60626107eA2aE576693F7c5, + 0xCB742186fA056444766fA7cc52a0479E8F6DEDEA, + 0x60C8117901Ab35738fcFd7157D393207eFCe8055, + 0xAD70AD152E27E0923C4f11C63490FCFD904A4C36, + 0xd8b47b81648d9e81e50b8cA21EA81F2E1B6929BB, + 0xeCB1374172970a613A1970370B3ddeAD8F844733, + 0x0472dCa02318B532Fcb0B056661EE7fD2Adc8a20, + 0xdd00ACc07F3F7AFa90B5a22cFd56c0808b6444dd, + 0x4d3302c69fac489E2F7373bCB2f101d3B378c4Ce, + 0xe7685E437F34De2D36eA2e9AB13E5Ab871711A2C, + 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf, + 0x3F9Df0717099BAaA95A14B3CAA285DAdDAFb0609, + 0x23Dffc4a93c374A91Fbc1c33075af012b68663F7, + 0x79eC4d83D40c1Bd1419D8f561BE851FDa1EA32a6, + 0x2D3f28780bFb7Ed6FB5547c309E1a6837e5bD12B, + 0xa164e8B5F90ce42B0F531E3882cdE3F698e1121f, + 0x4a4bc674A97737376cFE990aE2fE0d2B6E738393, + 0xF61806B65278fFDbF8b04f832C59b65076798Fb6, + 0x836eeEdd931575CCE4285c74C15DBdA9Edc3Dc4F, + 0xbd95B0581585E4151793b183ee75d509fDE528B6, + 0xA75B1Ce2f8C447caB6c13F313dfd806287aA47e2, + 0x4D546475321b4cA2a91B101f26750092C05350cF, + 0xFC2d29Da710F45168DE11e5C051CaA558088D52a, + 0x1C70B8160E92D56E550caf02e1f2e5EC0Fdb551A + ]; + } +} diff --git a/contracts/ronin/slash-indicator/CreditScore.sol b/contracts/ronin/slash-indicator/CreditScore.sol index b50e528c6..631dccec4 100644 --- a/contracts/ronin/slash-indicator/CreditScore.sol +++ b/contracts/ronin/slash-indicator/CreditScore.sol @@ -18,7 +18,7 @@ abstract contract CreditScore is HasMaintenanceDeprecated, PercentageConsumer { - /// @dev Mapping from validator address => period index => whether bailed out before + /// @dev Mapping from validator id => period index => whether bailed out before mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod; /// @dev Mapping from validator address => credit score mapping(address => uint256) internal _creditScore; @@ -41,85 +41,86 @@ abstract contract CreditScore is /** * @inheritdoc ICreditScore */ - function updateCreditScores( - address[] calldata _validators, - uint256 _period + function execUpdateCreditScores( + address[] calldata validatorIds, + uint256 period ) external override onlyContract(ContractType.VALIDATOR) { - IRoninValidatorSet _validatorContract = IRoninValidatorSet(msg.sender); - uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock(); + IRoninValidatorSet validatorContract = IRoninValidatorSet(msg.sender); + uint256 periodStartAtBlock = validatorContract.currentPeriodStartAtBlock(); - bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators); - bool[] memory _maintaineds = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedInBlockRange( - _validators, - _periodStartAtBlock, + bool[] memory jaileds = validatorContract.checkManyJailedById(validatorIds); + bool[] memory maintaineds = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedInBlockRangeById( + validatorIds, + periodStartAtBlock, block.number ); - uint256[] memory _updatedCreditScores = new uint256[](_validators.length); + uint256[] memory updatedCreditScores = new uint256[](validatorIds.length); - for (uint _i = 0; _i < _validators.length; ) { - address _validator = _validators[_i]; + for (uint i = 0; i < validatorIds.length; ) { + address vId = validatorIds[i]; - uint256 _indicator = getUnavailabilityIndicator(_validator, _period); - bool _isJailedInPeriod = _jaileds[_i]; - bool _isMaintainingInPeriod = _maintaineds[_i]; + uint256 indicator = _getUnavailabilityIndicatorById(vId, period); + bool isJailedInPeriod = jaileds[i]; + bool isMaintainingInPeriod = maintaineds[i]; - uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod) + uint256 _actualGain = (isJailedInPeriod || isMaintainingInPeriod) ? 0 - : Math.subNonNegative(_gainCreditScore, _indicator); + : Math.subNonNegative(_gainCreditScore, indicator); - _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore); - _updatedCreditScores[_i] = _creditScore[_validator]; + _creditScore[vId] = Math.addWithUpperbound(_creditScore[vId], _actualGain, _maxCreditScore); + updatedCreditScores[i] = _creditScore[vId]; unchecked { - ++_i; + ++i; } } - emit CreditScoresUpdated(_validators, _updatedCreditScores); + emit CreditScoresUpdated(validatorIds, updatedCreditScores); } function execResetCreditScores( - address[] calldata _validators + address[] calldata validatorIds ) external override onlyContract(ContractType.VALIDATOR) { - uint256[] memory _updatedCreditScores = new uint256[](_validators.length); - for (uint _i = 0; _i < _validators.length; ) { - address _validator = _validators[_i]; + uint256[] memory updatedCreditScores = new uint256[](validatorIds.length); + for (uint i = 0; i < validatorIds.length; ) { + address _validator = validatorIds[i]; delete _creditScore[_validator]; - delete _updatedCreditScores[_i]; + delete updatedCreditScores[i]; unchecked { - ++_i; + ++i; } } - emit CreditScoresUpdated(_validators, _updatedCreditScores); + emit CreditScoresUpdated(validatorIds, updatedCreditScores); } /** * @inheritdoc ICreditScore */ - function bailOut(address _consensusAddr) external override { - IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); - if (!_validatorContract.isValidatorCandidate(_consensusAddr)) + function bailOut(TConsensus consensusAddr) external override { + address validatorId = __css2cid(consensusAddr); + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + if (!validatorContract.isValidatorCandidate(consensusAddr)) revert ErrUnauthorized(msg.sig, RoleAccess.VALIDATOR_CANDIDATE); - if (!_validatorContract.isCandidateAdmin(_consensusAddr, msg.sender)) + if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender)) revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN); - (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr); - if (!_isJailed) revert ErrCallerMustBeJailedInTheCurrentPeriod(); + (bool isJailed, , uint256 jailedEpochLeft) = validatorContract.getJailedTimeLeft(consensusAddr); + if (!isJailed) revert ErrCallerMustBeJailedInTheCurrentPeriod(); - uint256 _period = _validatorContract.currentPeriod(); - if (_checkBailedOutAtPeriod[_consensusAddr][_period]) revert ErrValidatorHasBailedOutPreviously(); + uint256 period = validatorContract.currentPeriod(); + if (_checkBailedOutAtPeriod[validatorId][period]) revert ErrValidatorHasBailedOutPreviously(); - uint256 _score = _creditScore[_consensusAddr]; - uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier; - if (_score < _cost) revert ErrInsufficientCreditScoreToBailOut(); + uint256 score = _creditScore[validatorId]; + uint256 cost = jailedEpochLeft * _bailOutCostMultiplier; + if (score < cost) revert ErrInsufficientCreditScoreToBailOut(); - _validatorContract.execBailOut(_consensusAddr, _period); + validatorContract.execBailOut(validatorId, period); - _creditScore[_consensusAddr] -= _cost; - _setUnavailabilityIndicator(_consensusAddr, _period, 0); - _checkBailedOutAtPeriod[_consensusAddr][_period] = true; - emit BailedOut(_consensusAddr, _period, _cost); + _creditScore[validatorId] -= cost; + _setUnavailabilityIndicator(validatorId, period, 0); + _checkBailedOutAtPeriod[validatorId][period] = true; + emit BailedOut(consensusAddr, period, cost); } /** @@ -137,7 +138,7 @@ abstract contract CreditScore is /** * @dev See `ISlashUnavailability` */ - function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256); + function _getUnavailabilityIndicatorById(address validator, uint256 period) internal view virtual returns (uint256); /** * @inheritdoc ICreditScore @@ -159,23 +160,24 @@ abstract contract CreditScore is /** * @inheritdoc ICreditScore */ - function getCreditScore(address _validator) external view override returns (uint256) { - return _creditScore[_validator]; + function getCreditScore(TConsensus consensusAddr) external view override returns (uint256) { + return _creditScore[__css2cid(consensusAddr)]; } /** * @inheritdoc ICreditScore */ function getManyCreditScores( - address[] calldata _validators - ) public view override returns (uint256[] memory _resultList) { - _resultList = new uint256[](_validators.length); + TConsensus[] calldata consensusAddrs + ) public view override returns (uint256[] memory resultList) { + address[] memory validatorIds = __css2cidBatch(consensusAddrs); + resultList = new uint256[](validatorIds.length); - for (uint _i = 0; _i < _resultList.length; ) { - _resultList[_i] = _creditScore[_validators[_i]]; + for (uint i = 0; i < resultList.length; ) { + resultList[i] = _creditScore[validatorIds[i]]; unchecked { - ++_i; + ++i; } } } @@ -183,14 +185,22 @@ abstract contract CreditScore is /** * @inheritdoc ICreditScore */ - function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) { - return _checkBailedOutAtPeriod[_validator][_period]; + function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view override returns (bool) { + return _checkBailedOutAtPeriodById(__css2cid(consensus), period); + } + + function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool) { + return _checkBailedOutAtPeriod[validatorId][period]; } /** * @dev See `SlashUnavailability`. */ - function _setUnavailabilityIndicator(address _validator, uint256 _period, uint256 _indicator) internal virtual; + function _setUnavailabilityIndicator(address _validator, uint256 period, uint256 _indicator) internal virtual; + + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); + + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory); /** * @dev See `ICreditScore-setCreditScoreConfigs`. diff --git a/contracts/ronin/slash-indicator/DeprecatedSlashBridgeOperator.sol b/contracts/ronin/slash-indicator/DeprecatedSlashBridgeOperator.sol new file mode 100644 index 000000000..fb98ec548 --- /dev/null +++ b/contracts/ronin/slash-indicator/DeprecatedSlashBridgeOperator.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.9; + +import "../../extensions/collections/HasProxyAdmin.sol"; +import "../../extensions/collections/HasContracts.sol"; +import { HasValidatorDeprecated } from "../../utils/DeprecatedSlots.sol"; + +abstract contract DeprecatedSlashBridgeOperator is HasProxyAdmin, HasContracts, HasValidatorDeprecated { + /** + * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio. + * Values 0-10,000 map to 0%-100%. + */ + uint256 private ____deprecatedMissingVotesRatioTier1; + /** + * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed + * more than the ratio. Values 0-10,000 map to 0%-100%. + */ + uint256 private ____deprecatedMissingVotesRatioTier2; + /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2. + uint256 private ____deprecatedJailDurationForMissingVotesRatioTier2; + /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small. + uint256 private ____deprecatedSkipBridgeOperatorSlashingThreshold; + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + */ + uint256[50] private ______gap; +} diff --git a/contracts/ronin/slash-indicator/DeprecatedSlashBridgeVoting.sol b/contracts/ronin/slash-indicator/DeprecatedSlashBridgeVoting.sol new file mode 100644 index 000000000..4fba55633 --- /dev/null +++ b/contracts/ronin/slash-indicator/DeprecatedSlashBridgeVoting.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.9; + +import { HasValidatorDeprecated, HasTrustedOrgDeprecated, HasGovernanceAdminDeprecated } from "../../utils/DeprecatedSlots.sol"; +import "../../extensions/collections/HasContracts.sol"; + +// TODO: remove this from slashing logic of consensus contract +abstract contract DeprecatedSlashBridgeVoting is + HasContracts, + HasValidatorDeprecated, + HasTrustedOrgDeprecated, + HasGovernanceAdminDeprecated +{ + /// @dev Mapping from validator address => period index => bridge voting slashed + mapping(address => mapping(uint256 => bool)) private __deprecatedBridgeVotingSlashed; + /// @dev The threshold to slash when a trusted organization does not vote for bridge operators. + uint256 private __deprecatedBridgeVotingThreshold; + /// @dev The amount of RON to slash bridge voting. + uint256 private __deprecatedBridgeVotingSlashAmount; + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + */ + uint256[50] private ______gap; +} diff --git a/contracts/ronin/slash-indicator/SlashBridgeOperator.sol b/contracts/ronin/slash-indicator/SlashBridgeOperator.sol deleted file mode 100644 index 7ccb68ea3..000000000 --- a/contracts/ronin/slash-indicator/SlashBridgeOperator.sol +++ /dev/null @@ -1,107 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.9; - -import "../../extensions/consumers/PercentageConsumer.sol"; -import "../../extensions/collections/HasProxyAdmin.sol"; -import "../../interfaces/slash-indicator/ISlashBridgeOperator.sol"; -import "../../extensions/collections/HasContracts.sol"; -import { HasValidatorDeprecated } from "../../utils/DeprecatedSlots.sol"; - -abstract contract SlashBridgeOperator is - ISlashBridgeOperator, - HasProxyAdmin, - HasContracts, - HasValidatorDeprecated, - PercentageConsumer -{ - /** - * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio. - * Values 0-10,000 map to 0%-100%. - */ - uint256 internal _missingVotesRatioTier1; - /** - * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed - * more than the ratio. Values 0-10,000 map to 0%-100%. - */ - uint256 internal _missingVotesRatioTier2; - /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2. - uint256 internal _jailDurationForMissingVotesRatioTier2; - /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small. - uint256 internal _skipBridgeOperatorSlashingThreshold; - - /** - * @dev This empty reserved space is put in place to allow future versions to add new - * variables without shifting down storage in the inheritance chain. - */ - uint256[50] private ______gap; - - /** - * @inheritdoc ISlashBridgeOperator - */ - function getBridgeOperatorSlashingConfigs() - external - view - override - returns ( - uint256 missingVotesRatioTier1_, - uint256 missingVotesRatioTier2_, - uint256 jailDurationForMissingVotesRatioTier2_, - uint256 skipBridgeOperatorSlashingThreshold_ - ) - { - return ( - _missingVotesRatioTier1, - _missingVotesRatioTier2, - _jailDurationForMissingVotesRatioTier2, - _skipBridgeOperatorSlashingThreshold - ); - } - - /** - * @inheritdoc ISlashBridgeOperator - */ - function setBridgeOperatorSlashingConfigs( - uint256 _ratioTier1, - uint256 _ratioTier2, - uint256 _jailDurationTier2, - uint256 _skipSlashingThreshold - ) external override onlyAdmin { - _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold); - } - - /** - * @inheritdoc ISlashBridgeOperator - */ - function execSlashBridgeOperator( - address _consensusAddr, - uint256 _tier, - uint256 _period - ) external onlyContract(ContractType.VALIDATOR) { - if (_tier == 1) { - emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period); - } else if (_tier == 2) { - emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period); - } - } - - /** - * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`. - */ - function _setBridgeOperatorSlashingConfigs( - uint256 _ratioTier1, - uint256 _ratioTier2, - uint256 _jailDurationTier2, - uint256 _skipSlashingThreshold - ) internal { - if (_ratioTier1 > _ratioTier2 || _ratioTier1 > _MAX_PERCENTAGE || _ratioTier2 > _MAX_PERCENTAGE) { - revert ErrInvalidRatios(); - } - - _missingVotesRatioTier1 = _ratioTier1; - _missingVotesRatioTier2 = _ratioTier2; - _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2; - _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold; - emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold); - } -} diff --git a/contracts/ronin/slash-indicator/SlashBridgeVoting.sol b/contracts/ronin/slash-indicator/SlashBridgeVoting.sol deleted file mode 100644 index 14e619115..000000000 --- a/contracts/ronin/slash-indicator/SlashBridgeVoting.sol +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.9; - -import "../../libraries/Math.sol"; -import { HasValidatorDeprecated, HasTrustedOrgDeprecated, HasGovernanceAdminDeprecated } from "../../utils/DeprecatedSlots.sol"; -import { IBridgeAdminProposal } from "../../interfaces/IBridgeAdminProposal.sol"; -import "../../interfaces/slash-indicator/ISlashBridgeVoting.sol"; -import "../../interfaces/IRoninTrustedOrganization.sol"; -import "../../interfaces/validator/IRoninValidatorSet.sol"; -import "../../extensions/collections/HasContracts.sol"; - -// TODO: remove this from slashing logic of consensus contract -abstract contract SlashBridgeVoting is - ISlashBridgeVoting, - HasContracts, - HasValidatorDeprecated, - HasTrustedOrgDeprecated, - HasGovernanceAdminDeprecated -{ - /// @dev Mapping from validator address => period index => bridge voting slashed - mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed; - /// @dev The threshold to slash when a trusted organization does not vote for bridge operators. - uint256 internal _bridgeVotingThreshold; - /// @dev The amount of RON to slash bridge voting. - uint256 internal _bridgeVotingSlashAmount; - - /** - * @dev This empty reserved space is put in place to allow future versions to add new - * variables without shifting down storage in the inheritance chain. - */ - uint256[50] private ______gap; - - /** - * @inheritdoc ISlashBridgeVoting - */ - function slashBridgeVoting(address _consensusAddr) external onlyAdmin { - IRoninTrustedOrganization.TrustedOrganization memory _org = IRoninTrustedOrganization( - getContract(ContractType.RONIN_TRUSTED_ORGANIZATION) - ).getTrustedOrganization(_consensusAddr); - uint256 _lastVotedBlock = Math.max( - IBridgeAdminProposal(getContract(ContractType.BRIDGE_MANAGER)).lastVotedBlock(_org.bridgeVoter), - _org.addedBlock - ); - IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); - uint256 _period = _validatorContract.currentPeriod(); - - if (block.number - _lastVotedBlock <= _bridgeVotingThreshold || _bridgeVotingSlashed[_consensusAddr][_period]) - revert ErrInvalidSlash(); - - _bridgeVotingSlashed[_consensusAddr][_period] = true; - emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period); - _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false); - } - - /** - * @inheritdoc ISlashBridgeVoting - */ - function getBridgeVotingSlashingConfigs() - external - view - override - returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_) - { - return (_bridgeVotingThreshold, _bridgeVotingSlashAmount); - } - - /** - * @inheritdoc ISlashBridgeVoting - */ - function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin { - _setBridgeVotingSlashingConfigs(_threshold, _slashAmount); - } - - /** - * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`. - */ - function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal { - _bridgeVotingThreshold = _threshold; - _bridgeVotingSlashAmount = _slashAmount; - emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount); - } -} diff --git a/contracts/ronin/slash-indicator/SlashDoubleSign.sol b/contracts/ronin/slash-indicator/SlashDoubleSign.sol index e64f742e5..bbf05d79c 100644 --- a/contracts/ronin/slash-indicator/SlashDoubleSign.sol +++ b/contracts/ronin/slash-indicator/SlashDoubleSign.sol @@ -30,24 +30,32 @@ abstract contract SlashDoubleSign is ISlashDoubleSign, HasContracts, HasValidato * @inheritdoc ISlashDoubleSign */ function slashDoubleSign( - address _consensusAddr, - bytes calldata _header1, - bytes calldata _header2 + TConsensus consensusAddr, + bytes calldata header1, + bytes calldata header2 ) external override onlyAdmin { - bytes32 _header1Checksum = keccak256(_header1); - bytes32 _header2Checksum = keccak256(_header2); + bytes32 header1Checksum = keccak256(header1); + bytes32 header2Checksum = keccak256(header2); - if (_submittedEvidence[_header1Checksum] || _submittedEvidence[_header2Checksum]) { + if (_submittedEvidence[header1Checksum] || _submittedEvidence[header2Checksum]) { revert ErrEvidenceAlreadySubmitted(); } - if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) { - IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); - uint256 _period = _validatorContract.currentPeriod(); - _submittedEvidence[_header1Checksum] = true; - _submittedEvidence[_header2Checksum] = true; - emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period); - _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true); + address validatorId = __css2cid(consensusAddr); + + // NOTE: Edge case: non-validator who never apply for the candidate role, nor have a profile. + // Must be slashed by the consensus address, since the validatorId will be address(0). + if (validatorId == address(0)) { + validatorId = TConsensus.unwrap(consensusAddr); + } + + if (_pcValidateEvidence(validatorId, header1, header2)) { + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + uint256 period = validatorContract.currentPeriod(); + _submittedEvidence[header1Checksum] = true; + _submittedEvidence[header2Checksum] = true; + emit Slashed(validatorId, SlashType.DOUBLE_SIGNING, period); + validatorContract.execSlash(validatorId, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true); } } @@ -95,5 +103,7 @@ abstract contract SlashDoubleSign is ISlashDoubleSign, HasContracts, HasValidato /** * @dev Returns whether the account `_addr` should be slashed or not. */ - function _shouldSlash(address _addr) internal view virtual returns (bool); + function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool); + + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); } diff --git a/contracts/ronin/slash-indicator/SlashFastFinality.sol b/contracts/ronin/slash-indicator/SlashFastFinality.sol index 53cc2898b..6b1ebfcf3 100644 --- a/contracts/ronin/slash-indicator/SlashFastFinality.sol +++ b/contracts/ronin/slash-indicator/SlashFastFinality.sol @@ -33,15 +33,16 @@ abstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUVali * @inheritdoc ISlashFastFinality */ function slashFastFinality( - address consensusAddr, + TConsensus consensusAddr, bytes calldata voterPublicKey, uint256 targetBlockNumber, bytes32[2] calldata targetBlockHash, bytes[][2] calldata listOfPublicKey, bytes[2] calldata aggregatedSignature ) external override onlyGoverningValidator { + address validatorId = __css2cid(consensusAddr); IProfile profileContract = IProfile(getContract(ContractType.PROFILE)); - bytes memory expectingPubKey = (profileContract.getId2Profile(consensusAddr)).pubkey; + bytes memory expectingPubKey = (profileContract.getId2Profile(validatorId)).pubkey; if (keccak256(voterPublicKey) != keccak256(expectingPubKey)) revert ErrInvalidArguments(msg.sig); bytes32 evidenceHash = keccak256(abi.encodePacked(consensusAddr, targetBlockNumber)); @@ -60,9 +61,9 @@ abstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUVali IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); uint256 period = validatorContract.currentPeriod(); - emit Slashed(consensusAddr, SlashType.FAST_FINALITY, period); + emit Slashed(validatorId, SlashType.FAST_FINALITY, period); validatorContract.execSlash({ - validatorAddr: consensusAddr, + cid: validatorId, newJailedUntil: _fastFinalityJailUntilBlock, slashAmount: _slashFastFinalityAmount, cannotBailout: true @@ -104,4 +105,6 @@ abstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUVali function _getGovernorWeight(address addr) internal view returns (uint256) { return IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getGovernorWeight(addr); } + + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); } diff --git a/contracts/ronin/slash-indicator/SlashIndicator.sol b/contracts/ronin/slash-indicator/SlashIndicator.sol index 767040fe2..5f4373fa2 100644 --- a/contracts/ronin/slash-indicator/SlashIndicator.sol +++ b/contracts/ronin/slash-indicator/SlashIndicator.sol @@ -6,10 +6,11 @@ import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../../interfaces/slash-indicator/ISlashIndicator.sol"; import "../../interfaces/validator/IRoninValidatorSet.sol"; import "../../interfaces/IMaintenance.sol"; +import "../../interfaces/IProfile.sol"; +import "./DeprecatedSlashBridgeOperator.sol"; +import "./DeprecatedSlashBridgeVoting.sol"; import "./SlashDoubleSign.sol"; import "./SlashFastFinality.sol"; -import "./SlashBridgeVoting.sol"; -import "./SlashBridgeOperator.sol"; import "./SlashUnavailability.sol"; import "./CreditScore.sol"; @@ -17,8 +18,8 @@ contract SlashIndicator is ISlashIndicator, SlashDoubleSign, SlashFastFinality, - SlashBridgeVoting, - SlashBridgeOperator, + DeprecatedSlashBridgeVoting, + DeprecatedSlashBridgeOperator, SlashUnavailability, CreditScore, Initializable @@ -35,14 +36,8 @@ contract SlashIndicator is address __maintenanceContract, address __roninTrustedOrganizationContract, address __roninGovernanceAdminContract, - // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1 - // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2 - // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2 - // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold - uint256[4] calldata _bridgeOperatorSlashingConfigs, - // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold - // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount - uint256[2] calldata _bridgeVotingSlashingConfigs, + uint256[4] calldata /* _bridgeOperatorSlashingConfigs */, + uint256[2] calldata /* _bridgeVotingSlashingConfigs */, // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock @@ -63,13 +58,6 @@ contract SlashIndicator is _setContract(ContractType.GOVERNANCE_ADMIN, __roninGovernanceAdminContract); _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract); - _setBridgeOperatorSlashingConfigs( - _bridgeOperatorSlashingConfigs[0], - _bridgeOperatorSlashingConfigs[1], - _bridgeOperatorSlashingConfigs[2], - _bridgeOperatorSlashingConfigs[3] - ); - _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]); _setDoubleSignSlashingConfigs( _doubleSignSlashingConfigs[0], _doubleSignSlashingConfigs[1], @@ -110,40 +98,51 @@ contract SlashIndicator is * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out. */ function _setUnavailabilityIndicator( - address _validator, - uint256 _period, - uint256 _indicator + address validator, + uint256 period, + uint256 indicator ) internal override(CreditScore, SlashUnavailability) { - SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator); + SlashUnavailability._setUnavailabilityIndicator(validator, period, indicator); } /** * @dev Helper for CreditScore contract to query indicator of the validator. */ - function getUnavailabilityIndicator( - address _validator, - uint256 _period - ) public view override(CreditScore, ISlashUnavailability, SlashUnavailability) returns (uint256) { - return SlashUnavailability.getUnavailabilityIndicator(_validator, _period); + function _getUnavailabilityIndicatorById( + address validatorId, + uint256 period + ) internal view override(CreditScore, SlashUnavailability) returns (uint256) { + return SlashUnavailability._getUnavailabilityIndicatorById(validatorId, period); } - /** - * @inheritdoc ICreditScore - */ - function checkBailedOutAtPeriod( - address _validator, - uint256 _period - ) public view override(CreditScore, ICreditScore, SlashUnavailability) returns (bool) { - return CreditScore.checkBailedOutAtPeriod(_validator, _period); + function _checkBailedOutAtPeriodById( + address cid, + uint256 period + ) internal view override(CreditScore, SlashUnavailability) returns (bool) { + return CreditScore._checkBailedOutAtPeriodById(cid, period); } /** * @dev Sanity check the address to be slashed */ - function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) { + function _shouldSlash( + TConsensus consensus, + address validatorId + ) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) { return - (msg.sender != _addr) && - IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isBlockProducer(_addr) && - !IMaintenance(getContract(ContractType.MAINTENANCE)).checkMaintained(_addr, block.number); + (msg.sender != TConsensus.unwrap(consensus)) && + (msg.sender != validatorId) && + IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isBlockProducer(consensus) && + !IMaintenance(getContract(ContractType.MAINTENANCE)).checkMaintainedById(validatorId, block.number); + } + + function __css2cid( + TConsensus consensusAddr + ) internal view override(CreditScore, SlashDoubleSign, SlashUnavailability, SlashFastFinality) returns (address) { + return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr); + } + + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view override returns (address[] memory) { + return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs); } } diff --git a/contracts/ronin/slash-indicator/SlashUnavailability.sol b/contracts/ronin/slash-indicator/SlashUnavailability.sol index 13560ae0e..4bbc64c37 100644 --- a/contracts/ronin/slash-indicator/SlashUnavailability.sol +++ b/contracts/ronin/slash-indicator/SlashUnavailability.sol @@ -11,7 +11,7 @@ import { ErrInvalidThreshold } from "../../utils/CommonErrors.sol"; abstract contract SlashUnavailability is ISlashUnavailability, HasContracts, HasValidatorDeprecated { /// @dev The last block that a validator is slashed for unavailability. - uint256 public lastUnavailabilitySlashedBlock; + uint256 internal _lastUnavailabilitySlashedBlock; /// @dev Mapping from validator address => period index => unavailability indicator. mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator; @@ -40,52 +40,57 @@ abstract contract SlashUnavailability is ISlashUnavailability, HasContracts, Has uint256[50] private ______gap; modifier oncePerBlock() { - if (block.number <= lastUnavailabilitySlashedBlock) { + if (block.number <= _lastUnavailabilitySlashedBlock) { revert ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock(); } - lastUnavailabilitySlashedBlock = block.number; + _lastUnavailabilitySlashedBlock = block.number; _; } + function lastUnavailabilitySlashedBlock() external view returns (uint256) { + return _lastUnavailabilitySlashedBlock; + } + /** * @inheritdoc ISlashUnavailability */ - function slashUnavailability(address _validatorAddr) external override oncePerBlock { + function slashUnavailability(TConsensus consensusAddr) external override oncePerBlock { if (msg.sender != block.coinbase) revert ErrUnauthorized(msg.sig, RoleAccess.COINBASE); - if (!_shouldSlash(_validatorAddr)) { + address validatorId = __css2cid(consensusAddr); + if (!_shouldSlash(consensusAddr, validatorId)) { // Should return instead of throwing error since this is a part of system transaction. return; } IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); - uint256 _period = _validatorContract.currentPeriod(); - uint256 _count; + uint256 period = _validatorContract.currentPeriod(); + uint256 count; unchecked { - _count = ++_unavailabilityIndicator[_validatorAddr][_period]; + count = ++_unavailabilityIndicator[validatorId][period]; } - uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold); + uint256 newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold); - if (_count == _unavailabilityTier2Threshold) { - emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period); + if (count == _unavailabilityTier2Threshold) { + emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_2, period); _validatorContract.execSlash( - _validatorAddr, - _newJailedUntilBlock, + validatorId, + newJailedUntilBlock, _slashAmountForUnavailabilityTier2Threshold, false ); - } else if (_count == _unavailabilityTier1Threshold) { - bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period); - if (!_tier1SecondTime) { - emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period); - _validatorContract.execSlash(_validatorAddr, 0, 0, false); + } else if (count == _unavailabilityTier1Threshold) { + bool tier1SecondTime = _checkBailedOutAtPeriodById(validatorId, period); + if (!tier1SecondTime) { + emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_1, period); + _validatorContract.execSlash(validatorId, 0, 0, false); } else { /// Handles tier-3 - emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period); + emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_3, period); _validatorContract.execSlash( - _validatorAddr, - _newJailedUntilBlock, + validatorId, + newJailedUntilBlock, _slashAmountForUnavailabilityTier2Threshold, true ); @@ -135,19 +140,29 @@ abstract contract SlashUnavailability is ISlashUnavailability, HasContracts, Has /** * @inheritdoc ISlashUnavailability */ - function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) { + function currentUnavailabilityIndicator(TConsensus consensus) external view override returns (uint256) { return - getUnavailabilityIndicator(_validator, IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod()); + _getUnavailabilityIndicatorById( + __css2cid(consensus), + IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod() + ); } /** * @inheritdoc ISlashUnavailability */ function getUnavailabilityIndicator( - address _validator, - uint256 _period - ) public view virtual override returns (uint256) { - return _unavailabilityIndicator[_validator][_period]; + TConsensus consensus, + uint256 period + ) external view virtual override returns (uint256) { + return _getUnavailabilityIndicatorById(__css2cid(consensus), period); + } + + function _getUnavailabilityIndicatorById( + address validatorId, + uint256 period + ) internal view virtual returns (uint256) { + return _unavailabilityIndicator[validatorId][period]; } /** @@ -183,10 +198,12 @@ abstract contract SlashUnavailability is ISlashUnavailability, HasContracts, Has /** * @dev Returns whether the account `_addr` should be slashed or not. */ - function _shouldSlash(address _addr) internal view virtual returns (bool); + function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool); /** - * @dev See `ICreditScore-checkBailedOutAtPeriod` + * @dev See `ICreditScore-checkBailedOutAtPeriodById` */ - function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool); + function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool); + + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); } diff --git a/contracts/ronin/staking/BaseStaking.sol b/contracts/ronin/staking/BaseStaking.sol index 6335d5fcc..3ff784936 100644 --- a/contracts/ronin/staking/BaseStaking.sol +++ b/contracts/ronin/staking/BaseStaking.sol @@ -7,9 +7,11 @@ import "../../extensions/RONTransferHelper.sol"; import "../../extensions/collections/HasContracts.sol"; import "../../interfaces/staking/IBaseStaking.sol"; import "../../interfaces/validator/IRoninValidatorSet.sol"; +import "../../interfaces/IProfile.sol"; import "../../libraries/Math.sol"; import { HasValidatorDeprecated } from "../../utils/DeprecatedSlots.sol"; import "./RewardCalculation.sol"; +import { TPoolId, TConsensus } from "../../udvts/Types.sol"; abstract contract BaseStaking is RONTransferHelper, @@ -19,15 +21,15 @@ abstract contract BaseStaking is IBaseStaking, HasValidatorDeprecated { - /// @dev Mapping from pool address => staking pool detail - mapping(address => PoolDetail) internal _stakingPool; + /// @dev Mapping from pool address (i.e. validator id) => staking pool detail + mapping(address => PoolDetail) internal _poolDetail; /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated. uint256 internal _cooldownSecsToUndelegate; /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back. uint256 internal _waitingSecsToRevoke; - /// @dev Mapping from admin address of an active pool => consensus address. + /// @dev Mapping from "admin address of an active pool" => "pool id". mapping(address => address) internal _adminOfActivePoolMapping; /** * @dev This empty reserved space is put in place to allow future versions to add new @@ -40,18 +42,18 @@ abstract contract BaseStaking is _; } - modifier anyExceptPoolAdmin(PoolDetail storage _pool, address _delegator) { - _anyExceptPoolAdmin(_pool, _delegator); + modifier anyExceptPoolAdmin(PoolDetail storage _pool, address delegator) { + _anyExceptPoolAdmin(_pool, delegator); _; } - modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) { - _requirePoolAdmin(_pool, _requester); + modifier onlyPoolAdmin(PoolDetail storage _pool, address requester) { + _requirePoolAdmin(_pool, requester); _; } - modifier poolIsActive(address _poolAddr) { - _poolIsActive(_poolAddr); + modifier poolOfConsensusIsActive(TConsensus consensusAddr) { + _poolOfConsensusIsActive(consensusAddr); _; } @@ -59,53 +61,83 @@ abstract contract BaseStaking is if (msg.value == 0) revert ErrZeroValue(); } - function _requirePoolAdmin(PoolDetail storage _pool, address _requester) private view { - if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed(); + function _requirePoolAdmin(PoolDetail storage _pool, address requester) private view { + if (_pool.__shadowedPoolAdmin != requester) revert ErrOnlyPoolAdminAllowed(); } - function _anyExceptPoolAdmin(PoolDetail storage _pool, address _delegator) private view { - if (_pool.admin == _delegator) revert ErrPoolAdminForbidden(); + function _anyExceptPoolAdmin(PoolDetail storage _pool, address delegator) private view { + if (_pool.__shadowedPoolAdmin == delegator) revert ErrPoolAdminForbidden(); } - function _poolIsActive(address _poolAddr) private view { - if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isValidatorCandidate(_poolAddr)) - revert ErrInactivePool(_poolAddr); + function _poolOfConsensusIsActive(TConsensus consensusAddr) private view { + if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isValidatorCandidate(consensusAddr)) + revert ErrInactivePool(consensusAddr, __css2cid(consensusAddr)); } /** * @inheritdoc IBaseStaking */ - function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) { - return _adminOfActivePoolMapping[_poolAdminAddr] != address(0); + function isAdminOfActivePool(address admin) public view override returns (bool) { + return _adminOfActivePoolMapping[admin] != address(0); } /** * @inheritdoc IBaseStaking */ - function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) { - return _adminOfActivePoolMapping[_poolAdminAddr]; + function getPoolAddressOf(address admin) external view override returns (address) { + return _adminOfActivePoolMapping[admin]; } /** * @inheritdoc IBaseStaking */ function getPoolDetail( - address _poolAddr - ) external view returns (address _admin, uint256 _stakingAmount, uint256 _stakingTotal) { - PoolDetail storage _pool = _stakingPool[_poolAddr]; - return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal); + TConsensus consensusAddr + ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) { + address poolId = __css2cid(consensusAddr); + return _getPoolDetailById(poolId); + } + + function getPoolDetailById( + address poolId + ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) { + return _getPoolDetailById(poolId); + } + + function _getPoolDetailById( + address poolId + ) internal view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) { + PoolDetail storage _pool = _poolDetail[poolId]; + return (_pool.__shadowedPoolAdmin, _pool.stakingAmount, _pool.stakingTotal); + } + + /** + * @inheritdoc IBaseStaking + */ + function getManySelfStakings( + TConsensus[] calldata consensusAddrs + ) external view returns (uint256[] memory selfStakings_) { + address[] memory poolIds = __css2cidBatch(consensusAddrs); + return _getManySelfStakingsById(poolIds); } /** * @inheritdoc IBaseStaking */ - function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) { - _selfStakings = new uint256[](_pools.length); - for (uint _i = 0; _i < _pools.length; ) { - _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount; + function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory selfStakings_) { + return _getManySelfStakingsById(poolIds); + } + + /** + * @dev Query many self staking amount by list `poolIds`. + */ + function _getManySelfStakingsById(address[] memory poolIds) internal view returns (uint256[] memory selfStakings_) { + selfStakings_ = new uint256[](poolIds.length); + for (uint i = 0; i < poolIds.length; ) { + selfStakings_[i] = _poolDetail[poolIds[i]].stakingAmount; unchecked { - ++_i; + ++i; } } } @@ -113,51 +145,100 @@ abstract contract BaseStaking is /** * @inheritdoc IRewardPool */ - function getStakingTotal(address _poolAddr) public view override returns (uint256) { - return _stakingPool[_poolAddr].stakingTotal; + function getStakingTotal(TConsensus consensusAddr) external view override returns (uint256) { + address poolId = __css2cid(consensusAddr); + return _getStakingTotal(poolId); } /** * @inheritdoc IRewardPool */ function getManyStakingTotals( - address[] calldata _poolList - ) public view override returns (uint256[] memory _stakingAmounts) { - _stakingAmounts = new uint256[](_poolList.length); - for (uint _i = 0; _i < _poolList.length; ) { - _stakingAmounts[_i] = getStakingTotal(_poolList[_i]); + TConsensus[] calldata consensusAddrs + ) external view override returns (uint256[] memory stakingAmounts_) { + address[] memory poolIds = __css2cidBatch(consensusAddrs); + return _getManyStakingTotalsById(poolIds); + } + + /** + * @inheritdoc IRewardPool + */ + function getManyStakingTotalsById( + address[] calldata poolIds + ) external view override returns (uint256[] memory stakingAmounts_) { + return _getManyStakingTotalsById(poolIds); + } + + function _getManyStakingTotalsById( + address[] memory poolIds + ) internal view returns (uint256[] memory stakingAmounts_) { + stakingAmounts_ = new uint256[](poolIds.length); + for (uint i = 0; i < poolIds.length; ) { + stakingAmounts_[i] = _getStakingTotal(poolIds[i]); unchecked { - ++_i; + ++i; } } } + function _getStakingTotal(address poolId) internal view override returns (uint256) { + return _poolDetail[poolId].stakingTotal; + } + /** * @inheritdoc IRewardPool */ - function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) { - return _stakingPool[_poolAddr].delegatingAmount[_user]; + function getStakingAmount(TConsensus consensusAddr, address user) external view override returns (uint256) { + address poolId = __css2cid(consensusAddr); + return _getStakingAmount(poolId, user); } /** * @inheritdoc IRewardPool */ function getManyStakingAmounts( - address[] calldata _poolAddrs, - address[] calldata _userList - ) external view override returns (uint256[] memory _stakingAmounts) { - if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays(); - _stakingAmounts = new uint256[](_poolAddrs.length); - for (uint _i = 0; _i < _stakingAmounts.length; ) { - _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]]; + TConsensus[] calldata consensusAddrs, + address[] calldata userList + ) external view override returns (uint256[] memory stakingAmounts) { + address[] memory poolIds = __css2cidBatch(consensusAddrs); + return _getManyStakingAmountsById(poolIds, userList); + } + + function getManyStakingAmountsById( + address[] calldata poolIds, + address[] calldata userList + ) external view returns (uint256[] memory stakingAmounts) { + return _getManyStakingAmountsById(poolIds, userList); + } + + function _getManyStakingAmountsById( + address[] memory poolIds, + address[] memory userList + ) internal view returns (uint256[] memory stakingAmounts) { + if (poolIds.length != userList.length) revert ErrInvalidArrays(); + stakingAmounts = new uint256[](poolIds.length); + for (uint i = 0; i < stakingAmounts.length; ) { + stakingAmounts[i] = _getStakingAmount(poolIds[i], userList[i]); unchecked { - ++_i; + ++i; } } } + function _getStakingAmount(address poolId, address user) internal view override returns (uint256) { + return _poolDetail[poolId].delegatingAmount[user]; + } + + function __css2cid(TConsensus consensusAddr) internal view returns (address) { + return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr); + } + + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view returns (address[] memory) { + return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs); + } + /** * @inheritdoc IBaseStaking */ @@ -175,15 +256,15 @@ abstract contract BaseStaking is /** * @inheritdoc IBaseStaking */ - function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin { - _setCooldownSecsToUndelegate(_cooldownSecs); + function setCooldownSecsToUndelegate(uint256 cooldownSecs) external override onlyAdmin { + _setCooldownSecsToUndelegate(cooldownSecs); } /** * @inheritdoc IBaseStaking */ - function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin { - _setWaitingSecsToRevoke(_secs); + function setWaitingSecsToRevoke(uint256 secs) external override onlyAdmin { + _setWaitingSecsToRevoke(secs); } /** @@ -192,9 +273,9 @@ abstract contract BaseStaking is * Emits the event `CooldownSecsToUndelegateUpdated`. * */ - function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal { - _cooldownSecsToUndelegate = _cooldownSecs; - emit CooldownSecsToUndelegateUpdated(_cooldownSecs); + function _setCooldownSecsToUndelegate(uint256 cooldownSecs) internal { + _cooldownSecsToUndelegate = cooldownSecs; + emit CooldownSecsToUndelegateUpdated(cooldownSecs); } /** @@ -203,9 +284,9 @@ abstract contract BaseStaking is * Emits the event `WaitingSecsToRevokeUpdated`. * */ - function _setWaitingSecsToRevoke(uint256 _secs) internal { - _waitingSecsToRevoke = _secs; - emit WaitingSecsToRevokeUpdated(_secs); + function _setWaitingSecsToRevoke(uint256 secs) internal { + _waitingSecsToRevoke = secs; + emit WaitingSecsToRevokeUpdated(secs); } /** @@ -213,12 +294,12 @@ abstract contract BaseStaking is */ function _changeDelegatingAmount( PoolDetail storage _pool, - address _delegator, - uint256 _newDelegatingAmount, - uint256 _newStakingTotal + address delegator, + uint256 newDelegatingAmount, + uint256 newStakingTotal ) internal { - _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount); - _pool.stakingTotal = _newStakingTotal; - _pool.delegatingAmount[_delegator] = _newDelegatingAmount; + _syncUserReward(_pool.pid, delegator, newDelegatingAmount); + _pool.stakingTotal = newStakingTotal; + _pool.delegatingAmount[delegator] = newDelegatingAmount; } } diff --git a/contracts/ronin/staking/CandidateStaking.sol b/contracts/ronin/staking/CandidateStaking.sol index dd872d32a..4ace3cf83 100644 --- a/contracts/ronin/staking/CandidateStaking.sol +++ b/contracts/ronin/staking/CandidateStaking.sol @@ -6,6 +6,7 @@ import "../../extensions/consumers/GlobalConfigConsumer.sol"; import "../../extensions/consumers/PercentageConsumer.sol"; import "../../libraries/AddressArrayUtils.sol"; import "../../interfaces/staking/ICandidateStaking.sol"; +import "../../interfaces/IProfile.sol"; import "./BaseStaking.sol"; abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer { @@ -40,62 +41,71 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf /** * @inheritdoc ICandidateStaking */ - function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin { - _setMinValidatorStakingAmount(_threshold); + function setMinValidatorStakingAmount(uint256 threshold) external override onlyAdmin { + _setMinValidatorStakingAmount(threshold); } /** * @inheritdoc ICandidateStaking */ - function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin { - _setCommissionRateRange(_minRate, _maxRate); + function setCommissionRateRange(uint256 minRate, uint256 maxRate) external override onlyAdmin { + _setCommissionRateRange(minRate, maxRate); } /** * @inheritdoc ICandidateStaking */ function applyValidatorCandidate( - address _candidateAdmin, - address _consensusAddr, - address payable _treasuryAddr, - uint256 _commissionRate + address candidateAdmin, + TConsensus consensusAddr, + address payable treasuryAddr, + uint256 commissionRate, + bytes calldata pubkey ) external payable override nonReentrant { if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender); - if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate(); + if (commissionRate > _maxCommissionRate || commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate(); + + uint256 amount = msg.value; + address payable poolAdmin = payable(msg.sender); + address poolId = TConsensus.unwrap(consensusAddr); - uint256 _amount = msg.value; - address payable _poolAdmin = payable(msg.sender); _applyValidatorCandidate({ - _poolAdmin: _poolAdmin, - _candidateAdmin: _candidateAdmin, - _consensusAddr: _consensusAddr, - _treasuryAddr: _treasuryAddr, - _commissionRate: _commissionRate, - _amount: _amount + poolAdmin: poolAdmin, + candidateAdmin: candidateAdmin, + poolId: poolId, + treasuryAddr: treasuryAddr, + pubkey: pubkey, + commissionRate: commissionRate, + amount: amount }); - PoolDetail storage _pool = _stakingPool[_consensusAddr]; - _pool.admin = _poolAdmin; - _pool.addr = _consensusAddr; - _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr; + PoolDetail storage _pool = _poolDetail[poolId]; + _pool.__shadowedPoolAdmin = poolAdmin; + _pool.pid = poolId; + _adminOfActivePoolMapping[poolAdmin] = poolId; - _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount); - emit PoolApproved(_consensusAddr, _poolAdmin); + _stake(_poolDetail[poolId], poolAdmin, amount); + emit PoolApproved(poolId, poolAdmin); } /** * @inheritdoc ICandidateStaking */ function requestUpdateCommissionRate( - address _consensusAddr, - uint256 _effectiveDaysOnwards, - uint256 _commissionRate - ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) { - if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate(); + TConsensus consensusAddr, + uint256 effectiveDaysOnwards, + uint256 commissionRate + ) + external + override + poolOfConsensusIsActive(consensusAddr) + onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender) + { + if (commissionRate > _maxCommissionRate || commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate(); IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestUpdateCommissionRate( - _consensusAddr, - _effectiveDaysOnwards, - _commissionRate + __css2cid(consensusAddr), + effectiveDaysOnwards, + commissionRate ); } @@ -103,73 +113,88 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf * @inheritdoc ICandidateStaking */ function execDeprecatePools( - address[] calldata _pools, - uint256 _newPeriod + address[] calldata poolIds, + uint256 newPeriod ) external override onlyContract(ContractType.VALIDATOR) { - if (_pools.length == 0) { + if (poolIds.length == 0) { return; } - for (uint _i = 0; _i < _pools.length; ) { - PoolDetail storage _pool = _stakingPool[_pools[_i]]; + for (uint i = 0; i < poolIds.length; ) { + address poolId = poolIds[i]; + PoolDetail storage _pool = _poolDetail[poolId]; // Deactivate the pool admin in the active mapping. - delete _adminOfActivePoolMapping[_pool.admin]; + delete _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin]; // Deduct and transfer the self staking amount to the pool admin. - uint256 _deductingAmount = _pool.stakingAmount; - if (_deductingAmount > 0) { - _deductStakingAmount(_pool, _deductingAmount); - if (!_unsafeSendRONLimitGas(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) { - emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance); + uint256 deductingAmount = _pool.stakingAmount; + if (deductingAmount > 0) { + _deductStakingAmount(_pool, deductingAmount); + if (!_unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), deductingAmount, DEFAULT_ADDITION_GAS)) { + emit StakingAmountTransferFailed( + _pool.pid, + _pool.__shadowedPoolAdmin, + deductingAmount, + address(this).balance + ); } } // Settle the unclaimed reward and transfer to the pool admin. - uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod); - if (_lastRewardAmount > 0) { - _unsafeSendRONLimitGas(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS); + uint256 lastRewardAmount = _claimReward(poolId, _pool.__shadowedPoolAdmin, newPeriod); + if (lastRewardAmount > 0) { + _unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), lastRewardAmount, DEFAULT_ADDITION_GAS); } unchecked { - ++_i; + ++i; } } - emit PoolsDeprecated(_pools); + emit PoolsDeprecated(poolIds); } /** * @inheritdoc ICandidateStaking */ - function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) { - _stake(_stakingPool[_consensusAddr], msg.sender, msg.value); + function stake( + TConsensus consensusAddr + ) external payable override noEmptyValue poolOfConsensusIsActive(consensusAddr) { + address poolId = __css2cid(consensusAddr); + _stake(_poolDetail[poolId], msg.sender, msg.value); } /** * @inheritdoc ICandidateStaking */ function unstake( - address _consensusAddr, - uint256 _amount - ) external override nonReentrant poolIsActive(_consensusAddr) { - if (_amount == 0) revert ErrUnstakeZeroAmount(); - address _requester = msg.sender; - PoolDetail storage _pool = _stakingPool[_consensusAddr]; - uint256 _remainAmount = _pool.stakingAmount - _amount; - if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft(); - - _unstake(_pool, _requester, _amount); - if (!_unsafeSendRONLimitGas(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON(); + TConsensus consensusAddr, + uint256 amount + ) external override nonReentrant poolOfConsensusIsActive(consensusAddr) { + if (amount == 0) revert ErrUnstakeZeroAmount(); + address requester = msg.sender; + address poolId = __css2cid(consensusAddr); + PoolDetail storage _pool = _poolDetail[poolId]; + uint256 remainAmount = _pool.stakingAmount - amount; + if (remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft(); + + _unstake(_pool, requester, amount); + if (!_unsafeSendRONLimitGas(payable(requester), amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON(); } /** * @inheritdoc ICandidateStaking */ function requestRenounce( - address _consensusAddr - ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) { + TConsensus consensusAddr + ) + external + override + poolOfConsensusIsActive(consensusAddr) + onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender) + { IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestRenounceCandidate( - _consensusAddr, + __css2cid(consensusAddr), _waitingSecsToRevoke ); } @@ -178,42 +203,56 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf * @inheritdoc ICandidateStaking */ function requestEmergencyExit( - address _consensusAddr - ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) { - IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execEmergencyExit(_consensusAddr, _waitingSecsToRevoke); + TConsensus consensusAddr + ) + external + override + poolOfConsensusIsActive(consensusAddr) + onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender) + { + IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestEmergencyExit( + __css2cid(consensusAddr), + _waitingSecsToRevoke + ); } /** * @dev See `ICandidateStaking-applyValidatorCandidate` */ function _applyValidatorCandidate( - address payable _poolAdmin, - address _candidateAdmin, - address _consensusAddr, - address payable _treasuryAddr, - uint256 _commissionRate, - uint256 _amount + address payable poolAdmin, + address candidateAdmin, + address poolId, + address payable treasuryAddr, + bytes memory pubkey, + uint256 commissionRate, + uint256 amount ) internal { - if (!_unsafeSendRONLimitGas(_poolAdmin, 0, DEFAULT_ADDITION_GAS)) - revert ErrCannotInitTransferRON(_poolAdmin, "pool admin"); - if (!_unsafeSendRONLimitGas(_treasuryAddr, 0, DEFAULT_ADDITION_GAS)) - revert ErrCannotInitTransferRON(_treasuryAddr, "treasury"); - if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount(); - if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual(); + if (!_unsafeSendRONLimitGas(poolAdmin, 0, DEFAULT_ADDITION_GAS)) { + revert ErrCannotInitTransferRON(poolAdmin, "pool admin"); + } + if (!_unsafeSendRONLimitGas(treasuryAddr, 0, DEFAULT_ADDITION_GAS)) { + revert ErrCannotInitTransferRON(treasuryAddr, "treasury"); + } + if (amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount(); + if (poolAdmin != candidateAdmin || candidateAdmin != treasuryAddr) revert ErrThreeInteractionAddrsNotEqual(); { - address[] memory _diffAddrs = new address[](2); - _diffAddrs[0] = _poolAdmin; - _diffAddrs[1] = _consensusAddr; - if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert AddressArrayUtils.ErrDuplicated(msg.sig); + address[] memory diffAddrs = new address[](3); + diffAddrs[0] = poolAdmin; + diffAddrs[1] = poolId; + if (AddressArrayUtils.hasDuplicate(diffAddrs)) revert AddressArrayUtils.ErrDuplicated(msg.sig); } - IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate( - _candidateAdmin, - _consensusAddr, - _treasuryAddr, - _commissionRate - ); + IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate({ + candidateAdmin: candidateAdmin, + cid: poolId, + treasuryAddr: treasuryAddr, + commissionRate: commissionRate + }); + + IProfile profileContract = IProfile(getContract(ContractType.PROFILE)); + profileContract.execApplyValidatorCandidate(candidateAdmin, poolId, treasuryAddr, pubkey); } /** @@ -221,13 +260,13 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf */ function _stake( PoolDetail storage _pool, - address _requester, - uint256 _amount - ) internal onlyPoolAdmin(_pool, _requester) { - _pool.stakingAmount += _amount; - _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount); - _pool.lastDelegatingTimestamp[_requester] = block.timestamp; - emit Staked(_pool.addr, _amount); + address requester, + uint256 amount + ) internal onlyPoolAdmin(_pool, requester) { + _pool.stakingAmount += amount; + _changeDelegatingAmount(_pool, requester, _pool.stakingAmount, _pool.stakingTotal + amount); + _pool.lastDelegatingTimestamp[requester] = block.timestamp; + emit Staked(_pool.pid, amount); } /** @@ -235,17 +274,17 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf */ function _unstake( PoolDetail storage _pool, - address _requester, - uint256 _amount - ) internal onlyPoolAdmin(_pool, _requester) { - if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount(); - if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) { + address requester, + uint256 amount + ) internal onlyPoolAdmin(_pool, requester) { + if (amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount(); + if (_pool.lastDelegatingTimestamp[requester] + _cooldownSecsToUndelegate > block.timestamp) { revert ErrUnstakeTooEarly(); } - _pool.stakingAmount -= _amount; - _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount); - emit Unstaked(_pool.addr, _amount); + _pool.stakingAmount -= amount; + _changeDelegatingAmount(_pool, requester, _pool.stakingAmount, _pool.stakingTotal - amount); + emit Unstaked(_pool.pid, amount); } /** @@ -255,7 +294,7 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf * * @return The actual deducted amount */ - function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256); + function _deductStakingAmount(PoolDetail storage _pool, uint256 amount) internal virtual returns (uint256); /** * @dev Sets the minimum threshold for being a validator candidate. @@ -263,9 +302,9 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf * Emits the `MinValidatorStakingAmountUpdated` event. * */ - function _setMinValidatorStakingAmount(uint256 _threshold) internal { - _minValidatorStakingAmount = _threshold; - emit MinValidatorStakingAmountUpdated(_threshold); + function _setMinValidatorStakingAmount(uint256 threshold) internal { + _minValidatorStakingAmount = threshold; + emit MinValidatorStakingAmountUpdated(threshold); } /** @@ -274,10 +313,10 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf * Emits the `MaxCommissionRateUpdated` event. * */ - function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal { - if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate(); - _maxCommissionRate = _maxRate; - _minCommissionRate = _minRate; - emit CommissionRateRangeUpdated(_minRate, _maxRate); + function _setCommissionRateRange(uint256 minRate, uint256 maxRate) internal { + if (maxRate > _MAX_PERCENTAGE || minRate > maxRate) revert ErrInvalidCommissionRate(); + _maxCommissionRate = maxRate; + _minCommissionRate = minRate; + emit CommissionRateRangeUpdated(minRate, maxRate); } } diff --git a/contracts/ronin/staking/DelegatorStaking.sol b/contracts/ronin/staking/DelegatorStaking.sol index da64765fd..5a1bfebd6 100644 --- a/contracts/ronin/staking/DelegatorStaking.sol +++ b/contracts/ronin/staking/DelegatorStaking.sol @@ -15,92 +15,95 @@ abstract contract DelegatorStaking is BaseStaking, IDelegatorStaking { /** * @inheritdoc IDelegatorStaking */ - function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) { + function delegate(TConsensus consensusAddr) external payable noEmptyValue poolOfConsensusIsActive(consensusAddr) { if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender); - _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value); + _delegate(_poolDetail[__css2cid(consensusAddr)], msg.sender, msg.value); } /** * @inheritdoc IDelegatorStaking */ - function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant { - address payable _delegator = payable(msg.sender); - _undelegate(_stakingPool[_consensusAddr], _delegator, _amount); - if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON(); + function undelegate(TConsensus consensusAddr, uint256 amount) external nonReentrant { + address payable delegator = payable(msg.sender); + _undelegate(consensusAddr, _poolDetail[__css2cid(consensusAddr)], delegator, amount); + if (!_sendRON(delegator, amount)) revert ErrCannotTransferRON(); } /** * @inheritdoc IDelegatorStaking */ - function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant { - if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays(); + function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external nonReentrant { + if (consensusAddrs.length == 0 || consensusAddrs.length != amounts.length) revert ErrInvalidArrays(); - address payable _delegator = payable(msg.sender); - uint256 _total; + address payable delegator = payable(msg.sender); + uint256 total; - for (uint _i = 0; _i < _consensusAddrs.length; ) { - _total += _amounts[_i]; - _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]); + address[] memory poolIds = __css2cidBatch(consensusAddrs); + for (uint i = 0; i < poolIds.length; ) { + total += amounts[i]; + _undelegate(consensusAddrs[i], _poolDetail[poolIds[i]], delegator, amounts[i]); unchecked { - ++_i; + ++i; } } - if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON(); + if (!_sendRON(delegator, total)) revert ErrCannotTransferRON(); } /** * @inheritdoc IDelegatorStaking */ function redelegate( - address _consensusAddrSrc, - address _consensusAddrDst, - uint256 _amount - ) external nonReentrant poolIsActive(_consensusAddrDst) { - address _delegator = msg.sender; - _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount); - _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount); + TConsensus consensusAddrSrc, + TConsensus consensusAddrDst, + uint256 amount + ) external nonReentrant poolOfConsensusIsActive(consensusAddrDst) { + address delegator = msg.sender; + _undelegate(consensusAddrSrc, _poolDetail[__css2cid(consensusAddrSrc)], delegator, amount); + _delegate(_poolDetail[__css2cid(consensusAddrDst)], delegator, amount); } /** * @inheritdoc IDelegatorStaking */ function claimRewards( - address[] calldata _consensusAddrList - ) external override nonReentrant returns (uint256 _amount) { - _amount = _claimRewards(msg.sender, _consensusAddrList); - _transferRON(payable(msg.sender), _amount); + TConsensus[] calldata consensusAddrList + ) external override nonReentrant returns (uint256 amount) { + amount = _claimRewards(msg.sender, __css2cidBatch(consensusAddrList)); + _transferRON(payable(msg.sender), amount); } /** * @inheritdoc IDelegatorStaking */ function delegateRewards( - address[] calldata _consensusAddrList, - address _consensusAddrDst - ) external override nonReentrant poolIsActive(_consensusAddrDst) returns (uint256 _amount) { + TConsensus[] calldata consensusAddrList, + TConsensus consensusAddrDst + ) external override nonReentrant poolOfConsensusIsActive(consensusAddrDst) returns (uint256 amount) { if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender); - return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst); + address[] memory poolIds = __css2cidBatch(consensusAddrList); + address poolIdDst = __css2cid(consensusAddrDst); + return _delegateRewards(msg.sender, poolIds, poolIdDst); } /** * @inheritdoc IDelegatorStaking */ function getRewards( - address _user, - address[] calldata _poolAddrList - ) external view returns (uint256[] memory _rewards) { - address _consensusAddr; - uint256 _period = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod(); - _rewards = new uint256[](_poolAddrList.length); + address user, + TConsensus[] calldata consensusAddrs + ) external view returns (uint256[] memory rewards_) { + uint256 period = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod(); + rewards_ = new uint256[](consensusAddrs.length); - for (uint256 _i = 0; _i < _poolAddrList.length; ) { - _consensusAddr = _poolAddrList[_i]; - _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user)); + address[] memory poolIds = __css2cidBatch(consensusAddrs); + for (uint256 i = 0; i < consensusAddrs.length; ) { + address poolId = poolIds[i]; + rewards_[i] = _getReward(poolId, user, period, _getStakingAmount(poolId, user)); unchecked { - ++_i; + ++i; } } } @@ -118,17 +121,12 @@ abstract contract DelegatorStaking is BaseStaking, IDelegatorStaking { */ function _delegate( PoolDetail storage _pool, - address _delegator, - uint256 _amount - ) internal anyExceptPoolAdmin(_pool, _delegator) { - _changeDelegatingAmount( - _pool, - _delegator, - _pool.delegatingAmount[_delegator] + _amount, - _pool.stakingTotal + _amount - ); - _pool.lastDelegatingTimestamp[_delegator] = block.timestamp; - emit Delegated(_delegator, _pool.addr, _amount); + address delegator, + uint256 amount + ) internal anyExceptPoolAdmin(_pool, delegator) { + _changeDelegatingAmount(_pool, delegator, _pool.delegatingAmount[delegator] + amount, _pool.stakingTotal + amount); + _pool.lastDelegatingTimestamp[delegator] = block.timestamp; + emit Delegated(delegator, _pool.pid, amount); } /** @@ -145,40 +143,36 @@ abstract contract DelegatorStaking is BaseStaking, IDelegatorStaking { * */ function _undelegate( + TConsensus consensusAddr, PoolDetail storage _pool, - address _delegator, - uint256 _amount - ) private anyExceptPoolAdmin(_pool, _delegator) { - if (_amount == 0) revert ErrUndelegateZeroAmount(); - if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount(); + address delegator, + uint256 amount + ) private anyExceptPoolAdmin(_pool, delegator) { + if (amount == 0) revert ErrUndelegateZeroAmount(); + if (_pool.delegatingAmount[delegator] < amount) revert ErrInsufficientDelegatingAmount(); - IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); + IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR)); if ( - _validatorContract.isValidatorCandidate(_pool.addr) && - _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation - _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown + validatorContract.isValidatorCandidate(consensusAddr) && + validatorContract.getCandidateInfo(consensusAddr).revokingTimestamp == 0 && // if candidate is not on renunciation + _pool.lastDelegatingTimestamp[delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown ) revert ErrUndelegateTooEarly(); - _changeDelegatingAmount( - _pool, - _delegator, - _pool.delegatingAmount[_delegator] - _amount, - _pool.stakingTotal - _amount - ); - emit Undelegated(_delegator, _pool.addr, _amount); + _changeDelegatingAmount(_pool, delegator, _pool.delegatingAmount[delegator] - amount, _pool.stakingTotal - amount); + emit Undelegated(delegator, _pool.pid, amount); } /** * @dev Claims rewards from the pools `_poolAddrList`. * Note: This function does not transfer reward to user. */ - function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) { - uint256 _period = _currentPeriod(); - for (uint256 _i = 0; _i < _poolAddrList.length; ) { - _amount += _claimReward(_poolAddrList[_i], _user, _period); + function _claimRewards(address user, address[] memory poolIds) internal returns (uint256 amount) { + uint256 period = _currentPeriod(); + for (uint256 i = 0; i < poolIds.length; ) { + amount += _claimReward(poolIds[i], user, period); unchecked { - ++_i; + ++i; } } } @@ -187,11 +181,11 @@ abstract contract DelegatorStaking is BaseStaking, IDelegatorStaking { * @dev Claims the rewards and delegates them to the consensus address. */ function _delegateRewards( - address _user, - address[] calldata _poolAddrList, - address _poolAddrDst - ) internal returns (uint256 _amount) { - _amount = _claimRewards(_user, _poolAddrList); - _delegate(_stakingPool[_poolAddrDst], _user, _amount); + address user, + address[] memory poolIds, + address poolIdDst + ) internal returns (uint256 amount) { + amount = _claimRewards(user, poolIds); + _delegate(_poolDetail[poolIdDst], user, amount); } } diff --git a/contracts/ronin/staking/RewardCalculation.sol b/contracts/ronin/staking/RewardCalculation.sol index 2300b813b..44cb1f4ad 100644 --- a/contracts/ronin/staking/RewardCalculation.sol +++ b/contracts/ronin/staking/RewardCalculation.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.9; import "../../interfaces/staking/IRewardPool.sol"; import "../../libraries/Math.sol"; +import { TPoolId } from "../../udvts/Types.sol"; /** * @title RewardCalculation contract @@ -26,51 +27,52 @@ abstract contract RewardCalculation is IRewardPool { /** * @inheritdoc IRewardPool */ - function getReward(address _poolAddr, address _user) external view returns (uint256) { - return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user)); + function getReward(TConsensus consensusAddr, address user) external view returns (uint256) { + address poolId = TConsensus.unwrap(consensusAddr); + return _getReward(poolId, user, _currentPeriod(), _getStakingAmount(poolId, user)); } /** - * @inheritdoc IRewardPool + * @dev See {IRewardPool-getStakingAmount} */ - function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256); + function _getStakingAmount(address poolId, address user) internal view virtual returns (uint256); /** - * @inheritdoc IRewardPool + * @dev See {IRewardPool-getStakingTotal} */ - function getStakingTotal(address _poolAddr) public view virtual returns (uint256); + function _getStakingTotal(address poolId) internal view virtual returns (uint256); /** * @dev Returns the reward amount that user claimable. */ function _getReward( - address _poolAddr, - address _user, - uint256 _latestPeriod, - uint256 _latestStakingAmount + address poolId, + address user, + uint256 latestPeriod, + uint256 latestStakingAmount ) internal view returns (uint256) { - UserRewardFields storage _reward = _userReward[_poolAddr][_user]; + UserRewardFields storage _reward = _userReward[poolId][user]; - if (_reward.lastPeriod == _latestPeriod) { + if (_reward.lastPeriod == latestPeriod) { return _reward.debited; } - uint256 _aRps; - uint256 _lastPeriodReward; - PoolFields storage _pool = _stakingPool[_poolAddr]; - PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod]; + uint256 aRps; + uint256 lastPeriodReward; + PoolFields storage _pool = _stakingPool[poolId]; + PeriodWrapper storage _wrappedArps = _accumulatedRps[poolId][_reward.lastPeriod]; if (_wrappedArps.lastPeriod > 0) { // Calculates the last period reward if the aRps at the period is set - _aRps = _wrappedArps.inner; - _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps); + aRps = _wrappedArps.inner; + lastPeriodReward = _reward.lowestAmount * (aRps - _reward.aRps); } else { // Fallbacks to the previous aRps in case the aRps is not set - _aRps = _reward.aRps; + aRps = _reward.aRps; } - uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps); - return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18; + uint256 newPeriodsReward = latestStakingAmount * (_pool.aRps - aRps); + return _reward.debited + (lastPeriodReward + newPeriodsReward) / 1e18; } /** @@ -82,31 +84,31 @@ abstract contract RewardCalculation is IRewardPool { * Note: The method should be called whenever the user's staking amount changes. * */ - function _syncUserReward(address _poolAddr, address _user, uint256 _newStakingAmount) internal { - uint256 _period = _currentPeriod(); - PoolFields storage _pool = _stakingPool[_poolAddr]; - uint256 _lastShares = _pool.shares.inner; + function _syncUserReward(address poolId, address user, uint256 newStakingAmount) internal { + uint256 period = _currentPeriod(); + PoolFields storage _pool = _stakingPool[poolId]; + uint256 lastShares = _pool.shares.inner; // Updates the pool shares if it is outdated - if (_pool.shares.lastPeriod < _period) { - _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period); + if (_pool.shares.lastPeriod < period) { + _pool.shares = PeriodWrapper(_getStakingTotal(poolId), period); } - UserRewardFields storage _reward = _userReward[_poolAddr][_user]; - uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user); - uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount); + UserRewardFields storage _reward = _userReward[poolId][user]; + uint256 currentStakingAmount = _getStakingAmount(poolId, user); + uint256 debited = _getReward(poolId, user, period, currentStakingAmount); - if (_reward.debited != _debited) { - _reward.debited = _debited; - emit UserRewardUpdated(_poolAddr, _user, _debited); + if (_reward.debited != debited) { + _reward.debited = debited; + emit UserRewardUpdated(poolId, user, debited); } - _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount); + _syncMinStakingAmount(_pool, _reward, period, newStakingAmount, currentStakingAmount); _reward.aRps = _pool.aRps; - _reward.lastPeriod = _period; + _reward.lastPeriod = period; - if (_pool.shares.inner != _lastShares) { - emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner); + if (_pool.shares.inner != lastShares) { + emit PoolSharesUpdated(period, poolId, _pool.shares.inner); } } @@ -116,27 +118,27 @@ abstract contract RewardCalculation is IRewardPool { function _syncMinStakingAmount( PoolFields storage _pool, UserRewardFields storage _reward, - uint256 _latestPeriod, - uint256 _newStakingAmount, - uint256 _currentStakingAmount + uint256 latestPeriod, + uint256 newStakingAmount, + uint256 currentStakingAmount ) internal { - if (_reward.lastPeriod < _latestPeriod) { - _reward.lowestAmount = _currentStakingAmount; + if (_reward.lastPeriod < latestPeriod) { + _reward.lowestAmount = currentStakingAmount; } - uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount); - uint256 _diffAmount = _reward.lowestAmount - _lowestAmount; - if (_diffAmount > 0) { - _reward.lowestAmount = _lowestAmount; - if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare(); - _pool.shares.inner -= _diffAmount; + uint256 lowestAmount = Math.min(_reward.lowestAmount, newStakingAmount); + uint256 diffAmount = _reward.lowestAmount - lowestAmount; + if (diffAmount > 0) { + _reward.lowestAmount = lowestAmount; + if (_pool.shares.inner < diffAmount) revert ErrInvalidPoolShare(); + _pool.shares.inner -= diffAmount; } } /** * @dev Claims the settled reward for a specific user. * - * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or + * @param lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or * `_currentPeriod + 1` in case of calculating the reward for revoked validators. * * Emits the `RewardClaimed` event and the `UserRewardUpdated` event. @@ -144,21 +146,21 @@ abstract contract RewardCalculation is IRewardPool { * Note: This method should be called before transferring rewards for the user. * */ - function _claimReward(address _poolAddr, address _user, uint256 _lastPeriod) internal returns (uint256 _amount) { - uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user); - _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount); - emit RewardClaimed(_poolAddr, _user, _amount); + function _claimReward(address poolId, address user, uint256 lastPeriod) internal returns (uint256 amount) { + uint256 currentStakingAmount = _getStakingAmount(poolId, user); + amount = _getReward(poolId, user, lastPeriod, currentStakingAmount); + emit RewardClaimed(poolId, user, amount); - UserRewardFields storage _reward = _userReward[_poolAddr][_user]; + UserRewardFields storage _reward = _userReward[poolId][user]; _reward.debited = 0; - _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount); - _reward.lastPeriod = _lastPeriod; - _reward.aRps = _stakingPool[_poolAddr].aRps; - emit UserRewardUpdated(_poolAddr, _user, 0); + _syncMinStakingAmount(_stakingPool[poolId], _reward, lastPeriod, currentStakingAmount, currentStakingAmount); + _reward.lastPeriod = lastPeriod; + _reward.aRps = _stakingPool[poolId].aRps; + emit UserRewardUpdated(poolId, user, 0); } /** - * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`. + * @dev Records the amount of rewards `_rewards` for the pools `poolIds`. * * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. @@ -167,56 +169,56 @@ abstract contract RewardCalculation is IRewardPool { * Note: This method should be called once at the period ending. * */ - function _recordRewards(address[] memory _poolAddrs, uint256[] calldata _rewards, uint256 _period) internal { - if (_poolAddrs.length != _rewards.length) { - emit PoolsUpdateFailed(_period, _poolAddrs, _rewards); + function _recordRewards(address[] memory poolIds, uint256[] calldata rewards, uint256 period) internal { + if (poolIds.length != rewards.length) { + emit PoolsUpdateFailed(period, poolIds, rewards); return; } - uint256 _rps; - uint256 _count; - address _poolAddr; - uint256 _stakingTotal; - uint256[] memory _aRps = new uint256[](_poolAddrs.length); - uint256[] memory _shares = new uint256[](_poolAddrs.length); - address[] memory _conflicted = new address[](_poolAddrs.length); + uint256 rps; + uint256 count; + address poolId; + uint256 stakingTotal; + uint256[] memory aRps = new uint256[](poolIds.length); + uint256[] memory shares = new uint256[](poolIds.length); + address[] memory conflicted = new address[](poolIds.length); - for (uint _i = 0; _i < _poolAddrs.length; _i++) { - _poolAddr = _poolAddrs[_i]; - PoolFields storage _pool = _stakingPool[_poolAddr]; - _stakingTotal = getStakingTotal(_poolAddr); + for (uint i = 0; i < poolIds.length; i++) { + poolId = poolIds[i]; + PoolFields storage _pool = _stakingPool[poolId]; + stakingTotal = _getStakingTotal(poolId); - if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) { + if (_accumulatedRps[poolId][period].lastPeriod == period) { unchecked { - _conflicted[_count++] = _poolAddr; + conflicted[count++] = poolId; } continue; } // Updates the pool shares if it is outdated - if (_pool.shares.lastPeriod < _period) { - _pool.shares = PeriodWrapper(_stakingTotal, _period); + if (_pool.shares.lastPeriod < period) { + _pool.shares = PeriodWrapper(stakingTotal, period); } // The rps is 0 if no one stakes for the pool - _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner; - _aRps[_i - _count] = _pool.aRps += _rps; - _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period); - _pool.shares.inner = _stakingTotal; - _shares[_i - _count] = _pool.shares.inner; - _poolAddrs[_i - _count] = _poolAddr; + rps = _pool.shares.inner == 0 ? 0 : (rewards[i] * 1e18) / _pool.shares.inner; + aRps[i - count] = _pool.aRps += rps; + _accumulatedRps[poolId][period] = PeriodWrapper(_pool.aRps, period); + _pool.shares.inner = stakingTotal; + shares[i - count] = _pool.shares.inner; + poolIds[i - count] = poolId; } - if (_count > 0) { + if (count > 0) { assembly { - mstore(_conflicted, _count) - mstore(_poolAddrs, sub(mload(_poolAddrs), _count)) + mstore(conflicted, count) + mstore(poolIds, sub(mload(poolIds), count)) } - emit PoolsUpdateConflicted(_period, _conflicted); + emit PoolsUpdateConflicted(period, conflicted); } - if (_poolAddrs.length > 0) { - emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares); + if (poolIds.length > 0) { + emit PoolsUpdated(period, poolIds, aRps, shares); } } diff --git a/contracts/ronin/staking/Staking.sol b/contracts/ronin/staking/Staking.sol index 1fe1ddcd6..ecb98840c 100644 --- a/contracts/ronin/staking/Staking.sol +++ b/contracts/ronin/staking/Staking.sol @@ -6,10 +6,9 @@ import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../../libraries/Math.sol"; import "../../interfaces/staking/IStaking.sol"; import "../../interfaces/validator/IRoninValidatorSet.sol"; -import "./CandidateStaking.sol"; -import "./DelegatorStaking.sol"; +import "./StakingCallback.sol"; -contract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable { +contract Staking is IStaking, StakingCallback, Initializable { constructor() { _disableInitializers(); } @@ -35,59 +34,43 @@ contract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable _setWaitingSecsToRevoke(__waitingSecsToRevoke); } + /** + * @dev Initializes the contract storage V2. + */ function initializeV2() external reinitializer(2) { _setContract(ContractType.VALIDATOR, ______deprecatedValidator); delete ______deprecatedValidator; } /** - * @dev This method only work on testnet, to hotfix the applied validator candidate that is failed. - * TODO: Should remove this method before deploying it on mainnet. + * @dev Initializes the contract storage V3. */ - function tmp_re_applyValidatorCandidate( - address _candidateAdmin, - address _consensusAddr, - address payable _treasuryAddr, - uint256 _commissionRate - ) external { - require(block.chainid == 2021, "E1"); - require(msg.sender == 0x57832A94810E18c84a5A5E2c4dD67D012ade574F, "E2"); - - IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate( - _candidateAdmin, - _consensusAddr, - _treasuryAddr, - _commissionRate - ); + function initializeV3(address __profileContract) external reinitializer(3) { + _setContract(ContractType.PROFILE, __profileContract); } /** * @inheritdoc IStaking */ function execRecordRewards( - address[] calldata _consensusAddrs, - uint256[] calldata _rewards, - uint256 _period + address[] calldata poolIds, + uint256[] calldata rewards, + uint256 period ) external payable override onlyContract(ContractType.VALIDATOR) { - _recordRewards(_consensusAddrs, _rewards, _period); + _recordRewards(poolIds, rewards, period); } /** * @inheritdoc IStaking */ function execDeductStakingAmount( - address _consensusAddr, - uint256 _amount - ) external override onlyContract(ContractType.VALIDATOR) returns (uint256 _actualDeductingAmount) { - _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount); - address payable _validatorContractAddr = payable(msg.sender); - if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) { - emit StakingAmountDeductFailed( - _consensusAddr, - _validatorContractAddr, - _actualDeductingAmount, - address(this).balance - ); + address poolId, + uint256 amount + ) external override onlyContract(ContractType.VALIDATOR) returns (uint256 actualDeductingAmount_) { + actualDeductingAmount_ = _deductStakingAmount(_poolDetail[poolId], amount); + address payable validatorContractAddr = payable(msg.sender); + if (!_unsafeSendRON(validatorContractAddr, actualDeductingAmount_)) { + emit StakingAmountDeductFailed(poolId, validatorContractAddr, actualDeductingAmount_, address(this).balance); } } @@ -103,17 +86,17 @@ contract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable */ function _deductStakingAmount( PoolDetail storage _pool, - uint256 _amount - ) internal override returns (uint256 _actualDeductingAmount) { - _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount); + uint256 amount + ) internal override returns (uint256 actualDeductingAmount_) { + actualDeductingAmount_ = Math.min(_pool.stakingAmount, amount); - _pool.stakingAmount -= _actualDeductingAmount; + _pool.stakingAmount -= actualDeductingAmount_; _changeDelegatingAmount( _pool, - _pool.admin, + _pool.__shadowedPoolAdmin, _pool.stakingAmount, - Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount) + Math.subNonNegative(_pool.stakingTotal, actualDeductingAmount_) ); - emit Unstaked(_pool.addr, _actualDeductingAmount); + emit Unstaked(_pool.pid, actualDeductingAmount_); } } diff --git a/contracts/ronin/staking/StakingCallback.sol b/contracts/ronin/staking/StakingCallback.sol new file mode 100644 index 000000000..a0359a732 --- /dev/null +++ b/contracts/ronin/staking/StakingCallback.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT + +import "../../interfaces/IProfile.sol"; +import "../../interfaces/staking/IStakingCallback.sol"; +import "./CandidateStaking.sol"; +import "./DelegatorStaking.sol"; + +pragma solidity ^0.8.9; + +abstract contract StakingCallback is CandidateStaking, DelegatorStaking, IStakingCallback { + /** + * @dev Requirements: + * - Only Profile contract can call this method. + */ + function execChangeAdminAddress( + address poolAddr, + address newAdminAddr + ) external override onlyContract(ContractType.PROFILE) { + PoolDetail storage _pool = _poolDetail[poolAddr]; + + _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin] = address(0); + _pool.__shadowedPoolAdmin = newAdminAddr; + _adminOfActivePoolMapping[newAdminAddr] = poolAddr; + } +} diff --git a/contracts/ronin/validator/CandidateManager.sol b/contracts/ronin/validator/CandidateManager.sol index a9a0a0dd3..95df269b2 100644 --- a/contracts/ronin/validator/CandidateManager.sol +++ b/contracts/ronin/validator/CandidateManager.sol @@ -7,6 +7,7 @@ import "../../extensions/consumers/GlobalConfigConsumer.sol"; import "../../extensions/consumers/PercentageConsumer.sol"; import "../../interfaces/validator/ICandidateManager.sol"; import "../../interfaces/staking/IStaking.sol"; +import "../../interfaces/IProfile.sol"; import { HasStakingDeprecated } from "../../utils/DeprecatedSlots.sol"; abstract contract CandidateManager is @@ -19,11 +20,11 @@ abstract contract CandidateManager is /// @dev Maximum number of validator candidate uint256 private _maxValidatorCandidate; - /// @dev The validator candidate array - address[] internal _candidates; - /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates` + /// @dev The array of candidate ids + address[] internal _candidateIds; + /// @dev Mapping from candidate id => bitwise negation of validator index in `_candidates` mapping(address => uint256) internal _candidateIndex; - /// @dev Mapping from candidate consensus address => their info + /// @dev Mapping from candidate id => their info mapping(address => ValidatorCandidate) internal _candidateInfo; /** @@ -31,7 +32,7 @@ abstract contract CandidateManager is * Value of 1 means the change gets affected at the beginning of the following day. **/ uint256 internal _minEffectiveDaysOnwards; - /// @dev Mapping from candidate consensus address => schedule commission change. + /// @dev Mapping from candidate consensus id => schedule commission change. mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule; /** @@ -71,91 +72,24 @@ abstract contract CandidateManager is /** * @inheritdoc ICandidateManager */ - function execApplyValidatorCandidate( - address _candidateAdmin, - address _consensusAddr, - address payable _treasuryAddr, - uint256 _commissionRate - ) external override onlyContract(ContractType.STAKING) { - uint256 _length = _candidates.length; - if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate(); - if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate(); - if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate(); - - for (uint _i; _i < _candidates.length; ) { - ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]]; - if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin); - if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr); - - unchecked { - ++_i; - } - } - - _candidateIndex[_consensusAddr] = ~_length; - _candidates.push(_consensusAddr); - - ValidatorCandidate storage _info = _candidateInfo[_consensusAddr]; - _info.admin = _candidateAdmin; - _info.consensusAddr = _consensusAddr; - _info.treasuryAddr = _treasuryAddr; - _info.commissionRate = _commissionRate; - emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin); - } - - /** - * @inheritdoc ICandidateManager - */ - function execRequestRenounceCandidate( - address _consensusAddr, - uint256 _secsLeft - ) external override onlyContract(ContractType.STAKING) { - if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce(); - - ValidatorCandidate storage _info = _candidateInfo[_consensusAddr]; - if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate(); - _setRevokingTimestamp(_info, block.timestamp + _secsLeft); - } - - /** - * @inheritdoc ICandidateManager - */ - function execRequestUpdateCommissionRate( - address _consensusAddr, - uint256 _effectiveDaysOnwards, - uint256 _commissionRate - ) external override onlyContract(ContractType.STAKING) { - if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) { - revert ErrAlreadyRequestedUpdatingCommissionRate(); - } - if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate(); - if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards(); - - CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr]; - uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION; - _schedule.effectiveTimestamp = _effectiveTimestamp; - _schedule.commissionRate = _commissionRate; - - emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate); + function isValidatorCandidate(TConsensus consensus) external view override returns (bool) { + return _isValidatorCandidateById(__css2cid(consensus)); } - /** - * @inheritdoc ICandidateManager - */ - function isValidatorCandidate(address _addr) public view override returns (bool) { - return _candidateIndex[_addr] != 0; + function _isValidatorCandidateById(address cid) internal view returns (bool) { + return _candidateIndex[cid] != 0; } /** * @inheritdoc ICandidateManager */ - function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) { - _list = new ValidatorCandidate[](_candidates.length); - for (uint _i; _i < _list.length; ) { - _list[_i] = _candidateInfo[_candidates[_i]]; + function getCandidateInfos() external view override returns (ValidatorCandidate[] memory list) { + list = new ValidatorCandidate[](_candidateIds.length); + for (uint i; i < list.length; ) { + list[i] = _candidateInfo[_candidateIds[i]]; unchecked { - ++_i; + ++i; } } } @@ -163,23 +97,26 @@ abstract contract CandidateManager is /** * @inheritdoc ICandidateManager */ - function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) { - if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate(); - return _candidateInfo[_candidate]; + function getCandidateInfo(TConsensus consensus) external view override returns (ValidatorCandidate memory) { + address validatorId = __css2cid(consensus); + if (!_isValidatorCandidateById(validatorId)) revert ErrNonExistentCandidate(); + return _candidateInfo[validatorId]; } /** * @inheritdoc ICandidateManager */ function getValidatorCandidates() public view override returns (address[] memory) { - return _candidates; + return _candidateIds; } /** * @inheritdoc ICandidateManager */ - function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) { - return _candidateCommissionChangeSchedule[_candidate]; + function getCommissionChangeSchedule( + TConsensus consensus + ) external view override returns (CommissionSchedule memory) { + return _candidateCommissionChangeSchedule[__css2cid(consensus)]; } /** @@ -193,19 +130,19 @@ abstract contract CandidateManager is IStaking _staking = IStaking(getContract(ContractType.STAKING)); uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke(); uint256 _minStakingAmount = _staking.minValidatorStakingAmount(); - uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates); + uint256[] memory _selfStakings = _staking.getManySelfStakingsById(_candidateIds); - uint256 _length = _candidates.length; + uint256 _length = _candidateIds.length; uint256 _unsatisfiedCount; _unsatisfiedCandidates = new address[](_length); { uint256 _i; - address _addr; + address cid; ValidatorCandidate storage _info; while (_i < _length) { - _addr = _candidates[_i]; - _info = _candidateInfo[_addr]; + cid = _candidateIds[_i]; + _info = _candidateInfo[cid]; // Checks for under-balance status of candidates bool _hasTopupDeadline = _info.topupDeadline != 0; @@ -214,34 +151,34 @@ abstract contract CandidateManager is if (!_hasTopupDeadline) { uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke; _info.topupDeadline = _topupDeadline; - emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline); + emit CandidateTopupDeadlineUpdated(cid, _topupDeadline); } } else if (_hasTopupDeadline) { // Removes the deadline if the staking amount condition is satisfied delete _info.topupDeadline; - emit CandidateTopupDeadlineUpdated(_addr, 0); + emit CandidateTopupDeadlineUpdated(cid, 0); } // Removes unsastisfied candidates bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) || - _emergencyExitLockedFundReleased(_addr); + _emergencyExitLockedFundReleased(cid); bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp; if (_revokingActivated || _topupDeadlineMissed) { _selfStakings[_i] = _selfStakings[--_length]; unchecked { - _unsatisfiedCandidates[_unsatisfiedCount++] = _addr; + _unsatisfiedCandidates[_unsatisfiedCount++] = cid; } - _removeCandidate(_addr); + _removeCandidate(cid); continue; } // Checks for schedule of commission change and updates commission rate - uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp; + uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[cid].effectiveTimestamp; if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) { - uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate; - delete _candidateCommissionChangeSchedule[_addr]; + uint256 _commisionRate = _candidateCommissionChangeSchedule[cid].commissionRate; + delete _candidateCommissionChangeSchedule[cid]; _info.commissionRate = _commisionRate; - emit CommissionRateUpdated(_addr, _commisionRate); + emit CommissionRateUpdated(cid, _commisionRate); } unchecked { @@ -263,8 +200,12 @@ abstract contract CandidateManager is /** * @inheritdoc ICandidateManager */ - function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) { - return _candidateInfo[_candidate].admin == _admin; + function isCandidateAdmin(TConsensus consensusAddr, address admin) external view override returns (bool) { + return _isCandidateAdminById(__css2cid(consensusAddr), admin); + } + + function _isCandidateAdminById(address candidateId, address admin) internal view returns (bool) { + return _candidateInfo[candidateId].__shadowedAdmin == admin; } /** @@ -294,8 +235,8 @@ abstract contract CandidateManager is * @dev Removes the candidate. */ function _removeCandidate(address _addr) internal virtual { - uint256 _idx = _candidateIndex[_addr]; - if (_idx == 0) { + uint256 idx = _candidateIndex[_addr]; + if (idx == 0) { return; } @@ -303,22 +244,23 @@ abstract contract CandidateManager is delete _candidateIndex[_addr]; delete _candidateCommissionChangeSchedule[_addr]; - address _lastCandidate = _candidates[_candidates.length - 1]; - if (_lastCandidate != _addr) { - _candidateIndex[_lastCandidate] = _idx; - _candidates[~_idx] = _lastCandidate; + address lastCid = _candidateIds[_candidateIds.length - 1]; + if (lastCid != _addr) { + _candidateIndex[lastCid] = idx; + _candidateIds[~idx] = lastCid; } - _candidates.pop(); + _candidateIds.pop(); } /** * @dev Sets timestamp to revoke a candidate. */ - function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal { - if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate(); - _candidate.revokingTimestamp = _timestamp; - emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp); + function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 timestamp) internal { + address cid = __css2cid(_candidate.__shadowedConsensus); + if (!_isValidatorCandidateById(cid)) revert ErrNonExistentCandidate(); + _candidate.revokingTimestamp = timestamp; + emit CandidateRevokingTimestampUpdated(cid, timestamp); } /** @@ -327,7 +269,13 @@ abstract contract CandidateManager is function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool); /** - * @dev Returns whether the consensus address is a trusted org or not. + * @dev Returns whether the validator id is a trusted org or not. */ - function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool); + function _isTrustedOrg(address validatorId) internal virtual returns (bool); + + /// @dev See {RoninValidatorSet-__css2cid} + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); + + /// @dev See {RoninValidatorSet-__css2cidBatch} + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory); } diff --git a/contracts/ronin/validator/CandidateManagerCallback.sol b/contracts/ronin/validator/CandidateManagerCallback.sol new file mode 100644 index 000000000..ce1646d01 --- /dev/null +++ b/contracts/ronin/validator/CandidateManagerCallback.sol @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.9; + +import "../../interfaces/validator/ICandidateManagerCallback.sol"; +import "./CandidateManager.sol"; + +abstract contract CandidateManagerCallback is ICandidateManagerCallback, CandidateManager { + // // + // ----------- Staking's Callbacks ----------- // + // // + + /** + * @inheritdoc ICandidateManagerCallback + */ + function execApplyValidatorCandidate( + address candidateAdmin, + address cid, + address payable treasuryAddr, + uint256 commissionRate + ) external override onlyContract(ContractType.STAKING) { + uint256 length = _candidateIds.length; + if (length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate(); + if (_isValidatorCandidateById(cid)) revert ErrExistentCandidate(); + if (commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate(); + + for (uint i; i < length; ) { + ValidatorCandidate storage existentInfo = _candidateInfo[_candidateIds[i]]; + if (candidateAdmin == existentInfo.__shadowedAdmin) revert ErrExistentCandidateAdmin(candidateAdmin); + if (treasuryAddr == existentInfo.__shadowedTreasury) revert ErrExistentTreasury(treasuryAddr); + + unchecked { + ++i; + } + } + + _candidateIndex[cid] = ~length; + _candidateIds.push(cid); + + ValidatorCandidate storage _info = _candidateInfo[cid]; + _info.__shadowedAdmin = candidateAdmin; + _info.__shadowedConsensus = TConsensus.wrap(cid); + _info.__shadowedTreasury = treasuryAddr; + _info.commissionRate = commissionRate; + emit CandidateGranted(cid, treasuryAddr, candidateAdmin); + } + + /** + * @inheritdoc ICandidateManagerCallback + */ + function execRequestRenounceCandidate( + address cid, + uint256 secsLeft + ) external override onlyContract(ContractType.STAKING) { + if (_isTrustedOrg(cid)) revert ErrTrustedOrgCannotRenounce(); + + ValidatorCandidate storage _info = _candidateInfo[cid]; + if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate(); + _setRevokingTimestamp(_info, block.timestamp + secsLeft); + } + + /** + * @inheritdoc ICandidateManagerCallback + */ + function execRequestUpdateCommissionRate( + address cid, + uint256 effectiveDaysOnwards, + uint256 commissionRate + ) external override onlyContract(ContractType.STAKING) { + if (_candidateCommissionChangeSchedule[cid].effectiveTimestamp != 0) { + revert ErrAlreadyRequestedUpdatingCommissionRate(); + } + if (commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate(); + if (effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards(); + + CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[cid]; + uint256 effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + effectiveDaysOnwards) * PERIOD_DURATION; + _schedule.effectiveTimestamp = effectiveTimestamp; + _schedule.commissionRate = commissionRate; + + emit CommissionRateUpdateScheduled(cid, effectiveTimestamp, commissionRate); + } + + // // + // ----------- Profile's Callbacks ----------- // + // // + + /** + * @inheritdoc ICandidateManagerCallback + */ + function execChangeConsensusAddress( + address cid, + TConsensus newConsensusAddr + ) external override onlyContract(ContractType.PROFILE) { + _candidateInfo[cid].__shadowedConsensus = newConsensusAddr; + } + + /** + * @inheritdoc ICandidateManagerCallback + */ + function execChangeAdminAddress(address cid, address newAdmin) external onlyContract(ContractType.PROFILE) { + _candidateInfo[cid].__shadowedAdmin = newAdmin; + } + + /** + * @inheritdoc ICandidateManagerCallback + */ + function execChangeTreasuryAddress( + address cid, + address payable newTreasury + ) external onlyContract(ContractType.PROFILE) { + _candidateInfo[cid].__shadowedTreasury = newTreasury; + } +} diff --git a/contracts/ronin/validator/CoinbaseExecution.sol b/contracts/ronin/validator/CoinbaseExecution.sol index 83bdf6c12..561a0a42e 100644 --- a/contracts/ronin/validator/CoinbaseExecution.sol +++ b/contracts/ronin/validator/CoinbaseExecution.sol @@ -4,10 +4,12 @@ pragma solidity ^0.8.9; import "../../extensions/collections/HasContracts.sol"; import "../../extensions/RONTransferHelper.sol"; +import "../../interfaces/IProfile.sol"; import "../../interfaces/IStakingVesting.sol"; import "../../interfaces/IMaintenance.sol"; import "../../interfaces/IRoninTrustedOrganization.sol"; import "../../interfaces/IFastFinalityTracking.sol"; +import "../../interfaces/staking/IStaking.sol"; import "../../interfaces/slash-indicator/ISlashIndicator.sol"; import "../../interfaces/validator/ICoinbaseExecution.sol"; import "../../libraries/EnumFlags.sol"; @@ -16,8 +18,8 @@ import { HasStakingVestingDeprecated, HasBridgeTrackingDeprecated, HasMaintenanc import "../../precompile-usages/PCUSortValidators.sol"; import "../../precompile-usages/PCUPickValidatorSet.sol"; import "./storage-fragments/CommonStorage.sol"; -import "./CandidateManager.sol"; import { EmergencyExit } from "./EmergencyExit.sol"; +import { TPoolId } from "../../udvts/Types.sol"; import { ErrCallerMustBeCoinbase } from "../../utils/CommonErrors.sol"; abstract contract CoinbaseExecution is @@ -58,9 +60,11 @@ abstract contract CoinbaseExecution is * @inheritdoc ICoinbaseExecution */ function submitBlockReward() external payable override onlyCoinbase { - bool requestForBlockProducer = isBlockProducer(msg.sender) && - !_jailed(msg.sender) && - !_miningRewardDeprecated(msg.sender, currentPeriod()); + address id = __css2cid(TConsensus.wrap(msg.sender)); + + bool requestForBlockProducer = _isBlockProducerById(id) && + !_isJailedById(id) && + !_miningRewardDeprecatedById(id, currentPeriod()); (, uint256 blockProducerBonus, , uint256 fastFinalityRewardPercentage) = IStakingVesting( getContract(ContractType.STAKING_VESTING) @@ -69,11 +73,11 @@ abstract contract CoinbaseExecution is // Deprecates reward for non-validator or slashed validator if (!requestForBlockProducer) { _totalDeprecatedReward += msg.value; - emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY); + emit BlockRewardDeprecated(id, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY); return; } - emit BlockRewardSubmitted(msg.sender, msg.value, blockProducerBonus); + emit BlockRewardSubmitted(id, msg.value, blockProducerBonus); uint256 period = currentPeriod(); uint256 reward = msg.value + blockProducerBonus; @@ -81,7 +85,7 @@ abstract contract CoinbaseExecution is uint256 rewardProducingBlock = reward - rewardFastFinality; // reward for producing blocks uint256 cutOffReward; - // Add fast finality reward to total reward for current epoch, then split it later in the {wrapupEpoch} method. + // Add fast finality reward to total reward for current epoch, then split it later in the {wrapUpEpoch} method. _totalFastFinalityReward += rewardFastFinality; if (_miningRewardBailoutCutOffAtPeriod[msg.sender][period]) { @@ -89,75 +93,74 @@ abstract contract CoinbaseExecution is .getCreditScoreConfigs(); cutOffReward = (rewardProducingBlock * cutOffPercentage) / _MAX_PERCENTAGE; _totalDeprecatedReward += cutOffReward; - emit BlockRewardDeprecated(msg.sender, cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT); + emit BlockRewardDeprecated(id, cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT); } rewardProducingBlock -= cutOffReward; (uint256 minRate, uint256 maxRate) = IStaking(getContract(ContractType.STAKING)).getCommissionRateRange(); - uint256 rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, maxRate), minRate); + uint256 rate = Math.max(Math.min(_candidateInfo[id].commissionRate, maxRate), minRate); uint256 miningAmount = (rate * rewardProducingBlock) / _MAX_PERCENTAGE; - _miningReward[msg.sender] += miningAmount; - - uint256 delegatingAmount = rewardProducingBlock - miningAmount; - _delegatingReward[msg.sender] += delegatingAmount; + _miningReward[id] += miningAmount; + _delegatingReward[id] += (rewardProducingBlock - miningAmount); } /** * @inheritdoc ICoinbaseExecution */ function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch { - uint256 _newPeriod = _computePeriod(block.timestamp); - bool _periodEnding = _isPeriodEnding(_newPeriod); + uint256 newPeriod = _computePeriod(block.timestamp); + bool periodEnding = _isPeriodEnding(newPeriod); - address[] memory _currentValidators = getValidators(); - address[] memory _revokedCandidates; - uint256 _epoch = epochOf(block.number); - uint256 _nextEpoch = _epoch + 1; - uint256 _lastPeriod = currentPeriod(); + address[] memory currValidatorIds = getValidators(); + address[] memory revokedCandidateIds; + uint256 epoch = epochOf(block.number); + uint256 nextEpoch = epoch + 1; + uint256 lastPeriod = currentPeriod(); - _syncFastFinalityReward(_epoch, _currentValidators); + _syncFastFinalityReward(epoch, currValidatorIds); - if (_periodEnding) { + if (periodEnding) { ( - uint256 _totalDelegatingReward, - uint256[] memory _delegatingRewards - ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators); - _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards); + uint256 totalDelegatingReward, + uint256[] memory delegatingRewards + ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(lastPeriod, currValidatorIds); + _settleAndTransferDelegatingRewards(lastPeriod, currValidatorIds, totalDelegatingReward, delegatingRewards); _tryRecycleLockedFundsFromEmergencyExits(); _recycleDeprecatedRewards(); - ISlashIndicator _slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR)); - _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod); - (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod); - if (_revokedCandidates.length > 0) { - _slashIndicatorContract.execResetCreditScores(_revokedCandidates); + + ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR)); + slashIndicatorContract.execUpdateCreditScores(currValidatorIds, lastPeriod); + (currValidatorIds, revokedCandidateIds) = _syncValidatorSet(newPeriod); + if (revokedCandidateIds.length > 0) { + slashIndicatorContract.execResetCreditScores(revokedCandidateIds); } _currentPeriodStartAtBlock = block.number + 1; } - _revampRoles(_newPeriod, _nextEpoch, _currentValidators); - emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding); - _periodOf[_nextEpoch] = _newPeriod; - _lastUpdatedPeriod = _newPeriod; + _revampRoles(newPeriod, nextEpoch, currValidatorIds); + emit WrappedUpEpoch(lastPeriod, epoch, periodEnding); + _periodOf[nextEpoch] = newPeriod; + _lastUpdatedPeriod = newPeriod; } /** - * @dev This method calculate and update reward of each `validators` accordingly thier fast finality voting performance + * @dev This method calculate and update reward of each `validators` accordingly their fast finality voting performance * in the `epoch`. The leftover reward is added to the {_totalDeprecatedReward} and is recycled later to the * {StakingVesting} contract. * * Requirements: * - This method is only called once each epoch. */ - function _syncFastFinalityReward(uint256 epoch, address[] memory validators) private { + function _syncFastFinalityReward(uint256 epoch, address[] memory validatorIds) private { uint256[] memory voteCounts = IFastFinalityTracking(getContract(ContractType.FAST_FINALITY_TRACKING)) - .getManyFinalityVoteCounts(epoch, validators); - uint256 divisor = _numberOfBlocksInEpoch * validators.length; + .getManyFinalityVoteCounts(epoch, validatorIds); + uint256 divisor = _numberOfBlocksInEpoch * validatorIds.length; uint256 iReward; uint256 totalReward = _totalFastFinalityReward; uint256 totalDispensedReward = 0; - for (uint i; i < validators.length; ) { + for (uint i; i < validatorIds.length; ) { iReward = (totalReward * voteCounts[i]) / divisor; - _fastFinalityReward[validators[i]] += iReward; + _fastFinalityReward[validatorIds[i]] += iReward; totalDispensedReward += iReward; unchecked { ++i; @@ -172,38 +175,35 @@ abstract contract CoinbaseExecution is * @dev This loops over all current validators to: * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract, * - Distribute the reward of block producers and bridge operators to their treasury addresses, - * - Update the total deprecated reward if the two previous conditions do not sastify. + * - Update the total deprecated reward if the two previous conditions do not satisfy. * * Note: This method should be called once in the end of each period. * */ function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward( - uint256 _lastPeriod, - address[] memory _currentValidators - ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) { - address _consensusAddr; - address payable _treasury; - _delegatingRewards = new uint256[](_currentValidators.length); - - for (uint _i; _i < _currentValidators.length; ) { - _consensusAddr = _currentValidators[_i]; - _treasury = _candidateInfo[_consensusAddr].treasuryAddr; - - if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) { - _totalDelegatingReward += _delegatingReward[_consensusAddr]; - _delegatingRewards[_i] = _delegatingReward[_consensusAddr]; - _distributeMiningReward(_consensusAddr, _treasury); - _distributeFastFinalityReward(_consensusAddr, _treasury); + uint256 lastPeriod, + address[] memory currValidatorIds + ) private returns (uint256 totalDelegatingReward, uint256[] memory delegatingRewards) { + address vId; // validator id + address payable treasury; + delegatingRewards = new uint256[](currValidatorIds.length); + + for (uint _i; _i < currValidatorIds.length; ) { + vId = currValidatorIds[_i]; + treasury = _candidateInfo[vId].__shadowedTreasury; + + if (!_isJailedById(vId) && !_miningRewardDeprecatedById(vId, lastPeriod)) { + totalDelegatingReward += _delegatingReward[vId]; + delegatingRewards[_i] = _delegatingReward[vId]; + _distributeMiningReward(vId, treasury); + _distributeFastFinalityReward(vId, treasury); } else { - _totalDeprecatedReward += - _miningReward[_consensusAddr] + - _delegatingReward[_consensusAddr] + - _fastFinalityReward[_consensusAddr]; + _totalDeprecatedReward += _miningReward[vId] + _delegatingReward[vId] + _fastFinalityReward[vId]; } - delete _delegatingReward[_consensusAddr]; - delete _miningReward[_consensusAddr]; - delete _fastFinalityReward[_consensusAddr]; + delete _delegatingReward[vId]; + delete _miningReward[vId]; + delete _fastFinalityReward[vId]; unchecked { ++_i; @@ -220,32 +220,32 @@ abstract contract CoinbaseExecution is * Note: This method should be called once in the end of each period. * */ - function _distributeMiningReward(address _consensusAddr, address payable _treasury) private { - uint256 _amount = _miningReward[_consensusAddr]; - if (_amount > 0) { - if (_unsafeSendRONLimitGas(_treasury, _amount, DEFAULT_ADDITION_GAS)) { - emit MiningRewardDistributed(_consensusAddr, _treasury, _amount); + function _distributeMiningReward(address cid, address payable treasury) private { + uint256 amount = _miningReward[cid]; + if (amount > 0) { + if (_unsafeSendRONLimitGas(treasury, amount, DEFAULT_ADDITION_GAS)) { + emit MiningRewardDistributed(cid, treasury, amount); return; } - emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance); + emit MiningRewardDistributionFailed(cid, treasury, amount, address(this).balance); } } - function _distributeFastFinalityReward(address _consensusAddr, address payable _treasury) private { - uint256 _amount = _fastFinalityReward[_consensusAddr]; - if (_amount > 0) { - if (_unsafeSendRONLimitGas(_treasury, _amount, DEFAULT_ADDITION_GAS)) { - emit FastFinalityRewardDistributed(_consensusAddr, _treasury, _amount); + function _distributeFastFinalityReward(address cid, address payable treasury) private { + uint256 amount = _fastFinalityReward[cid]; + if (amount > 0) { + if (_unsafeSendRONLimitGas(treasury, amount, DEFAULT_ADDITION_GAS)) { + emit FastFinalityRewardDistributed(cid, treasury, amount); return; } - emit FastFinalityRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance); + emit FastFinalityRewardDistributionFailed(cid, treasury, amount, address(this).balance); } } /** - * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period, + * @dev Helper function to settle rewards for delegators of `currValidatorIds` at the end of each period, * then transfer the rewards from this contract to the staking contract, in order to finalize a period. * * Emits the `StakingRewardDistributed` once the reward is distributed successfully. @@ -255,23 +255,23 @@ abstract contract CoinbaseExecution is * */ function _settleAndTransferDelegatingRewards( - uint256 _period, - address[] memory _currentValidators, - uint256 _totalDelegatingReward, - uint256[] memory _delegatingRewards + uint256 period, + address[] memory currValidatorIds, + uint256 totalDelegatingReward, + uint256[] memory delegatingRewards ) private { IStaking _staking = IStaking(getContract(ContractType.STAKING)); - if (_totalDelegatingReward > 0) { - if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) { - _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period); - emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards); + if (totalDelegatingReward > 0) { + if (_unsafeSendRON(payable(address(_staking)), totalDelegatingReward)) { + _staking.execRecordRewards(currValidatorIds, delegatingRewards, period); + emit StakingRewardDistributed(totalDelegatingReward, currValidatorIds, delegatingRewards); return; } emit StakingRewardDistributionFailed( - _totalDelegatingReward, - _currentValidators, - _delegatingRewards, + totalDelegatingReward, + currValidatorIds, + delegatingRewards, address(this).balance ); } @@ -284,21 +284,21 @@ abstract contract CoinbaseExecution is * Note: This method should be called once in the end of each period. */ function _recycleDeprecatedRewards() private { - uint256 _withdrawAmount = _totalDeprecatedReward; + uint256 withdrawAmount = _totalDeprecatedReward; - if (_withdrawAmount != 0) { - address _withdrawTarget = getContract(ContractType.STAKING_VESTING); + if (withdrawAmount != 0) { + address withdrawTarget = getContract(ContractType.STAKING_VESTING); delete _totalDeprecatedReward; - (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }( + (bool _success, ) = withdrawTarget.call{ value: withdrawAmount }( abi.encodeWithSelector(IStakingVesting.receiveRON.selector) ); if (_success) { - emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount); + emit DeprecatedRewardRecycled(withdrawTarget, withdrawAmount); } else { - emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance); + emit DeprecatedRewardRecycleFailed(withdrawTarget, withdrawAmount, address(this).balance); } } } @@ -312,21 +312,21 @@ abstract contract CoinbaseExecution is * */ function _syncValidatorSet( - uint256 _newPeriod - ) private returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates) { - _unsastifiedCandidates = _syncCandidateSet(_newPeriod); - uint256[] memory _weights = IStaking(getContract(ContractType.STAKING)).getManyStakingTotals(_candidates); - uint256[] memory _trustedWeights = IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)) - .getConsensusWeights(_candidates); - uint256 _newValidatorCount; - (_newValidators, _newValidatorCount) = _pcPickValidatorSet( - _candidates, - _weights, - _trustedWeights, + uint256 newPeriod + ) private returns (address[] memory newValidatorIds, address[] memory unsatisfiedCandidates) { + unsatisfiedCandidates = _syncCandidateSet(newPeriod); + uint256[] memory weights = IStaking(getContract(ContractType.STAKING)).getManyStakingTotalsById(_candidateIds); + uint256[] memory trustedWeights = IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)) + .getConsensusWeightsById(_candidateIds); + uint256 newValidatorCount; + (newValidatorIds, newValidatorCount) = _pcPickValidatorSet( + _candidateIds, + weights, + trustedWeights, _maxValidatorNumber, _maxPrioritizedValidatorNumber ); - _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod); + _setNewValidatorSet(newValidatorIds, newValidatorCount, newPeriod); } /** @@ -343,9 +343,9 @@ abstract contract CoinbaseExecution is uint256 _newPeriod ) private { // Remove exceeding validators in the current set - for (uint256 _i = _newValidatorCount; _i < validatorCount; ) { - delete _validatorMap[_validators[_i]]; - delete _validators[_i]; + for (uint256 _i = _newValidatorCount; _i < _validatorCount; ) { + delete _validatorMap[_validatorIds[_i]]; + delete _validatorIds[_i]; unchecked { ++_i; @@ -354,7 +354,7 @@ abstract contract CoinbaseExecution is // Remove flag for all validator in the current set for (uint _i; _i < _newValidatorCount; ) { - delete _validatorMap[_validators[_i]]; + delete _validatorMap[_validatorIds[_i]]; unchecked { ++_i; @@ -365,14 +365,14 @@ abstract contract CoinbaseExecution is for (uint256 _i; _i < _newValidatorCount; ) { address _newValidator = _newValidators[_i]; _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both; - _validators[_i] = _newValidator; + _validatorIds[_i] = _newValidator; unchecked { ++_i; } } - validatorCount = _newValidatorCount; + _validatorCount = _newValidatorCount; emit ValidatorSetUpdated(_newPeriod, _newValidators); } @@ -386,24 +386,24 @@ abstract contract CoinbaseExecution is * Emits the `BridgeOperatorSetUpdated` event. * */ - function _revampRoles(uint256 _newPeriod, uint256 _nextEpoch, address[] memory _currentValidators) private { - bool[] memory _maintainedList = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintained( - _currentValidators, + function _revampRoles(uint256 _newPeriod, uint256 _nextEpoch, address[] memory currValidatorIds) private { + bool[] memory _maintainedList = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedById( + currValidatorIds, block.number + 1 ); - for (uint _i; _i < _currentValidators.length; ) { - address _validator = _currentValidators[_i]; - bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator]; - bool _isProducerBefore = isBlockProducer(_validator); - bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) || + for (uint _i; _i < currValidatorIds.length; ) { + address validatorId = currValidatorIds[_i]; + bool emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[validatorId]; + bool isProducerBefore = _isBlockProducerById(validatorId); + bool isProducerAfter = !(_isJailedAtBlockById(validatorId, block.number + 1) || _maintainedList[_i] || - _emergencyExitRequested); + emergencyExitRequested); - if (!_isProducerBefore && _isProducerAfter) { - _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer); - } else if (_isProducerBefore && !_isProducerAfter) { - _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer); + if (!isProducerBefore && isProducerAfter) { + _validatorMap[validatorId] = _validatorMap[validatorId].addFlag(EnumFlags.ValidatorFlag.BlockProducer); + } else if (isProducerBefore && !isProducerAfter) { + _validatorMap[validatorId] = _validatorMap[validatorId].removeFlag(EnumFlags.ValidatorFlag.BlockProducer); } unchecked { @@ -416,10 +416,10 @@ abstract contract CoinbaseExecution is /** * @dev Override `CandidateManager-_isTrustedOrg`. */ - function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) { + function _isTrustedOrg(address validatorId) internal view override returns (bool) { return - IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getConsensusWeight( - _consensusAddr + IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getConsensusWeightById( + validatorId ) > 0; } } diff --git a/contracts/ronin/validator/EmergencyExit.sol b/contracts/ronin/validator/EmergencyExit.sol index 5dc0e3cb8..80834b1a6 100644 --- a/contracts/ronin/validator/EmergencyExit.sol +++ b/contracts/ronin/validator/EmergencyExit.sol @@ -6,9 +6,9 @@ import "../../extensions/RONTransferHelper.sol"; import "../../interfaces/IRoninGovernanceAdmin.sol"; import "../../interfaces/validator/IEmergencyExit.sol"; import "./storage-fragments/CommonStorage.sol"; -import "./CandidateManager.sol"; +import "./CandidateManagerCallback.sol"; -abstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage { +abstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManagerCallback, CommonStorage { /** * @inheritdoc IEmergencyExit */ @@ -26,92 +26,86 @@ abstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateM /** * @inheritdoc IEmergencyExit */ - function execEmergencyExit( - address _consensusAddr, - uint256 _secLeftToRevoke - ) external onlyContract(ContractType.STAKING) { - EmergencyExitInfo storage _info = _exitInfo[_consensusAddr]; + function execRequestEmergencyExit(address cid, uint256 secLeftToRevoke) external onlyContract(ContractType.STAKING) { + EmergencyExitInfo storage _info = _exitInfo[cid]; if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit(); - uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke; - _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp); - _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp; + uint256 revokingTimestamp = block.timestamp + secLeftToRevoke; + _setRevokingTimestamp(_candidateInfo[cid], revokingTimestamp); + _emergencyExitJailedTimestamp[cid] = revokingTimestamp; - uint256 _deductedAmount = IStaking(msg.sender).execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount); - if (_deductedAmount > 0) { - uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration; - _lockedConsensusList.push(_consensusAddr); - _info.lockedAmount = _deductedAmount; - _info.recyclingAt = _recyclingAt; + uint256 deductedAmount = IStaking(msg.sender).execDeductStakingAmount(cid, _emergencyExitLockedAmount); + if (deductedAmount > 0) { + uint256 recyclingAt = block.timestamp + _emergencyExpiryDuration; + _lockedConsensusList.push(cid); + _info.lockedAmount = deductedAmount; + _info.recyclingAt = recyclingAt; IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll( - _consensusAddr, - _candidateInfo[_consensusAddr].treasuryAddr, + cid, + _candidateInfo[cid].__shadowedTreasury, block.timestamp, - _recyclingAt + recyclingAt ); } - emit EmergencyExitRequested(_consensusAddr, _deductedAmount); + emit EmergencyExitRequested(cid, deductedAmount); } /** * @inheritdoc IEmergencyExit */ - function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin { - _setEmergencyExitLockedAmount(_emergencyExitLockedAmount); + function setEmergencyExitLockedAmount(uint256 amount) external onlyAdmin { + _setEmergencyExitLockedAmount(amount); } /** * @inheritdoc IEmergencyExit */ - function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin { - _setEmergencyExpiryDuration(_emergencyExpiryDuration); + function setEmergencyExpiryDuration(uint256 duration) external onlyAdmin { + _setEmergencyExpiryDuration(duration); } /** * @inheritdoc IEmergencyExit */ - function execReleaseLockedFundForEmergencyExitRequest( - address _consensusAddr, - address payable _recipient - ) external onlyAdmin { - if (_exitInfo[_consensusAddr].recyclingAt == 0) { - return; + function execReleaseLockedFundForEmergencyExitRequest(address cid, address payable recipient) external onlyAdmin { + if (_exitInfo[cid].recyclingAt == 0) { + revert ErrLockedFundReleaseInfoNotFound(cid); } - uint256 _length = _lockedConsensusList.length; - uint256 _index = _length; + uint256 length = _lockedConsensusList.length; + uint256 index = length; - for (uint _i; _i < _length; ) { - if (_lockedConsensusList[_i] == _consensusAddr) { - _index = _i; + for (uint i; i < length; ) { + if (_lockedConsensusList[i] == cid) { + index = i; break; } unchecked { - ++_i; + ++i; } } // The locked amount might be recycled - if (_index == _length) { - return; + if (index == length) { + revert ErrLockedFundMightBeRecycled(cid); } - uint256 _amount = _exitInfo[_consensusAddr].lockedAmount; - if (_amount > 0) { - delete _exitInfo[_consensusAddr]; - if (_length > 1) { - _lockedConsensusList[_index] = _lockedConsensusList[_length - 1]; + uint256 amount = _exitInfo[cid].lockedAmount; + if (amount > 0) { + delete _exitInfo[cid]; + if (length > 1) { + _lockedConsensusList[index] = _lockedConsensusList[length - 1]; } _lockedConsensusList.pop(); - _lockedFundReleased[_consensusAddr] = true; - if (_unsafeSendRONLimitGas(_recipient, _amount, DEFAULT_ADDITION_GAS)) { - emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount); + _lockedFundReleased[cid] = true; + if (_unsafeSendRONLimitGas(recipient, amount, DEFAULT_ADDITION_GAS)) { + emit EmergencyExitLockedFundReleased(cid, recipient, amount); return; } - emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance); + emit EmergencyExitLockedFundReleasingFailed(cid, recipient, amount, address(this).balance); } } @@ -119,29 +113,29 @@ abstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateM * @dev Tries to recycle the locked funds from emergency exit requests. */ function _tryRecycleLockedFundsFromEmergencyExits() internal { - uint256 _length = _lockedConsensusList.length; + uint256 length = _lockedConsensusList.length; - uint256 _i; - address _addr; + uint256 i; + address addr; EmergencyExitInfo storage _info; - while (_i < _length) { - _addr = _lockedConsensusList[_i]; - _info = _exitInfo[_addr]; + while (i < length) { + addr = _lockedConsensusList[i]; + _info = _exitInfo[addr]; if (_info.recyclingAt <= block.timestamp) { _totalDeprecatedReward += _info.lockedAmount; - delete _exitInfo[_addr]; - if (--_length > 0) { - _lockedConsensusList[_i] = _lockedConsensusList[_length]; + delete _exitInfo[addr]; + if (--length > 0) { + _lockedConsensusList[i] = _lockedConsensusList[length]; } _lockedConsensusList.pop(); continue; } unchecked { - _i++; + i++; } } } @@ -149,31 +143,41 @@ abstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateM /** * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`. */ - function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) { - return _lockedFundReleased[_consensusAddr]; + function _emergencyExitLockedFundReleased(address cid) internal virtual override returns (bool) { + return _lockedFundReleased[cid]; } /** * @dev Override `CandidateManager-_removeCandidate`. */ - function _removeCandidate(address _consensusAddr) internal override { - delete _lockedFundReleased[_consensusAddr]; - super._removeCandidate(_consensusAddr); + function _removeCandidate(address cid) internal override { + delete _lockedFundReleased[cid]; + super._removeCandidate(cid); } + /// @dev See {RoninValidatorSet-__css2cid} + function __css2cid( + TConsensus consensusAddr + ) internal view virtual override(CandidateManager, CommonStorage) returns (address); + + /// @dev See {RoninValidatorSet-__css2cidBatch} + function __css2cidBatch( + TConsensus[] memory consensusAddrs + ) internal view virtual override(CandidateManager, CommonStorage) returns (address[] memory); + /** * @dev See `setEmergencyExitLockedAmount. */ - function _setEmergencyExitLockedAmount(uint256 _amount) internal { - _emergencyExitLockedAmount = _amount; - emit EmergencyExitLockedAmountUpdated(_amount); + function _setEmergencyExitLockedAmount(uint256 amount) internal { + _emergencyExitLockedAmount = amount; + emit EmergencyExitLockedAmountUpdated(amount); } /** * @dev See `setEmergencyExpiryDuration`. */ - function _setEmergencyExpiryDuration(uint256 _duration) internal { - _emergencyExpiryDuration = _duration; - emit EmergencyExpiryDurationUpdated(_duration); + function _setEmergencyExpiryDuration(uint256 duration) internal { + _emergencyExpiryDuration = duration; + emit EmergencyExpiryDurationUpdated(duration); } } diff --git a/contracts/ronin/validator/RoninValidatorSet.sol b/contracts/ronin/validator/RoninValidatorSet.sol index 164e13c3e..1ad33e606 100644 --- a/contracts/ronin/validator/RoninValidatorSet.sol +++ b/contracts/ronin/validator/RoninValidatorSet.sol @@ -73,6 +73,10 @@ contract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecutio _setContract(ContractType.FAST_FINALITY_TRACKING, fastFinalityTrackingContract); } + function initializeV4(address profileContract) external reinitializer(4) { + _setContract(ContractType.PROFILE, profileContract); + } + /** * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring * deducting amount on slashing). @@ -82,4 +86,20 @@ contract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecutio revert ErrUnauthorizedReceiveRON(); } } + + /** + * @dev Convert consensus address to corresponding id from the Profile contract. + */ + function __css2cid(TConsensus consensusAddr) internal view override(EmergencyExit, CommonStorage) returns (address) { + return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr); + } + + /** + * @dev Convert many consensus addresses to corresponding ids from the Profile contract. + */ + function __css2cidBatch( + TConsensus[] memory consensusAddrs + ) internal view override(EmergencyExit, CommonStorage) returns (address[] memory) { + return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs); + } } diff --git a/contracts/ronin/validator/SlashingExecution.sol b/contracts/ronin/validator/SlashingExecution.sol index 0fe1a2413..f9e216dae 100644 --- a/contracts/ronin/validator/SlashingExecution.sol +++ b/contracts/ronin/validator/SlashingExecution.sol @@ -20,51 +20,51 @@ abstract contract SlashingExecution is * @inheritdoc ISlashingExecution */ function execSlash( - address validatorAddr, + address validatorId, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout ) external override onlyContract(ContractType.SLASH_INDICATOR) { uint256 period = currentPeriod(); - _miningRewardDeprecatedAtPeriod[validatorAddr][period] = true; + _miningRewardDeprecatedAtPeriod[validatorId][period] = true; - _totalDeprecatedReward += _miningReward[validatorAddr] + _delegatingReward[validatorAddr]; + _totalDeprecatedReward += _miningReward[validatorId] + _delegatingReward[validatorId]; - delete _miningReward[validatorAddr]; - delete _delegatingReward[validatorAddr]; + delete _miningReward[validatorId]; + delete _delegatingReward[validatorId]; - _blockProducerJailedBlock[validatorAddr] = Math.max(newJailedUntil, _blockProducerJailedBlock[validatorAddr]); + _blockProducerJailedBlock[validatorId] = Math.max(newJailedUntil, _blockProducerJailedBlock[validatorId]); if (slashAmount > 0) { uint256 _actualAmount = IStaking(getContract(ContractType.STAKING)).execDeductStakingAmount( - validatorAddr, + validatorId, slashAmount ); _totalDeprecatedReward += _actualAmount; } if (cannotBailout) { - _cannotBailoutUntilBlock[validatorAddr] = Math.max(newJailedUntil, _cannotBailoutUntilBlock[validatorAddr]); + _cannotBailoutUntilBlock[validatorId] = Math.max(newJailedUntil, _cannotBailoutUntilBlock[validatorId]); } - emit ValidatorPunished(validatorAddr, period, _blockProducerJailedBlock[validatorAddr], slashAmount, true, false); + emit ValidatorPunished(validatorId, period, _blockProducerJailedBlock[validatorId], slashAmount, true, false); } /** * @inheritdoc ISlashingExecution */ function execBailOut( - address validatorAddr, + address validatorId, uint256 period ) external override onlyContract(ContractType.SLASH_INDICATOR) { - if (block.number <= _cannotBailoutUntilBlock[validatorAddr]) revert ErrCannotBailout(validatorAddr); + if (block.number <= _cannotBailoutUntilBlock[validatorId]) revert ErrCannotBailout(validatorId); // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been // removed previously in the `slash` function. - _miningRewardBailoutCutOffAtPeriod[validatorAddr][period] = true; - _miningRewardDeprecatedAtPeriod[validatorAddr][period] = false; - _blockProducerJailedBlock[validatorAddr] = block.number - 1; + _miningRewardBailoutCutOffAtPeriod[validatorId][period] = true; + _miningRewardDeprecatedAtPeriod[validatorId][period] = false; + _blockProducerJailedBlock[validatorId] = block.number - 1; - emit ValidatorUnjailed(validatorAddr, period); + emit ValidatorUnjailed(validatorId, period); } } diff --git a/contracts/ronin/validator/storage-fragments/CommonStorage.sol b/contracts/ronin/validator/storage-fragments/CommonStorage.sol index 72d8732f5..7069b9a77 100644 --- a/contracts/ronin/validator/storage-fragments/CommonStorage.sol +++ b/contracts/ronin/validator/storage-fragments/CommonStorage.sol @@ -41,10 +41,8 @@ abstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, V /** * @inheritdoc ICommonInfo */ - function getEmergencyExitInfo( - address _consensusAddr - ) external view override returns (EmergencyExitInfo memory _info) { - _info = _exitInfo[_consensusAddr]; + function getEmergencyExitInfo(TConsensus consensus) external view override returns (EmergencyExitInfo memory _info) { + _info = _exitInfo[__css2cid(consensus)]; if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo(); } @@ -70,4 +68,14 @@ abstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, V function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) { return TimingStorage.currentPeriod(); } + + /// @dev See {RoninValidatorSet-__css2cid} + function __css2cid( + TConsensus consensusAddr + ) internal view virtual override(JailingStorage, ValidatorInfoStorageV2) returns (address); + + /// @dev See {RoninValidatorSet-__css2cidBatch} + function __css2cidBatch( + TConsensus[] memory consensusAddrs + ) internal view virtual override(JailingStorage, ValidatorInfoStorageV2) returns (address[] memory); } diff --git a/contracts/ronin/validator/storage-fragments/JailingStorage.sol b/contracts/ronin/validator/storage-fragments/JailingStorage.sol index 3291fff52..4a2e06343 100644 --- a/contracts/ronin/validator/storage-fragments/JailingStorage.sol +++ b/contracts/ronin/validator/storage-fragments/JailingStorage.sol @@ -3,21 +3,20 @@ pragma solidity ^0.8.9; import "../../../interfaces/validator/info-fragments/IJailingInfo.sol"; -import "./TimingStorage.sol"; abstract contract JailingStorage is IJailingInfo { - /// @dev Mapping from consensus address => period number => block producer has no pending reward. + /// @dev Mapping from candidate id => period number => block producer has no pending reward. mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod; - /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout. + /// @dev Mapping from candidate id => period number => whether the block producer get cut off reward, due to bailout. mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod; - /// @dev Mapping from consensus address => period number => block operator has no pending reward. + /// @dev Mapping from candidate id => period number => block operator has no pending reward. mapping(address => mapping(uint256 => bool)) internal ______deprecatedBridgeRewardDeprecatedAtPeriod; - /// @dev Mapping from consensus address => the last block that the block producer is jailed. + /// @dev Mapping from candidate id => the last block that the block producer is jailed. mapping(address => uint256) internal _blockProducerJailedBlock; - /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed. + /// @dev Mapping from candidate id => the last timestamp that the bridge operator is jailed. mapping(address => uint256) internal _emergencyExitJailedTimestamp; - /// @dev Mapping from consensus address => the last block that the block producer cannot bailout. + /// @dev Mapping from candidate id => the last block that the block producer cannot bailout. mapping(address => uint256) internal _cannotBailoutUntilBlock; /** @@ -29,53 +28,70 @@ abstract contract JailingStorage is IJailingInfo { /** * @inheritdoc IJailingInfo */ - function checkJailed(address _addr) external view override returns (bool) { - return checkJailedAtBlock(_addr, block.number); + function checkJailed(TConsensus consensus) external view override returns (bool) { + address candidateId = __css2cid(consensus); + return _isJailedAtBlockById(candidateId, block.number); } /** * @inheritdoc IJailingInfo */ - function getJailedTimeLeft( - address _addr - ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) { - return getJailedTimeLeftAtBlock(_addr, block.number); + function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view override returns (bool) { + address candidateId = __css2cid(addr); + return _isJailedAtBlockById(candidateId, blockNum); } /** * @inheritdoc IJailingInfo */ - function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) { - return _jailedAtBlock(_addr, _blockNum); + function getJailedTimeLeft( + TConsensus consensus + ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) { + return _getJailedTimeLeftAtBlockById(__css2cid(consensus), block.number); } /** * @inheritdoc IJailingInfo */ function getJailedTimeLeftAtBlock( - address _addr, + TConsensus consensus, uint256 _blockNum - ) public view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) { - uint256 _jailedBlock = _blockProducerJailedBlock[_addr]; - if (_jailedBlock < _blockNum) { + ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) { + return _getJailedTimeLeftAtBlockById(__css2cid(consensus), _blockNum); + } + + function _getJailedTimeLeftAtBlockById( + address candidateId, + uint256 blockNum + ) internal view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) { + uint256 jailedBlock = _blockProducerJailedBlock[candidateId]; + if (jailedBlock < blockNum) { return (false, 0, 0); } isJailed_ = true; - blockLeft_ = _jailedBlock - _blockNum + 1; - epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1; + blockLeft_ = jailedBlock - blockNum + 1; + epochLeft_ = epochOf(jailedBlock) - epochOf(blockNum) + 1; } /** * @inheritdoc IJailingInfo */ - function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) { - _result = new bool[](_addrList.length); - for (uint256 _i; _i < _addrList.length; ) { - _result[_i] = _jailed(_addrList[_i]); + function checkManyJailed(TConsensus[] calldata consensusList) external view override returns (bool[] memory) { + return _checkManyJailedById(__css2cidBatch(consensusList)); + } + + function checkManyJailedById(address[] calldata candidateIds) external view override returns (bool[] memory) { + return _checkManyJailedById(candidateIds); + } + + function _checkManyJailedById(address[] memory candidateIds) internal view returns (bool[] memory result) { + result = new bool[](candidateIds.length); + for (uint256 i; i < candidateIds.length; ) { + result[i] = _isJailedById(candidateIds[i]); unchecked { - ++_i; + ++i; } } } @@ -83,19 +99,19 @@ abstract contract JailingStorage is IJailingInfo { /** * @inheritdoc IJailingInfo */ - function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) { - uint256 _period = currentPeriod(); - return _miningRewardDeprecated(_blockProducer, _period); + function checkMiningRewardDeprecated(TConsensus consensus) external view override returns (bool) { + uint256 period = currentPeriod(); + return _miningRewardDeprecatedById(__css2cid(consensus), period); } /** * @inheritdoc IJailingInfo */ function checkMiningRewardDeprecatedAtPeriod( - address _blockProducer, - uint256 _period - ) external view override returns (bool _result) { - return _miningRewardDeprecated(_blockProducer, _period); + TConsensus consensus, + uint256 period + ) external view override returns (bool) { + return _miningRewardDeprecatedById(__css2cid(consensus), period); } /** @@ -111,21 +127,27 @@ abstract contract JailingStorage is IJailingInfo { /** * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period. */ - function _jailed(address _validatorAddr) internal view returns (bool) { - return _jailedAtBlock(_validatorAddr, block.number); + function _isJailedById(address validatorId) internal view returns (bool) { + return _isJailedAtBlockById(validatorId, block.number); } /** * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block. */ - function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) { - return _blockNum <= _blockProducerJailedBlock[_validatorAddr]; + function _isJailedAtBlockById(address validatorId, uint256 blockNum) internal view returns (bool) { + return blockNum <= _blockProducerJailedBlock[validatorId]; } /** * @dev Returns whether the block producer has no pending reward in that period. */ - function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) { - return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period]; + function _miningRewardDeprecatedById(address validatorId, uint256 period) internal view returns (bool) { + return _miningRewardDeprecatedAtPeriod[validatorId][period]; } + + /// @dev See {RoninValidatorSet-__css2cid} + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); + + /// @dev See {RoninValidatorSet-__css2cidBatch} + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory); } diff --git a/contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol b/contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol deleted file mode 100644 index 0c821e6b0..000000000 --- a/contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol +++ /dev/null @@ -1,236 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.9; - -import "../../../libraries/EnumFlags.sol"; -import { HasTrustedOrgDeprecated } from "../../../utils/DeprecatedSlots.sol"; -import "../../../extensions/collections/HasContracts.sol"; -import "../../../interfaces/validator/info-fragments/IValidatorInfo.sol"; - -abstract contract ValidatorInfoStorage is IValidatorInfo, HasContracts, HasTrustedOrgDeprecated { - using EnumFlags for EnumFlags.ValidatorFlag; - - /// @dev The maximum number of validator. - uint256 internal _maxValidatorNumber; - - /// @dev The total of validators - uint256 public validatorCount; - /// @dev Mapping from validator index => validator address - mapping(uint256 => address) internal _validators; - /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge - mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap; - /// @dev The number of slot that is reserved for prioritized validators - uint256 internal _maxPrioritizedValidatorNumber; - - /** - * @dev This empty reserved space is put in place to allow future versions to add new - * variables without shifting down storage in the inheritance chain. - */ - uint256[50] private ______gap; - - /** - * @inheritdoc IValidatorInfo - */ - function getValidators() - public - view - override - returns ( - address[] memory _validatorList, - address[] memory _bridgeOperators, - EnumFlags.ValidatorFlag[] memory _flags - ) - { - _validatorList = new address[](validatorCount); - _bridgeOperators = new address[](validatorCount); - _flags = new EnumFlags.ValidatorFlag[](validatorCount); - for (uint _i; _i < _validatorList.length; ) { - address _validator = _validators[_i]; - _validatorList[_i] = _validator; - _bridgeOperators[_i] = _bridgeOperatorOf(_validator); - _flags[_i] = _validatorMap[_validator]; - - unchecked { - ++_i; - } - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function isValidator(address _addr) public view override returns (bool) { - return !_validatorMap[_addr].isNone(); - } - - /** - * @inheritdoc IValidatorInfo - */ - function getBlockProducers() public view override returns (address[] memory _result) { - _result = new address[](validatorCount); - uint256 _count = 0; - for (uint _i; _i < _result.length; ) { - if (isBlockProducer(_validators[_i])) { - _result[_count++] = _validators[_i]; - } - - unchecked { - ++_i; - } - } - - assembly { - mstore(_result, _count) - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function isBlockProducer(address _addr) public view override returns (bool) { - return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer); - } - - /** - * @inheritdoc IValidatorInfo - */ - function totalBlockProducer() external view returns (uint256 _total) { - unchecked { - for (uint _i; _i < validatorCount; _i++) { - if (isBlockProducer(_validators[_i])) { - _total++; - } - } - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function getBridgeOperators() - public - view - override - returns (address[] memory _bridgeOperatorList, address[] memory _validatorList) - { - uint256 _length = validatorCount; - _bridgeOperatorList = new address[](_length); - _validatorList = new address[](_length); - uint256 _count = 0; - unchecked { - for (uint _i; _i < _length; ++_i) { - if (isOperatingBridge(_validators[_i])) { - address __validator = _validators[_i]; - _bridgeOperatorList[_count] = _bridgeOperatorOf(__validator); - _validatorList[_count++] = __validator; - } - } - } - - assembly { - mstore(_bridgeOperatorList, _count) - mstore(_validatorList, _count) - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function getBridgeOperatorsOf( - address[] memory _validatorAddrs - ) public view override returns (address[] memory _bridgeOperatorList) { - _bridgeOperatorList = new address[](_validatorAddrs.length); - for (uint _i; _i < _bridgeOperatorList.length; ) { - _bridgeOperatorList[_i] = _bridgeOperatorOf(_validatorAddrs[_i]); - unchecked { - ++_i; - } - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) { - for (uint _i; _i < validatorCount; ) { - if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) { - _isOperator = true; - break; - } - - unchecked { - ++_i; - } - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function isOperatingBridge(address _consensusAddr) public view override returns (bool) { - return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.DeprecatedBridgeOperator); - } - - /** - * @inheritdoc IValidatorInfo - */ - function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) { - return _maxValidatorNumber; - } - - /** - * @inheritdoc IValidatorInfo - */ - function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) { - return _maxPrioritizedValidatorNumber; - } - - /** - * @inheritdoc IValidatorInfo - */ - function totalBridgeOperator() public view returns (uint256 _total) { - unchecked { - for (uint _i; _i < validatorCount; _i++) { - if (isOperatingBridge(_validators[_i])) { - _total++; - } - } - } - } - - /** - * @inheritdoc IValidatorInfo - */ - function setMaxValidatorNumber(uint256 _max) external override onlyAdmin { - _setMaxValidatorNumber(_max); - } - - /** - * @inheritdoc IValidatorInfo - */ - function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin { - _setMaxPrioritizedValidatorNumber(_number); - } - - /** - * @dev Returns the bridge operator of a consensus address. - */ - function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address); - - /** - * @dev See `IValidatorInfo-setMaxValidatorNumber` - */ - function _setMaxValidatorNumber(uint256 _number) internal { - _maxValidatorNumber = _number; - emit MaxValidatorNumberUpdated(_number); - } - - /** - * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber` - */ - function _setMaxPrioritizedValidatorNumber(uint256 _number) internal { - if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber(); - _maxPrioritizedValidatorNumber = _number; - emit MaxPrioritizedValidatorNumberUpdated(_number); - } -} diff --git a/contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol b/contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol index 8ceea8dc7..aacfa19e1 100644 --- a/contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol +++ b/contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol @@ -6,6 +6,8 @@ import "../../../libraries/EnumFlags.sol"; import { HasTrustedOrgDeprecated } from "../../../utils/DeprecatedSlots.sol"; import "../../../extensions/collections/HasContracts.sol"; import "../../../interfaces/validator/info-fragments/IValidatorInfoV2.sol"; +import "../../../interfaces/IProfile.sol"; +import { TConsensus } from "../../../udvts/Types.sol"; abstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasTrustedOrgDeprecated { using EnumFlags for EnumFlags.ValidatorFlag; @@ -14,10 +16,10 @@ abstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasT uint256 internal _maxValidatorNumber; /// @dev The total of validators - uint256 public validatorCount; - /// @dev Mapping from validator index => validator address - mapping(uint256 => address) internal _validators; - /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge + uint256 internal _validatorCount; + /// @dev Mapping from validator index => validator id address + mapping(uint256 => address) internal _validatorIds; + /// @dev Mapping from validator id => flag indicating the validator ability: producing block, operating bridge mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap; /// @dev The number of slot that is reserved for prioritized validators uint256 internal _maxPrioritizedValidatorNumber; @@ -28,17 +30,22 @@ abstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasT */ uint256[50] private ______gap; + function validatorCount() external view returns (uint256) { + return _validatorCount; + } + /** * @inheritdoc IValidatorInfoV2 */ - function getValidators() public view override returns (address[] memory _validatorList) { - _validatorList = new address[](validatorCount); - for (uint _i; _i < _validatorList.length; ) { - address _validator = _validators[_i]; - _validatorList[_i] = _validator; + function getValidators() public view override returns (address[] memory validatorList_) { + validatorList_ = new address[](_validatorCount); + address iValidator; + for (uint i; i < validatorList_.length; ) { + iValidator = _validatorIds[i]; + validatorList_[i] = iValidator; unchecked { - ++_i; + ++i; } } } @@ -46,39 +53,44 @@ abstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasT /** * @inheritdoc IValidatorInfoV2 */ - function getBlockProducers() public view override returns (address[] memory _result) { - _result = new address[](validatorCount); - uint256 _count = 0; - for (uint _i; _i < _result.length; ) { - if (isBlockProducer(_validators[_i])) { - _result[_count++] = _validators[_i]; + function getBlockProducers() public view override returns (address[] memory result) { + result = new address[](_validatorCount); + uint256 count = 0; + for (uint i; i < result.length; ) { + address validatorId = _validatorIds[i]; + if (_isBlockProducerById(validatorId)) { + result[count++] = validatorId; } unchecked { - ++_i; + ++i; } } assembly { - mstore(_result, _count) + mstore(result, count) } } /** * @inheritdoc IValidatorInfoV2 */ - function isBlockProducer(address _addr) public view override returns (bool) { - return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer); + function isBlockProducer(TConsensus consensusAddr) public view override returns (bool) { + return _isBlockProducerById(__css2cid(consensusAddr)); + } + + function _isBlockProducerById(address id) internal view returns (bool) { + return _validatorMap[id].hasFlag(EnumFlags.ValidatorFlag.BlockProducer); } /** * @inheritdoc IValidatorInfoV2 */ - function totalBlockProducer() external view returns (uint256 _total) { + function totalBlockProducer() external view returns (uint256 total) { unchecked { - for (uint _i; _i < validatorCount; _i++) { - if (isBlockProducer(_validators[_i])) { - _total++; + for (uint i; i < _validatorCount; i++) { + if (_isBlockProducerById(_validatorIds[i])) { + total++; } } } @@ -128,4 +140,10 @@ abstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasT _maxPrioritizedValidatorNumber = _number; emit MaxPrioritizedValidatorNumberUpdated(_number); } + + /// @dev See {RoninValidatorSet-__css2cid} + function __css2cid(TConsensus consensusAddr) internal view virtual returns (address); + + /// @dev See {RoninValidatorSet-__css2cidBatch} + function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory); } diff --git a/contracts/udvts/Types.sol b/contracts/udvts/Types.sol new file mode 100644 index 000000000..463377fef --- /dev/null +++ b/contracts/udvts/Types.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +type TPoolId is address; +type TConsensus is address; + +using { TPoolIdEq as == } for TPoolId global; +using { TConsensusEq as == } for TConsensus global; + +function TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) { + return TPoolId.unwrap(a) == TPoolId.unwrap(b); +} + +function TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) { + return TConsensus.unwrap(a) == TConsensus.unwrap(b); +} diff --git a/contracts/utils/CommonErrors.sol b/contracts/utils/CommonErrors.sol index 0dd843f5a..f009ea5a8 100644 --- a/contracts/utils/CommonErrors.sol +++ b/contracts/utils/CommonErrors.sol @@ -5,27 +5,32 @@ import { ContractType } from "./ContractType.sol"; import { RoleAccess } from "./RoleAccess.sol"; error ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod); -/** - * @dev Error thrown when an address is expected to be an already created externally owned account (EOA). - * This error indicates that the provided address is invalid for certain contract operations that require already created EOA. - */ -error ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash); + /** * @dev Error raised when a bridge operator update operation fails. * @param bridgeOperator The address of the bridge operator that failed to update. */ error ErrBridgeOperatorUpdateFailed(address bridgeOperator); + +/** + * @dev Error thrown when an address is expected to be an already created externally owned account (EOA). + * This error indicates that the provided address is invalid for certain contract operations that require already created EOA. + */ +error ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash); + /** * @dev Error thrown when attempting to add a bridge operator that already exists in the contract. * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract. */ error ErrBridgeOperatorAlreadyExisted(address bridgeOperator); + /** * @dev The error indicating an unsupported interface. * @param interfaceId The bytes4 interface identifier that is not supported. * @param addr The address where the unsupported interface was encountered. */ error ErrUnsupportedInterface(bytes4 interfaceId, address addr); + /** * @dev Error thrown when the return data from a callback function is invalid. * @param callbackFnSig The signature of the callback function that returned invalid data. @@ -33,18 +38,22 @@ error ErrUnsupportedInterface(bytes4 interfaceId, address addr); * @param returnData The invalid return data received from the callback function. */ error ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData); + /** * @dev Error of set to non-contract. */ error ErrZeroCodeContract(address addr); + /** * @dev Error indicating that arguments are invalid. */ error ErrInvalidArguments(bytes4 msgSig); + /** * @dev Error indicating that given address is null when it should not. */ error ErrZeroAddress(bytes4 msgSig); + /** * @dev Error indicating that the provided threshold is invalid for a specific function signature. * @param msgSig The function signature (bytes4) that the invalid threshold applies to. diff --git a/deployments/ronin-testnet/MaintenanceLogic.json b/deployments/ronin-testnet/MaintenanceLogic.json index 9f633025d..72ac552f9 100644 --- a/deployments/ronin-testnet/MaintenanceLogic.json +++ b/deployments/ronin-testnet/MaintenanceLogic.json @@ -1,5 +1,5 @@ { - "address": "0x84d6e16a767a85d34964f26094bb46b0b7a4c8ab", + "address": "0x4AE16F2CEA9B88a90E6F8FF9Faf5DA6bC72a3778", "abi": [ { "inputs": [], @@ -174,7 +174,7 @@ "inputs": [ { "indexed": true, - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" } @@ -187,7 +187,7 @@ "inputs": [ { "indexed": true, - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -226,8 +226,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -239,12 +239,12 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], - "name": "checkCooldownEnds", + "name": "checkCooldownEnded", "outputs": [ { "internalType": "bool", @@ -258,13 +258,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "uint256", - "name": "_block", + "name": "atBlock", "type": "uint256" } ], @@ -283,17 +283,41 @@ "inputs": [ { "internalType": "address", - "name": "_consensusAddr", + "name": "candidateId", "type": "address" }, { "internalType": "uint256", - "name": "_fromBlock", + "name": "atBlock", "type": "uint256" + } + ], + "name": "checkMaintainedById", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "consensusAddr", + "type": "address" }, { "internalType": "uint256", - "name": "_toBlock", + "name": "fromBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBlock", "type": "uint256" } ], @@ -311,13 +335,13 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_addrList", + "internalType": "TConsensus[]", + "name": "addrList", "type": "address[]" }, { "internalType": "uint256", - "name": "_block", + "name": "atBlock", "type": "uint256" } ], @@ -325,7 +349,7 @@ "outputs": [ { "internalType": "bool[]", - "name": "_resList", + "name": "", "type": "bool[]" } ], @@ -336,17 +360,41 @@ "inputs": [ { "internalType": "address[]", - "name": "_addrList", + "name": "idList", "type": "address[]" }, { "internalType": "uint256", - "name": "_fromBlock", + "name": "atBlock", "type": "uint256" + } + ], + "name": "checkManyMaintainedById", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus[]", + "name": "addrList", + "type": "address[]" }, { "internalType": "uint256", - "name": "_toBlock", + "name": "fromBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBlock", "type": "uint256" } ], @@ -354,7 +402,7 @@ "outputs": [ { "internalType": "bool[]", - "name": "_resList", + "name": "", "type": "bool[]" } ], @@ -364,8 +412,37 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "address[]", + "name": "idList", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "fromBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBlock", + "type": "uint256" + } + ], + "name": "checkManyMaintainedInBlockRangeById", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -415,8 +492,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -457,37 +534,37 @@ "inputs": [ { "internalType": "address", - "name": "__validatorContract", + "name": "validatorContract", "type": "address" }, { "internalType": "uint256", - "name": "_minMaintenanceDurationInBlock", + "name": "minMaintenanceDurationInBlock_", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxMaintenanceDurationInBlock", + "name": "maxMaintenanceDurationInBlock_", "type": "uint256" }, { "internalType": "uint256", - "name": "_minOffsetToStartSchedule", + "name": "minOffsetToStartSchedule_", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxOffsetToStartSchedule", + "name": "maxOffsetToStartSchedule_", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxSchedules", + "name": "maxSchedule_", "type": "uint256" }, { "internalType": "uint256", - "name": "_cooldownSecsToMaintain", + "name": "cooldownSecsToMaintain_", "type": "uint256" } ], @@ -503,6 +580,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "profileContract_", + "type": "address" + } + ], + "name": "initializeV3", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "maxMaintenanceDurationInBlock", @@ -531,7 +621,7 @@ }, { "inputs": [], - "name": "maxSchedules", + "name": "maxSchedule", "outputs": [ { "internalType": "uint256", @@ -571,18 +661,18 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "uint256", - "name": "_startedAtBlock", + "name": "startedAtBlock", "type": "uint256" }, { "internalType": "uint256", - "name": "_endedAtBlock", + "name": "endedAtBlock", "type": "uint256" } ], @@ -613,32 +703,32 @@ "inputs": [ { "internalType": "uint256", - "name": "_minMaintenanceDurationInBlock", + "name": "minMaintenanceDurationInBlock_", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxMaintenanceDurationInBlock", + "name": "maxMaintenanceDurationInBlock_", "type": "uint256" }, { "internalType": "uint256", - "name": "_minOffsetToStartSchedule", + "name": "minOffsetToStartSchedule_", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxOffsetToStartSchedule", + "name": "maxOffsetToStartSchedule_", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxSchedules", + "name": "maxSchedule_", "type": "uint256" }, { "internalType": "uint256", - "name": "_cooldownSecsToMaintain", + "name": "cooldownSecsToMaintain_", "type": "uint256" } ], @@ -649,11 +739,11 @@ }, { "inputs": [], - "name": "totalSchedules", + "name": "totalSchedule", "outputs": [ { "internalType": "uint256", - "name": "_count", + "name": "count", "type": "uint256" } ], @@ -661,41 +751,41 @@ "type": "function" } ], - "transactionHash": "0xd27e5dc369954ce8de24d149ab1b3a29320eeaf45499177d0f0645038f37a2eb", + "transactionHash": "0xb69d5b364bac11b8eb93d61880c963ea4ca09389a81e2f060873c40c9bcd2db9", "receipt": { "to": null, - "from": "0x968d0cd7343f711216817e617d3f92a23dc91c07", - "contractAddress": "0x84d6e16a767a85d34964f26094bb46b0b7a4c8ab", - "transactionIndex": "0x0", - "gasUsed": "0x132d10", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000008000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000", - "blockHash": "0x0cb49e74f7d857607f3e2b79478b990d1424ec25e85f595252f383fd6620ff4a", - "transactionHash": "0xd27e5dc369954ce8de24d149ab1b3a29320eeaf45499177d0f0645038f37a2eb", + "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", + "contractAddress": "0x4AE16F2CEA9B88a90E6F8FF9Faf5DA6bC72a3778", + "transactionIndex": 0, + "gasUsed": "1495437", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000004000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6baf439220ec7e03c9bfbb7c1d272fa23c8d359fa05b978c956c382181a722dd", + "transactionHash": "0xb69d5b364bac11b8eb93d61880c963ea4ca09389a81e2f060873c40c9bcd2db9", "logs": [ { - "address": "0x84d6e16a767a85d34964f26094bb46b0b7a4c8ab", + "transactionIndex": 0, + "blockNumber": 21941073, + "transactionHash": "0xb69d5b364bac11b8eb93d61880c963ea4ca09389a81e2f060873c40c9bcd2db9", + "address": "0x4AE16F2CEA9B88a90E6F8FF9Faf5DA6bC72a3778", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "blockNumber": "0x1229505", - "transactionHash": "0xd27e5dc369954ce8de24d149ab1b3a29320eeaf45499177d0f0645038f37a2eb", - "transactionIndex": "0x0", - "blockHash": "0x0cb49e74f7d857607f3e2b79478b990d1424ec25e85f595252f383fd6620ff4a", - "logIndex": "0x0", - "removed": false + "logIndex": 0, + "blockHash": "0x6baf439220ec7e03c9bfbb7c1d272fa23c8d359fa05b978c956c382181a722dd" } ], - "blockNumber": "0x1229505", - "cumulativeGasUsed": "0x132d10", - "status": "0x1" + "blockNumber": 21941073, + "cumulativeGasUsed": "1495437", + "status": 1, + "byzantium": true }, "args": [], - "numDeployments": 7, - "solcInputHash": "04a9bbd243a024f931581fbb384106a3", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyOnMaintenance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyScheduled\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCooldownTimeNotYetEnded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrEndBlockOutOfRange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaintenanceDuration\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaintenanceDurationConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidOffsetToStartScheduleConfigs\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStartBlockOutOfRange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTotalOfSchedulesExceeded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnexistedSchedule\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSchedules\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"MaintenanceConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"MaintenanceScheduleCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"MaintenanceScheduled\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"cancelSchedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkCooldownEnds\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkMaintained\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintained\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkScheduled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToMaintain\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endedAtBlock\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"setMaintenanceConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyOnMaintenance()\":[{\"details\":\"Error thrown when attempting to initiate maintenance while already in maintenance mode.\"}],\"ErrAlreadyScheduled()\":[{\"details\":\"Error thrown when attempting to schedule an already scheduled event.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrCooldownTimeNotYetEnded()\":[{\"details\":\"Error thrown when attempting an action before the cooldown period has ended.\"}],\"ErrEndBlockOutOfRange()\":[{\"details\":\"Error thrown when the end block of a schedule is out of range.\"}],\"ErrInvalidMaintenanceDuration()\":[{\"details\":\"Error thrown when an invalid maintenance duration is specified.\"}],\"ErrInvalidMaintenanceDurationConfig()\":[{\"details\":\"Error thrown when an invalid maintenance duration configuration is provided.\"}],\"ErrInvalidOffsetToStartScheduleConfigs()\":[{\"details\":\"Error thrown when an invalid offset is specified to start the schedule configurations.\"}],\"ErrStartBlockOutOfRange()\":[{\"details\":\"Error thrown when the start block of a schedule is out of range.\"}],\"ErrTotalOfSchedulesExceeded()\":[{\"details\":\"Error thrown when the total number of schedules exceeds the limit.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnexistedSchedule()\":[{\"details\":\"Error thrown when referring to a non-existent schedule.\"}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"cancelSchedule(address)\":{\"details\":\"Cancel the schedule of maintenance for the `_consensusAddr`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - A schedule for the `_consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`.\"},\"checkCooldownEnds(address)\":{\"details\":\"Returns whether the validator `_consensusAddr`\"},\"checkMaintained(address,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\"},\"checkMaintainedInBlockRange(address,uint256,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\"},\"checkManyMaintained(address[],uint256)\":{\"details\":\"Returns the bool array indicating the validators maintained at block number `_block` or not.\"},\"checkManyMaintainedInBlockRange(address[],uint256,uint256)\":{\"details\":\"Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\"},\"checkScheduled(address)\":{\"details\":\"Returns whether the validator `_consensusAddr` has scheduled.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getSchedule(address)\":{\"details\":\"Returns the detailed schedule of the validator `_consensusAddr`.\"},\"initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"schedule(address,uint256,uint256)\":{\"details\":\"Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - The candidate `_consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`.\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`.\"},\"totalSchedules()\":{\"details\":\"Returns the total of current schedules.\"}},\"stateVariables\":{\"_schedule\":{\"details\":\"Mapping from consensus address => maintenance schedule.\"},\"cooldownSecsToMaintain\":{\"details\":\"The cooldown time to request new schedule.\"},\"maxMaintenanceDurationInBlock\":{\"details\":\"The max duration to maintenance in blocks.\"},\"maxOffsetToStartSchedule\":{\"details\":\"The offset to the max block number that the schedule can start.\"},\"maxSchedules\":{\"details\":\"The max number of scheduled maintenances.\"},\"minMaintenanceDurationInBlock\":{\"details\":\"The min duration to maintenance in blocks.\"},\"minOffsetToStartSchedule\":{\"details\":\"The offset to the min block number that the schedule can start.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/Maintenance.sol\":\"Maintenance\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x06e5962713a77abf6d5ba646e1cc1cfb6f9c50e7d52520dd82a10bf309534187\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n /**\\n * @dev Error thrown when attempting to schedule an already scheduled event.\\n */\\n error ErrAlreadyScheduled();\\n\\n /**\\n * @dev Error thrown when referring to a non-existent schedule.\\n */\\n error ErrUnexistedSchedule();\\n\\n /**\\n * @dev Error thrown when the end block of a schedule is out of range.\\n */\\n error ErrEndBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when the start block of a schedule is out of range.\\n */\\n error ErrStartBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\\n */\\n error ErrAlreadyOnMaintenance();\\n\\n /**\\n * @dev Error thrown when attempting an action before the cooldown period has ended.\\n */\\n error ErrCooldownTimeNotYetEnded();\\n\\n /**\\n * @dev Error thrown when the total number of schedules exceeds the limit.\\n */\\n error ErrTotalOfSchedulesExceeded();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration is specified.\\n */\\n error ErrInvalidMaintenanceDuration();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\\n */\\n error ErrInvalidMaintenanceDurationConfig();\\n\\n /**\\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\\n */\\n error ErrInvalidOffsetToStartScheduleConfigs();\\n\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(address _consensusAddr, uint256 _startedAtBlock, uint256 _endedAtBlock) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0xd399a23652fc0180280f0079dd4be420d807774bcf6bc12672f4238480e757e9\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address ______deprecatedbridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address _consensusAddr, uint256 _effectiveTimestamp, uint256 _rate) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0x9ab205c736f1bcc9a3debe06e08d829f4857141d940e6f608236f136193a7f49\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x3fdfa86da33b889e5153075ffc028d6b0c607480a96b532fbbbc48ac7bbf27c9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n address _addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n address _addr,\\n uint256 _blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2b1846b05ca1d636299fb929c1bd7b392b236f5e3f7aa3e7eea2c6d57b8836fb\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /**\\n * @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n */\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x6213c188a1323b242a098394b91caf9481e257bd57a0804cb2aa890377a993ed\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\"},\"contracts/ronin/Maintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IMaintenance.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../utils/DeprecatedSlots.sol\\\";\\nimport { ErrUnauthorized, RoleAccess } from \\\"../utils/CommonErrors.sol\\\";\\n\\ncontract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Initializable {\\n using Math for uint256;\\n\\n /// @dev Mapping from consensus address => maintenance schedule.\\n mapping(address => Schedule) internal _schedule;\\n\\n /// @dev The min duration to maintenance in blocks.\\n uint256 public minMaintenanceDurationInBlock;\\n /// @dev The max duration to maintenance in blocks.\\n uint256 public maxMaintenanceDurationInBlock;\\n /// @dev The offset to the min block number that the schedule can start.\\n uint256 public minOffsetToStartSchedule;\\n /// @dev The offset to the max block number that the schedule can start.\\n uint256 public maxOffsetToStartSchedule;\\n /// @dev The max number of scheduled maintenances.\\n uint256 public maxSchedules;\\n /// @dev The cooldown time to request new schedule.\\n uint256 public cooldownSecsToMaintain;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external initializer {\\n _setContract(ContractType.VALIDATOR, __validatorContract);\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n function initializeV2() external reinitializer(2) {\\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\\n delete ______deprecatedValidator;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external onlyAdmin {\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function schedule(address _consensusAddr, uint256 _startedAtBlock, uint256 _endedAtBlock) external override {\\n IRoninValidatorSet _validator = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n\\n if (!_validator.isBlockProducer(_consensusAddr)) revert ErrUnauthorized(msg.sig, RoleAccess.BLOCK_PRODUCER);\\n if (!_validator.isCandidateAdmin(_consensusAddr, msg.sender))\\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\\n if (checkScheduled(_consensusAddr)) revert ErrAlreadyScheduled();\\n if (!checkCooldownEnds(_consensusAddr)) revert ErrCooldownTimeNotYetEnded();\\n if (totalSchedules() >= maxSchedules) revert ErrTotalOfSchedulesExceeded();\\n if (!_startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule)) {\\n revert ErrStartBlockOutOfRange();\\n }\\n if (_startedAtBlock >= _endedAtBlock) revert ErrStartBlockOutOfRange();\\n\\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\\n\\n if (!_maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock)) {\\n revert ErrInvalidMaintenanceDuration();\\n }\\n if (!_validator.epochEndingAt(_startedAtBlock - 1)) revert ErrStartBlockOutOfRange();\\n if (!_validator.epochEndingAt(_endedAtBlock)) revert ErrEndBlockOutOfRange();\\n\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n _sSchedule.from = _startedAtBlock;\\n _sSchedule.to = _endedAtBlock;\\n _sSchedule.lastUpdatedBlock = block.number;\\n _sSchedule.requestTimestamp = block.timestamp;\\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cancelSchedule(address _consensusAddr) external override {\\n if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(_consensusAddr, msg.sender)) {\\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\\n }\\n if (!checkScheduled(_consensusAddr)) revert ErrUnexistedSchedule();\\n if (checkMaintained(_consensusAddr, block.number)) revert ErrAlreadyOnMaintenance();\\n\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n delete _sSchedule.from;\\n delete _sSchedule.to;\\n _sSchedule.lastUpdatedBlock = block.number;\\n emit MaintenanceScheduleCancelled(_consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\\n return _schedule[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintained(\\n address[] calldata _addrList,\\n uint256 _block\\n ) external view override returns (bool[] memory _resList) {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; ) {\\n _resList[_i] = checkMaintained(_addrList[_i], _block);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view override returns (bool[] memory _resList) {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; ) {\\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function totalSchedules() public view override returns (uint256 _count) {\\n address[] memory _validators = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).getValidators();\\n unchecked {\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n if (checkScheduled(_validators[_i])) {\\n _count++;\\n }\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return _s.from <= _block && _block <= _s.to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) public view override returns (bool) {\\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\\n return block.number <= _schedule[_consensusAddr].to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @dev Sets the min block period and max block period to maintenance.\\n *\\n * Requirements:\\n * - The max period is larger than the min period.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function _setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) internal {\\n if (_minMaintenanceDurationInBlock >= _maxMaintenanceDurationInBlock) revert ErrInvalidMaintenanceDurationConfig();\\n if (_minOffsetToStartSchedule >= _maxOffsetToStartSchedule) revert ErrInvalidOffsetToStartScheduleConfigs();\\n\\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\\n maxSchedules = _maxSchedules;\\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\\n emit MaintenanceConfigUpdated(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @dev Check if the validator was maintaining in the current period.\\n *\\n * Note: This method should be called at the end of the period.\\n */\\n function _maintainingInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) private view returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\\n }\\n}\\n\",\"keccak256\":\"0xd4fa863b8470741561fcb795b7de51e4571c62a890f773cc391275670bc48b98\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\",\"keccak256\":\"0x951a466bb76f385554960531e63e64a5bd314df341bb6c95e6e81448d6984ac0\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD\\n}\\n\",\"keccak256\":\"0xf72feff9afafcb5cadc1b05c6e0b998ea5d66c7ece57c3e482e560d0a1bb4079\",\"license\":\"MIT\"},\"contracts/utils/DeprecatedSlots.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Deprecated Contracts\\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\\n * They provide functionality related to various aspects of a smart contract but have been marked\\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\\n */\\ncontract HasSlashIndicatorDeprecated {\\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\\n address internal ______deprecatedSlashIndicator;\\n}\\n\\ncontract HasStakingVestingDeprecated {\\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\\n address internal ______deprecatedStakingVesting;\\n}\\n\\ncontract HasBridgeDeprecated {\\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\\n address internal ______deprecatedBridge;\\n}\\n\\ncontract HasValidatorDeprecated {\\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\\n address internal ______deprecatedValidator;\\n}\\n\\ncontract HasStakingDeprecated {\\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\\n address internal ______deprecatedStakingContract;\\n}\\n\\ncontract HasMaintenanceDeprecated {\\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\\n address internal ______deprecatedMaintenance;\\n}\\n\\ncontract HasTrustedOrgDeprecated {\\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\\n address internal ______deprecatedTrustedOrg;\\n}\\n\\ncontract HasGovernanceAdminDeprecated {\\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\\n address internal ______deprecatedGovernanceAdmin;\\n}\\n\\ncontract HasBridgeTrackingDeprecated {\\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\\n address internal ______deprecatedBridgeTracking;\\n}\\n\",\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface.\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n * @notice If the contract does not support the interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n if (!IERC165(contractAddr).supportsInterface(interfaceId)) {\\n revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2e1aef91018590d52fa9ca9e63708c8ef3e9ee7061e8947d4bb30b07d721a229\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE\\n}\\n\",\"keccak256\":\"0xa98cec38c640c4e37f475debbcd366226f1188c3f5ea6e29de768bd33e021873\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611547806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063b59f403e116100b8578063c44cb2331161007c578063c44cb2331461024d578063d39fee3414610256578063de981f1b1461029c578063dec36284146102c7578063f0caaafb146102d0578063fdadda81146102e357600080fd5b8063b59f403e146101f5578063ba30375514610208578063bc1710e914610228578063bfa89b9b14610231578063c09fe4601461023a57600080fd5b80635cd8a76b116100ff5780635cd8a76b146101b65780637a50802d146101be5780638142951a146101c7578063865e6fd3146101da578063965720af146101ed57600080fd5b8063088e8de71461013c57806309e34c38146101645780630fbeb37f1461017b5780632d538c2c1461018e5780632ddc08a2146101a3575b600080fd5b61014f61014a366004611087565b6102f6565b60405190151581526020015b60405180910390f35b61016d60025481565b60405190815260200161015b565b61014f6101893660046110bc565b61030b565b6101a161019c366004611087565b610342565b005b61014f6101b13660046110e8565b610756565b6101a1610778565b61016d60055481565b6101a16101d536600461110c565b610848565b6101a16101e8366004611170565b610945565b61016d610964565b61014f6102033660046110e8565b610a1f565b61021b6102163660046111f3565b610a51565b60405161015b9190611244565b61016d60045481565b61016d60035481565b6101a161024836600461128a565b610b07565b61016d60065481565b6102696102643660046110e8565b610b25565b60405161015b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b6102af6102aa3660046112cd565b610b9d565b6040516001600160a01b03909116815260200161015b565b61016d60075481565b6101a16102de3660046110e8565b610c18565b61021b6102f13660046112e8565b610d64565b6000610303848484610e18565b949350505050565b6001600160a01b038216600090815260016020526040812080548310801590610338575080600101548311155b9150505b92915050565b600061034e6008610b9d565b604051633292276760e11b81526001600160a01b038681166004830152919250908216906365244ece90602401602060405180830381865afa158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc9190611334565b6103f2576000356001600160e01b0319166007604051620f948f60ea1b81526004016103e992919061136c565b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b0385811660048301523360248301528216906304d971ab90604401602060405180830381865afa15801561043e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104629190611334565b61048f576000356001600160e01b0319166004604051620f948f60ea1b81526004016103e992919061136c565b61049884610756565b156104b65760405163b194497760e01b815260040160405180910390fd5b6104bf84610a1f565b6104dc5760405163207dfd7760e11b815260040160405180910390fd5b6006546104e7610964565b106105055760405163437494d360e01b815260040160405180910390fd5b61052b6004544361051691906113b0565b60055461052390436113b0565b859190610e50565b610548576040516301f19fb760e61b815260040160405180910390fd5b818310610568576040516301f19fb760e61b815260040160405180910390fd5b600061057484846113c3565b61057f9060016113b0565b905061059a60025460035483610e509092919063ffffffff16565b6105b75760405163a1f1aaf560e01b815260040160405180910390fd5b6001600160a01b038216637593ff716105d16001876113c3565b6040518263ffffffff1660e01b81526004016105ef91815260200190565b602060405180830381865afa15801561060c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106309190611334565b61064d576040516301f19fb760e61b815260040160405180910390fd5b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa158015610692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b69190611334565b6106d35760405163ec67bbc560e01b815260040160405180910390fd5b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600290600160a81b900460ff161580156107a3575060005460ff808316600160a01b90920416105b6107bf5760405162461bcd60e51b81526004016103e9906113d6565b6000805460ff60a81b1960ff8416600160a01b021661ffff60a01b1990911617600160a81b17908190556107fe906008906001600160a01b0316610e67565b60008054600161ff0160a01b031916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b600054600160a81b900460ff161580801561087057506000546001600160a01b90910460ff16105b806108915750303b1580156108915750600054600160a01b900460ff166001145b6108ad5760405162461bcd60e51b81526004016103e9906113d6565b6000805460ff60a01b1916600160a01b17905580156108da576000805460ff60a81b1916600160a81b1790555b6108e5600889610e67565b6108f3878787878787610f0b565b801561093b576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b61094d610fc7565b61095681611023565b6109608282610e67565b5050565b6000806109716008610b9d565b6001600160a01b031663b7ab4db56040518163ffffffff1660e01b8152600401600060405180830381865afa1580156109ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d69190810190611445565b905060005b8151811015610a1a57610a068282815181106109f9576109f961150a565b6020026020010151610756565b15610a12576001909201915b6001016109db565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610a49916113b0565b421192915050565b60608367ffffffffffffffff811115610a6c57610a6c611424565b604051908082528060200260200182016040528015610a95578160200160208202803683370190505b50905060005b84811015610afe57610ad4868683818110610ab857610ab861150a565b9050602002016020810190610acd91906110e8565b8585610e18565b828281518110610ae657610ae661150a565b91151560209283029190910190910152600101610a9b565b50949350505050565b610b0f610fc7565b610b1d868686868686610f0b565b505050505050565b610b506040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600d811115610bd457610bd4611356565b60ff1681526020810191909152604001600020546001600160a01b0316905080610c13578160405163409140df60e11b81526004016103e99190611520565b919050565b610c226008610b9d565b6040516304d971ab60e01b81526001600160a01b03838116600483015233602483015291909116906304d971ab90604401602060405180830381865afa158015610c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c949190611334565b610cc1576000356001600160e01b0319166004604051620f948f60ea1b81526004016103e992919061136c565b610cca81610756565b610ce75760405163f7050bef60e01b815260040160405180910390fd5b610cf1814361030b565b15610d0f5760405163070dff8360e01b815260040160405180910390fd5b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b60608267ffffffffffffffff811115610d7f57610d7f611424565b604051908082528060200260200182016040528015610da8578160200160208202803683370190505b50905060005b83811015610e1057610de6858583818110610dcb57610dcb61150a565b9050602002016020810190610de091906110e8565b8461030b565b828281518110610df857610df861150a565b91151560209283029190910190910152600101610dae565b509392505050565b6001600160a01b038316600090815260016020819052604082208054918101549091610e47918691869161105c565b95945050505050565b600083831115801561030357505090911115919050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600d811115610e9d57610e9d611356565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600d811115610ede57610ede611356565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b848610610f2b576040516338f4062560e11b815260040160405180910390fd5b828410610f4b576040516316c7c7ef60e31b815260040160405180910390fd5b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611021576000356001600160e01b0319166001604051620f948f60ea1b81526004016103e992919061136c565b565b806001600160a01b03163b60000361105957604051630bfc64a360e21b81526001600160a01b03821660048201526024016103e9565b50565b6000818511158015610e47575050501115919050565b6001600160a01b038116811461105957600080fd5b60008060006060848603121561109c57600080fd5b83356110a781611072565b95602085013595506040909401359392505050565b600080604083850312156110cf57600080fd5b82356110da81611072565b946020939093013593505050565b6000602082840312156110fa57600080fd5b813561110581611072565b9392505050565b600080600080600080600060e0888a03121561112757600080fd5b873561113281611072565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b8035600e8110610c1357600080fd5b6000806040838503121561118357600080fd5b61118c83611161565b9150602083013561119c81611072565b809150509250929050565b60008083601f8401126111b957600080fd5b50813567ffffffffffffffff8111156111d157600080fd5b6020830191508360208260051b85010111156111ec57600080fd5b9250929050565b6000806000806060858703121561120957600080fd5b843567ffffffffffffffff81111561122057600080fd5b61122c878288016111a7565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561127e578351151583529284019291840191600101611260565b50909695505050505050565b60008060008060008060c087890312156112a357600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000602082840312156112df57600080fd5b61110582611161565b6000806000604084860312156112fd57600080fd5b833567ffffffffffffffff81111561131457600080fd5b611320868287016111a7565b909790965060209590950135949350505050565b60006020828403121561134657600080fd5b8151801515811461110557600080fd5b634e487b7160e01b600052602160045260246000fd5b6001600160e01b031983168152604081016009831061138d5761138d611356565b8260208301529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561033c5761033c61139a565b8181038181111561033c5761033c61139a565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b8051610c1381611072565b6000602080838503121561145857600080fd5b825167ffffffffffffffff8082111561147057600080fd5b818501915085601f83011261148457600080fd5b81518181111561149657611496611424565b8060051b604051601f19603f830116810181811085821117156114bb576114bb611424565b6040529182528482019250838101850191888311156114d957600080fd5b938501935b828510156114fe576114ef8561143a565b845293850193928501926114de565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60208101600e831061153457611534611356565b9190529056fea164736f6c6343000811000a", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063b59f403e116100b8578063c44cb2331161007c578063c44cb2331461024d578063d39fee3414610256578063de981f1b1461029c578063dec36284146102c7578063f0caaafb146102d0578063fdadda81146102e357600080fd5b8063b59f403e146101f5578063ba30375514610208578063bc1710e914610228578063bfa89b9b14610231578063c09fe4601461023a57600080fd5b80635cd8a76b116100ff5780635cd8a76b146101b65780637a50802d146101be5780638142951a146101c7578063865e6fd3146101da578063965720af146101ed57600080fd5b8063088e8de71461013c57806309e34c38146101645780630fbeb37f1461017b5780632d538c2c1461018e5780632ddc08a2146101a3575b600080fd5b61014f61014a366004611087565b6102f6565b60405190151581526020015b60405180910390f35b61016d60025481565b60405190815260200161015b565b61014f6101893660046110bc565b61030b565b6101a161019c366004611087565b610342565b005b61014f6101b13660046110e8565b610756565b6101a1610778565b61016d60055481565b6101a16101d536600461110c565b610848565b6101a16101e8366004611170565b610945565b61016d610964565b61014f6102033660046110e8565b610a1f565b61021b6102163660046111f3565b610a51565b60405161015b9190611244565b61016d60045481565b61016d60035481565b6101a161024836600461128a565b610b07565b61016d60065481565b6102696102643660046110e8565b610b25565b60405161015b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b6102af6102aa3660046112cd565b610b9d565b6040516001600160a01b03909116815260200161015b565b61016d60075481565b6101a16102de3660046110e8565b610c18565b61021b6102f13660046112e8565b610d64565b6000610303848484610e18565b949350505050565b6001600160a01b038216600090815260016020526040812080548310801590610338575080600101548311155b9150505b92915050565b600061034e6008610b9d565b604051633292276760e11b81526001600160a01b038681166004830152919250908216906365244ece90602401602060405180830381865afa158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc9190611334565b6103f2576000356001600160e01b0319166007604051620f948f60ea1b81526004016103e992919061136c565b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b0385811660048301523360248301528216906304d971ab90604401602060405180830381865afa15801561043e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104629190611334565b61048f576000356001600160e01b0319166004604051620f948f60ea1b81526004016103e992919061136c565b61049884610756565b156104b65760405163b194497760e01b815260040160405180910390fd5b6104bf84610a1f565b6104dc5760405163207dfd7760e11b815260040160405180910390fd5b6006546104e7610964565b106105055760405163437494d360e01b815260040160405180910390fd5b61052b6004544361051691906113b0565b60055461052390436113b0565b859190610e50565b610548576040516301f19fb760e61b815260040160405180910390fd5b818310610568576040516301f19fb760e61b815260040160405180910390fd5b600061057484846113c3565b61057f9060016113b0565b905061059a60025460035483610e509092919063ffffffff16565b6105b75760405163a1f1aaf560e01b815260040160405180910390fd5b6001600160a01b038216637593ff716105d16001876113c3565b6040518263ffffffff1660e01b81526004016105ef91815260200190565b602060405180830381865afa15801561060c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106309190611334565b61064d576040516301f19fb760e61b815260040160405180910390fd5b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa158015610692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b69190611334565b6106d35760405163ec67bbc560e01b815260040160405180910390fd5b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600290600160a81b900460ff161580156107a3575060005460ff808316600160a01b90920416105b6107bf5760405162461bcd60e51b81526004016103e9906113d6565b6000805460ff60a81b1960ff8416600160a01b021661ffff60a01b1990911617600160a81b17908190556107fe906008906001600160a01b0316610e67565b60008054600161ff0160a01b031916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b600054600160a81b900460ff161580801561087057506000546001600160a01b90910460ff16105b806108915750303b1580156108915750600054600160a01b900460ff166001145b6108ad5760405162461bcd60e51b81526004016103e9906113d6565b6000805460ff60a01b1916600160a01b17905580156108da576000805460ff60a81b1916600160a81b1790555b6108e5600889610e67565b6108f3878787878787610f0b565b801561093b576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b61094d610fc7565b61095681611023565b6109608282610e67565b5050565b6000806109716008610b9d565b6001600160a01b031663b7ab4db56040518163ffffffff1660e01b8152600401600060405180830381865afa1580156109ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d69190810190611445565b905060005b8151811015610a1a57610a068282815181106109f9576109f961150a565b6020026020010151610756565b15610a12576001909201915b6001016109db565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610a49916113b0565b421192915050565b60608367ffffffffffffffff811115610a6c57610a6c611424565b604051908082528060200260200182016040528015610a95578160200160208202803683370190505b50905060005b84811015610afe57610ad4868683818110610ab857610ab861150a565b9050602002016020810190610acd91906110e8565b8585610e18565b828281518110610ae657610ae661150a565b91151560209283029190910190910152600101610a9b565b50949350505050565b610b0f610fc7565b610b1d868686868686610f0b565b505050505050565b610b506040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600d811115610bd457610bd4611356565b60ff1681526020810191909152604001600020546001600160a01b0316905080610c13578160405163409140df60e11b81526004016103e99190611520565b919050565b610c226008610b9d565b6040516304d971ab60e01b81526001600160a01b03838116600483015233602483015291909116906304d971ab90604401602060405180830381865afa158015610c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c949190611334565b610cc1576000356001600160e01b0319166004604051620f948f60ea1b81526004016103e992919061136c565b610cca81610756565b610ce75760405163f7050bef60e01b815260040160405180910390fd5b610cf1814361030b565b15610d0f5760405163070dff8360e01b815260040160405180910390fd5b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b60608267ffffffffffffffff811115610d7f57610d7f611424565b604051908082528060200260200182016040528015610da8578160200160208202803683370190505b50905060005b83811015610e1057610de6858583818110610dcb57610dcb61150a565b9050602002016020810190610de091906110e8565b8461030b565b828281518110610df857610df861150a565b91151560209283029190910190910152600101610dae565b509392505050565b6001600160a01b038316600090815260016020819052604082208054918101549091610e47918691869161105c565b95945050505050565b600083831115801561030357505090911115919050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600d811115610e9d57610e9d611356565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600d811115610ede57610ede611356565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b848610610f2b576040516338f4062560e11b815260040160405180910390fd5b828410610f4b576040516316c7c7ef60e31b815260040160405180910390fd5b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611021576000356001600160e01b0319166001604051620f948f60ea1b81526004016103e992919061136c565b565b806001600160a01b03163b60000361105957604051630bfc64a360e21b81526001600160a01b03821660048201526024016103e9565b50565b6000818511158015610e47575050501115919050565b6001600160a01b038116811461105957600080fd5b60008060006060848603121561109c57600080fd5b83356110a781611072565b95602085013595506040909401359392505050565b600080604083850312156110cf57600080fd5b82356110da81611072565b946020939093013593505050565b6000602082840312156110fa57600080fd5b813561110581611072565b9392505050565b600080600080600080600060e0888a03121561112757600080fd5b873561113281611072565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b8035600e8110610c1357600080fd5b6000806040838503121561118357600080fd5b61118c83611161565b9150602083013561119c81611072565b809150509250929050565b60008083601f8401126111b957600080fd5b50813567ffffffffffffffff8111156111d157600080fd5b6020830191508360208260051b85010111156111ec57600080fd5b9250929050565b6000806000806060858703121561120957600080fd5b843567ffffffffffffffff81111561122057600080fd5b61122c878288016111a7565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561127e578351151583529284019291840191600101611260565b50909695505050505050565b60008060008060008060c087890312156112a357600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000602082840312156112df57600080fd5b61110582611161565b6000806000604084860312156112fd57600080fd5b833567ffffffffffffffff81111561131457600080fd5b611320868287016111a7565b909790965060209590950135949350505050565b60006020828403121561134657600080fd5b8151801515811461110557600080fd5b634e487b7160e01b600052602160045260246000fd5b6001600160e01b031983168152604081016009831061138d5761138d611356565b8260208301529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561033c5761033c61139a565b8181038181111561033c5761033c61139a565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b8051610c1381611072565b6000602080838503121561145857600080fd5b825167ffffffffffffffff8082111561147057600080fd5b818501915085601f83011261148457600080fd5b81518181111561149657611496611424565b8060051b604051601f19603f830116810181811085821117156114bb576114bb611424565b6040529182528482019250838101850191888311156114d957600080fd5b938501935b828510156114fe576114ef8561143a565b845293850193928501926114de565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60208101600e831061153457611534611356565b9190529056fea164736f6c6343000811000a", + "numDeployments": 8, + "solcInputHash": "b469203c60a069be0ec276c20622629d", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyOnMaintenance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyScheduled\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCooldownTimeNotYetEnded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrEndBlockOutOfRange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaintenanceDuration\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaintenanceDurationConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidOffsetToStartScheduleConfigs\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStartBlockOutOfRange\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTotalOfSchedulesExceeded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnexistedSchedule\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSchedules\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"MaintenanceConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"MaintenanceScheduleCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"MaintenanceScheduled\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"cancelSchedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"checkCooldownEnded\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"atBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintained\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"candidateId\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"atBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedById\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"atBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintained\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"idList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"atBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedById\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"idList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRangeById\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"checkScheduled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToMaintain\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"getSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSchedule_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain_\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"profileContract_\",\"type\":\"address\"}],\"name\":\"initializeV3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"startedAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endedAtBlock\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSchedule_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain_\",\"type\":\"uint256\"}],\"name\":\"setMaintenanceConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyOnMaintenance()\":[{\"details\":\"Error thrown when attempting to initiate maintenance while already in maintenance mode.\"}],\"ErrAlreadyScheduled()\":[{\"details\":\"Error thrown when attempting to schedule an already scheduled event.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrCooldownTimeNotYetEnded()\":[{\"details\":\"Error thrown when attempting an action before the cooldown period has ended.\"}],\"ErrEndBlockOutOfRange()\":[{\"details\":\"Error thrown when the end block of a schedule is out of range.\"}],\"ErrInvalidMaintenanceDuration()\":[{\"details\":\"Error thrown when an invalid maintenance duration is specified.\"}],\"ErrInvalidMaintenanceDurationConfig()\":[{\"details\":\"Error thrown when an invalid maintenance duration configuration is provided.\"}],\"ErrInvalidOffsetToStartScheduleConfigs()\":[{\"details\":\"Error thrown when an invalid offset is specified to start the schedule configurations.\"}],\"ErrStartBlockOutOfRange()\":[{\"details\":\"Error thrown when the start block of a schedule is out of range.\"}],\"ErrTotalOfSchedulesExceeded()\":[{\"details\":\"Error thrown when the total number of schedules exceeds the limit.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnexistedSchedule()\":[{\"details\":\"Error thrown when referring to a non-existent schedule.\"}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"events\":{\"ContractUpdated(uint8,address)\":{\"details\":\"Emitted when a contract is updated.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"MaintenanceConfigUpdated(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Emitted when the maintenance config is updated.\"},\"MaintenanceScheduleCancelled(address)\":{\"details\":\"Emitted when a schedule of maintenance is cancelled.\"},\"MaintenanceScheduled(address,(uint256,uint256,uint256,uint256))\":{\"details\":\"Emitted when a maintenance is scheduled.\"}},\"kind\":\"dev\",\"methods\":{\"cancelSchedule(address)\":{\"details\":\"Cancel the schedule of maintenance for the `consensusAddr`. Requirements: - The candidate `consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `consensusAddr`. - A schedule for the `consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`.\"},\"checkCooldownEnded(address)\":{\"details\":\"Returns whether the validator `consensusAddr` has finished cooldown.\"},\"checkMaintained(address,uint256)\":{\"details\":\"Returns whether the validator `consensusAddr` maintained at the block number `_block`.\"},\"checkMaintainedInBlockRange(address,uint256,uint256)\":{\"details\":\"Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\"},\"checkManyMaintained(address[],uint256)\":{\"details\":\"Returns the bool array indicating the validators maintained at block number `k` or not.\"},\"checkManyMaintainedInBlockRange(address[],uint256,uint256)\":{\"details\":\"Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\"},\"checkScheduled(address)\":{\"details\":\"Returns whether the validator `consensusAddr` has schedule.\"},\"cooldownSecsToMaintain()\":{\"details\":\"Returns the cooldown to maintain in seconds.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getSchedule(address)\":{\"details\":\"Returns the detailed schedule of the validator `consensusAddr`.\"},\"initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"maxMaintenanceDurationInBlock()\":{\"details\":\"Returns the max duration for maintenance in block.\"},\"maxOffsetToStartSchedule()\":{\"details\":\"The offset to the max block number that the schedule can start\"},\"maxSchedule()\":{\"details\":\"Returns the max number of scheduled maintenances.\"},\"minMaintenanceDurationInBlock()\":{\"details\":\"Returns the min duration for maintenance in block.\"},\"minOffsetToStartSchedule()\":{\"details\":\"The offset to the min block number that the schedule can start\"},\"schedule(address,uint256,uint256)\":{\"details\":\"Schedules for maintenance from `startedAtBlock` to `endedAtBlock`. Requirements: - The candidate `consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `consensusAddr`. - The candidate `consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`.\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`.\"},\"totalSchedule()\":{\"details\":\"Returns the total of current schedules.\"}},\"stateVariables\":{\"_cooldownSecsToMaintain\":{\"details\":\"The cooldown time to request new schedule.\"},\"_maxMaintenanceDurationInBlock\":{\"details\":\"The max duration to maintenance in blocks.\"},\"_maxOffsetToStartSchedule\":{\"details\":\"The offset to the max block number that the schedule can start.\"},\"_maxSchedule\":{\"details\":\"The max number of scheduled maintenances.\"},\"_minMaintenanceDurationInBlock\":{\"details\":\"The min duration to maintenance in blocks.\"},\"_minOffsetToStartSchedule\":{\"details\":\"The offset to the min block number that the schedule can start.\"},\"_schedule\":{\"details\":\"Mapping from candidate id => maintenance schedule.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/Maintenance.sol\":\"Maintenance\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../udvts/Types.sol\\\";\\n\\ninterface IMaintenance {\\n /**\\n * @dev Error thrown when attempting to schedule an already scheduled event.\\n */\\n error ErrAlreadyScheduled();\\n\\n /**\\n * @dev Error thrown when referring to a non-existent schedule.\\n */\\n error ErrUnexistedSchedule();\\n\\n /**\\n * @dev Error thrown when the end block of a schedule is out of range.\\n */\\n error ErrEndBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when the start block of a schedule is out of range.\\n */\\n error ErrStartBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\\n */\\n error ErrAlreadyOnMaintenance();\\n\\n /**\\n * @dev Error thrown when attempting an action before the cooldown period has ended.\\n */\\n error ErrCooldownTimeNotYetEnded();\\n\\n /**\\n * @dev Error thrown when the total number of schedules exceeds the limit.\\n */\\n error ErrTotalOfSchedulesExceeded();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration is specified.\\n */\\n error ErrInvalidMaintenanceDuration();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\\n */\\n error ErrInvalidMaintenanceDurationConfig();\\n\\n /**\\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\\n */\\n error ErrInvalidOffsetToStartScheduleConfigs();\\n\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(TConsensus indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(TConsensus indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(TConsensus consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator whose id `validatorId` maintained at the block number `_block`.\\n */\\n function checkMaintainedById(address validatorId, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n TConsensus consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `k` or not.\\n */\\n function checkManyMaintained(\\n TConsensus[] calldata consensusAddrList,\\n uint256 atBlock\\n ) external view returns (bool[] memory);\\n\\n function checkManyMaintainedById(\\n address[] calldata candidateIdList,\\n uint256 atBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n TConsensus[] calldata _consensusAddrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n function checkManyMaintainedInBlockRangeById(\\n address[] calldata idList,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` has finished cooldown.\\n */\\n function checkCooldownEnded(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` has schedule.\\n */\\n function checkScheduled(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `consensusAddr`.\\n */\\n function getSchedule(TConsensus consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedule() external view returns (uint256 count);\\n\\n /**\\n * @dev Returns the cooldown to maintain in seconds.\\n */\\n function cooldownSecsToMaintain() external view returns (uint256);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 minMaintenanceDurationInBlock_,\\n uint256 maxMaintenanceDurationInBlock_,\\n uint256 minOffsetToStartSchedule_,\\n uint256 maxOffsetToStartSchedule_,\\n uint256 maxSchedules_,\\n uint256 cooldownSecsToMaintain_\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `startedAtBlock` to `endedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `consensusAddr`.\\n * - The candidate `consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `consensusAddr`.\\n * - A schedule for the `consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(TConsensus consensusAddr) external;\\n}\\n\",\"keccak256\":\"0xa0e68b1e94b0d7ea96578ad759e1116a3299059cf7d376b8e2556687d1ef63f0\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../udvts/Types.sol\\\";\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n TConsensus consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address __reservedGovernor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n /// @dev Event emitted when the pubkey of the `id` is changed.\\n event PubkeyChanged(address indexed id, bytes pubkey);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n /// @dev Error when create a new profile whose id and consensus are not identical.\\n error ErrIdAndConsensusDiffer();\\n /**\\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\\n * and with value type of `infoType`.\\n */\\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\\n error ErrDuplicatedPubkey(bytes pubkey);\\n error ErrZeroAddress(RoleAccess infoType);\\n error ErrZeroPubkey();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\\n\\n /// @dev Getter to backward query from `consensus` address to `id` address.\\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\\n\\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\\n * applying for candidate role.\\n *\\n * Requirements:\\n * - Only `stakingContract` can call this method.\\n */\\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\\n\\n /**\\n * @notice The candidate admin changes the public key.\\n *\\n * @dev Requirements:\\n * - The profile must be existed.\\n * - Only user with candidate admin role can call this method.\\n * - New public key must not be duplicated.\\n */\\n\\n function changePubkey(address id, bytes memory pubkey) external;\\n}\\n\",\"keccak256\":\"0x14dfb3198bf21724f5315198e1b23564902821ef56730c7db49e3d1165a36d36\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n /**\\n * @dev The address of the candidate admin.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\\n */\\n address __shadowedAdmin;\\n /**\\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\\n */\\n TConsensus __shadowedConsensus;\\n /**\\n * @dev Address that receives mining reward of the validator\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\\n */\\n address payable __shadowedTreasury;\\n /// @dev Address of the bridge operator corresponding to the candidate\\n address ____deprecatedBridgeOperatorAddr;\\n /**\\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\\n * Values in range [0; 100_00] stands for 0-100%\\n */\\n uint256 commissionRate;\\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnward() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xd797160208b17456231633415848fffa0a5ba7e9ab7f81b241d1bd89c74c2c83\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManagerCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManagerCallback {\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address candidateAdmin,\\n address cid,\\n address payable treasuryAddr,\\n uint256 commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\\n * This updates the shadow storage slot of \\\"shadowedAdmin\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeAdminAddress(address cid, address newAdmin) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n * This updates the shadow storage slot of \\\"shadowedConsensus\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\\n * This updates the shadow storage slot of \\\"shadowedTreasury\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\\n}\\n\",\"keccak256\":\"0x0f241310c7f284374c26792fe73230a3b2cabc709d04f28a7b366292821f96dc\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the fast finality reward is distributed.\\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\\n event FastFinalityRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n /// @dev Error thrown when the info of releasing locked fund not exist.\\n error ErrLockedFundReleaseInfoNotFound(address cid);\\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\\n error ErrLockedFundMightBeRecycled(address cid);\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x98caa14d1e6dc6a9ab6d09c864a32790014890f9e2ad7951b77ff5658e0f7c8b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./ICandidateManagerCallback.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManagerCallback,\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0xf4f96a624e7c77bbce044c67e3f4b406e65871debc19e7bfab663c1fcfcbc7b0\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed cid,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed cid, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address cid, uint256 period) external;\\n}\\n\",\"keccak256\":\"0xbf540beae3c94d2b42e7bbb74f921086c23613fa4db43a5ca5310cb179b46d5e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xb63c6a5edcc82cc04af534e8398eee9a805bb9cb179f3e00750e6ff92354bed9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(TConsensus) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n TConsensus addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n TConsensus addr,\\n uint256 blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\\n\\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x27afa712094804b997f55e8f8d320760e07d7260ab33aeb8fb61c39849f09bf3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport { TConsensus } from \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducer() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x45ba68ae461f9c8ecde0fb3c7db78d6d9f44a4a6cc0f03e7b8edad0cced55643\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\"},\"contracts/ronin/Maintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IMaintenance.sol\\\";\\nimport \\\"../interfaces/IProfile.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../utils/DeprecatedSlots.sol\\\";\\nimport { ErrUnauthorized, RoleAccess } from \\\"../utils/CommonErrors.sol\\\";\\n\\ncontract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Initializable {\\n using Math for uint256;\\n\\n /// @dev Mapping from candidate id => maintenance schedule.\\n mapping(address => Schedule) internal _schedule;\\n\\n /// @dev The min duration to maintenance in blocks.\\n uint256 internal _minMaintenanceDurationInBlock;\\n /// @dev The max duration to maintenance in blocks.\\n uint256 internal _maxMaintenanceDurationInBlock;\\n /// @dev The offset to the min block number that the schedule can start.\\n uint256 internal _minOffsetToStartSchedule;\\n /// @dev The offset to the max block number that the schedule can start.\\n uint256 internal _maxOffsetToStartSchedule;\\n /// @dev The max number of scheduled maintenances.\\n uint256 internal _maxSchedule;\\n /// @dev The cooldown time to request new schedule.\\n uint256 internal _cooldownSecsToMaintain;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address validatorContract,\\n uint256 minMaintenanceDurationInBlock_,\\n uint256 maxMaintenanceDurationInBlock_,\\n uint256 minOffsetToStartSchedule_,\\n uint256 maxOffsetToStartSchedule_,\\n uint256 maxSchedule_,\\n uint256 cooldownSecsToMaintain_\\n ) external initializer {\\n _setContract(ContractType.VALIDATOR, validatorContract);\\n _setMaintenanceConfig(\\n minMaintenanceDurationInBlock_,\\n maxMaintenanceDurationInBlock_,\\n minOffsetToStartSchedule_,\\n maxOffsetToStartSchedule_,\\n maxSchedule_,\\n cooldownSecsToMaintain_\\n );\\n }\\n\\n function initializeV2() external reinitializer(2) {\\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\\n delete ______deprecatedValidator;\\n }\\n\\n function initializeV3(address profileContract_) external reinitializer(3) {\\n _setContract(ContractType.PROFILE, profileContract_);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256) {\\n return _minMaintenanceDurationInBlock;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256) {\\n return _maxMaintenanceDurationInBlock;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function minOffsetToStartSchedule() external view returns (uint256) {\\n return _minOffsetToStartSchedule;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256) {\\n return _maxOffsetToStartSchedule;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function maxSchedule() external view returns (uint256) {\\n return _maxSchedule;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cooldownSecsToMaintain() external view returns (uint256) {\\n return _cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function setMaintenanceConfig(\\n uint256 minMaintenanceDurationInBlock_,\\n uint256 maxMaintenanceDurationInBlock_,\\n uint256 minOffsetToStartSchedule_,\\n uint256 maxOffsetToStartSchedule_,\\n uint256 maxSchedule_,\\n uint256 cooldownSecsToMaintain_\\n ) external onlyAdmin {\\n _setMaintenanceConfig(\\n minMaintenanceDurationInBlock_,\\n maxMaintenanceDurationInBlock_,\\n minOffsetToStartSchedule_,\\n maxOffsetToStartSchedule_,\\n maxSchedule_,\\n cooldownSecsToMaintain_\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external override {\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n address candidateId = __css2cid(consensusAddr);\\n\\n if (!validatorContract.isBlockProducer(consensusAddr)) revert ErrUnauthorized(msg.sig, RoleAccess.BLOCK_PRODUCER);\\n if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender))\\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\\n if (_checkScheduledById(candidateId)) revert ErrAlreadyScheduled();\\n if (!_checkCooldownEndedById(candidateId)) revert ErrCooldownTimeNotYetEnded();\\n if (totalSchedule() >= _maxSchedule) revert ErrTotalOfSchedulesExceeded();\\n if (!startedAtBlock.inRange(block.number + _minOffsetToStartSchedule, block.number + _maxOffsetToStartSchedule)) {\\n revert ErrStartBlockOutOfRange();\\n }\\n if (startedAtBlock >= endedAtBlock) revert ErrStartBlockOutOfRange();\\n\\n uint256 maintenanceElapsed = endedAtBlock - startedAtBlock + 1;\\n\\n if (!maintenanceElapsed.inRange(_minMaintenanceDurationInBlock, _maxMaintenanceDurationInBlock)) {\\n revert ErrInvalidMaintenanceDuration();\\n }\\n if (!validatorContract.epochEndingAt(startedAtBlock - 1)) revert ErrStartBlockOutOfRange();\\n if (!validatorContract.epochEndingAt(endedAtBlock)) revert ErrEndBlockOutOfRange();\\n\\n Schedule storage _sSchedule = _schedule[candidateId];\\n _sSchedule.from = startedAtBlock;\\n _sSchedule.to = endedAtBlock;\\n _sSchedule.lastUpdatedBlock = block.number;\\n _sSchedule.requestTimestamp = block.timestamp;\\n emit MaintenanceScheduled(consensusAddr, _sSchedule);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cancelSchedule(TConsensus consensusAddr) external override {\\n if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(consensusAddr, msg.sender)) {\\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\\n }\\n\\n address candidateId = __css2cid(consensusAddr);\\n\\n if (!_checkScheduledById(candidateId)) revert ErrUnexistedSchedule();\\n if (_checkMaintainedById(candidateId, block.number)) revert ErrAlreadyOnMaintenance();\\n\\n Schedule storage _sSchedule = _schedule[candidateId];\\n delete _sSchedule.from;\\n delete _sSchedule.to;\\n _sSchedule.lastUpdatedBlock = block.number;\\n emit MaintenanceScheduleCancelled(consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function getSchedule(TConsensus consensusAddr) external view override returns (Schedule memory) {\\n return _schedule[__css2cid(consensusAddr)];\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintained(\\n TConsensus[] calldata addrList,\\n uint256 atBlock\\n ) external view override returns (bool[] memory) {\\n address[] memory idList = __css2cidBatch(addrList);\\n return _checkManyMaintainedById(idList, atBlock);\\n }\\n\\n function checkManyMaintainedById(\\n address[] calldata idList,\\n uint256 atBlock\\n ) external view override returns (bool[] memory) {\\n return _checkManyMaintainedById(idList, atBlock);\\n }\\n\\n function _checkManyMaintainedById(\\n address[] memory idList,\\n uint256 atBlock\\n ) internal view returns (bool[] memory resList) {\\n resList = new bool[](idList.length);\\n for (uint i = 0; i < idList.length; ) {\\n resList[i] = _checkMaintainedById(idList[i], atBlock);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintainedInBlockRange(\\n TConsensus[] calldata addrList,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) external view override returns (bool[] memory) {\\n address[] memory idList = __css2cidBatch(addrList);\\n return _checkManyMaintainedInBlockRangeById(idList, fromBlock, toBlock);\\n }\\n\\n function checkManyMaintainedInBlockRangeById(\\n address[] calldata idList,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) external view override returns (bool[] memory) {\\n return _checkManyMaintainedInBlockRangeById(idList, fromBlock, toBlock);\\n }\\n\\n function _checkManyMaintainedInBlockRangeById(\\n address[] memory idList,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) internal view returns (bool[] memory resList) {\\n resList = new bool[](idList.length);\\n for (uint i = 0; i < idList.length; ) {\\n resList[i] = _maintainingInBlockRange(idList[i], fromBlock, toBlock);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function totalSchedule() public view override returns (uint256 count) {\\n address[] memory validatorIds = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).getValidators();\\n unchecked {\\n for (uint i = 0; i < validatorIds.length; i++) {\\n if (_checkScheduledById(validatorIds[i])) {\\n count++;\\n }\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintained(TConsensus consensusAddr, uint256 atBlock) external view override returns (bool) {\\n return _checkMaintainedById(__css2cid(consensusAddr), atBlock);\\n }\\n\\n function checkMaintainedById(address candidateId, uint256 atBlock) external view override returns (bool) {\\n return _checkMaintainedById(candidateId, atBlock);\\n }\\n\\n function _checkMaintainedById(address candidateId, uint256 atBlock) internal view returns (bool) {\\n Schedule storage _s = _schedule[candidateId];\\n return _s.from <= atBlock && atBlock <= _s.to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintainedInBlockRange(\\n TConsensus consensusAddr,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) public view override returns (bool) {\\n return _maintainingInBlockRange(__css2cid(consensusAddr), fromBlock, toBlock);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkScheduled(TConsensus consensusAddr) external view override returns (bool) {\\n return _checkScheduledById(__css2cid(consensusAddr));\\n }\\n\\n function _checkScheduledById(address candidateId) internal view returns (bool) {\\n return block.number <= _schedule[candidateId].to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkCooldownEnded(TConsensus consensusAddr) external view override returns (bool) {\\n return _checkCooldownEndedById(__css2cid(consensusAddr));\\n }\\n\\n function _checkCooldownEndedById(address candidateId) internal view returns (bool) {\\n return block.timestamp > _schedule[candidateId].requestTimestamp + _cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @dev Sets the min block period and max block period to maintenance.\\n *\\n * Requirements:\\n * - The max period is larger than the min period.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function _setMaintenanceConfig(\\n uint256 minMaintenanceDurationInBlock_,\\n uint256 maxMaintenanceDurationInBlock_,\\n uint256 minOffsetToStartSchedule_,\\n uint256 maxOffsetToStartSchedule_,\\n uint256 maxSchedule_,\\n uint256 cooldownSecsToMaintain_\\n ) internal {\\n if (minMaintenanceDurationInBlock_ >= maxMaintenanceDurationInBlock_) revert ErrInvalidMaintenanceDurationConfig();\\n if (minOffsetToStartSchedule_ >= maxOffsetToStartSchedule_) revert ErrInvalidOffsetToStartScheduleConfigs();\\n\\n _minMaintenanceDurationInBlock = minMaintenanceDurationInBlock_;\\n _maxMaintenanceDurationInBlock = maxMaintenanceDurationInBlock_;\\n _minOffsetToStartSchedule = minOffsetToStartSchedule_;\\n _maxOffsetToStartSchedule = maxOffsetToStartSchedule_;\\n _maxSchedule = maxSchedule_;\\n _cooldownSecsToMaintain = cooldownSecsToMaintain_;\\n emit MaintenanceConfigUpdated(\\n minMaintenanceDurationInBlock_,\\n maxMaintenanceDurationInBlock_,\\n minOffsetToStartSchedule_,\\n maxOffsetToStartSchedule_,\\n maxSchedule_,\\n cooldownSecsToMaintain_\\n );\\n }\\n\\n /**\\n * @dev Check if the validator was maintaining in the current period.\\n *\\n * Note: This method should be called at the end of the period.\\n */\\n function _maintainingInBlockRange(\\n address candidateId,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) private view returns (bool) {\\n Schedule storage s = _schedule[candidateId];\\n return Math.twoRangeOverlap(fromBlock, toBlock, s.from, s.to);\\n }\\n\\n function __css2cid(TConsensus consensusAddr) internal view returns (address) {\\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\\n }\\n\\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view returns (address[] memory) {\\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\\n }\\n}\\n\",\"keccak256\":\"0x5f826e1a0d35f8680581845623b78882f78dc41f7bf24dcaa6107de5141fc287\",\"license\":\"MIT\"},\"contracts/udvts/Types.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ntype TPoolId is address;\\ntype TConsensus is address;\\n\\nusing { TPoolIdEq as == } for TPoolId global;\\nusing { TConsensusEq as == } for TConsensus global;\\n\\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\\n}\\n\\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\\n}\\n\",\"keccak256\":\"0x3017524670c86eaf3930447e482b6f372ae091bb5f8eb89570924599fa626ed7\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x7e228d0dbe377086fb2f7438b1e79b4e30b4eeb0225036b90a33effc5af06197\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALITY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\"},\"contracts/utils/DeprecatedSlots.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Deprecated Contracts\\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\\n * They provide functionality related to various aspects of a smart contract but have been marked\\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\\n */\\ncontract HasSlashIndicatorDeprecated {\\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\\n address internal ______deprecatedSlashIndicator;\\n}\\n\\ncontract HasStakingVestingDeprecated {\\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\\n address internal ______deprecatedStakingVesting;\\n}\\n\\ncontract HasBridgeDeprecated {\\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\\n address internal ______deprecatedBridge;\\n}\\n\\ncontract HasValidatorDeprecated {\\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\\n address internal ______deprecatedValidator;\\n}\\n\\ncontract HasStakingDeprecated {\\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\\n address internal ______deprecatedStakingContract;\\n}\\n\\ncontract HasMaintenanceDeprecated {\\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\\n address internal ______deprecatedMaintenance;\\n}\\n\\ncontract HasTrustedOrgDeprecated {\\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\\n address internal ______deprecatedTrustedOrg;\\n}\\n\\ncontract HasGovernanceAdminDeprecated {\\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\\n address internal ______deprecatedGovernanceAdmin;\\n}\\n\\ncontract HasBridgeTrackingDeprecated {\\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\\n address internal ______deprecatedBridgeTracking;\\n}\\n\",\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE,\\n /* 9 */ CONSENSUS,\\n /* 10 */ TREASURY\\n}\\n\",\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611999806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80638b042a72116100de578063bfa89b9b11610097578063de981f1b11610071578063de981f1b1461031b578063dec3628414610346578063f0caaafb1461034e578063fdadda811461036157600080fd5b8063bfa89b9b146102ba578063c09fe460146102c2578063d39fee34146102d557600080fd5b80638b042a72146102515780638d5b675914610271578063ac57bd7614610284578063ba30375514610297578063ba7e57bb146102aa578063bc1710e9146102b257600080fd5b80633101cfcb116101305780633101cfcb146102005780635cd8a76b146102135780637a50802d1461021b5780638142951a1461022357806384a9573b14610236578063865e6fd31461023e57600080fd5b806301b5020914610178578063088e8de7146101a057806309e34c38146101b35780630fbeb37f146101c55780632d538c2c146101d85780632ddc08a2146101ed575b600080fd5b61018b610186366004611459565b610374565b60405190151581526020015b60405180910390f35b61018b6101ae366004611476565b61038d565b6002545b604051908152602001610197565b61018b6101d33660046114ab565b6103aa565b6101eb6101e6366004611476565b6103c5565b005b61018b6101fb366004611459565b6107ea565b6101eb61020e366004611459565b6107fd565b6101eb6108be565b6005546101b7565b6101eb6102313660046114d7565b61098e565b6101b7610a8b565b6101eb61024c36600461153b565b610b46565b61026461025f3660046115be565b610b65565b604051610197919061160f565b61018b61027f3660046114ab565b610bb0565b610264610292366004611655565b610bbc565b6102646102a53660046115be565b610bfc565b6006546101b7565b6004546101b7565b6003546101b7565b6101eb6102d03660046116a1565b610c53565b6102e86102e3366004611459565b610c71565b60405161019791908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61032e6103293660046116e4565b610d03565b6040516001600160a01b039091168152602001610197565b6007546101b7565b6101eb61035c366004611459565b610d7e565b61026461036f366004611655565b610edb565b600061038761038283610f27565b610f9f565b92915050565b60006103a261039b85610f27565b8484610fd1565b949350505050565b60006103be6103b884610f27565b83611000565b9392505050565b60006103d16008610d03565b905060006103de85610f27565b604051633292276760e11b81526001600160a01b038781166004830152919250908316906365244ece90602401602060405180830381865afa158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c91906116ff565b610482576000356001600160e01b0319166007604051620f948f60ea1b8152600401610479929190611737565b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b0386811660048301523360248301528316906304d971ab90604401602060405180830381865afa1580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906116ff565b61051f576000356001600160e01b0319166004604051620f948f60ea1b8152600401610479929190611737565b61052881611032565b156105465760405163b194497760e01b815260040160405180910390fd5b61054f81610f9f565b61056c5760405163207dfd7760e11b815260040160405180910390fd5b600654610577610a8b565b106105955760405163437494d360e01b815260040160405180910390fd5b6105bb600454436105a6919061177b565b6005546105b3904361177b565b869190611054565b6105d8576040516301f19fb760e61b815260040160405180910390fd5b8284106105f8576040516301f19fb760e61b815260040160405180910390fd5b6000610604858561178e565b61060f90600161177b565b905061062a600254600354836110549092919063ffffffff16565b6106475760405163a1f1aaf560e01b815260040160405180910390fd5b6001600160a01b038316637593ff7161066160018861178e565b6040518263ffffffff1660e01b815260040161067f91815260200190565b602060405180830381865afa15801561069c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c091906116ff565b6106dd576040516301f19fb760e61b815260040160405180910390fd5b604051637593ff7160e01b8152600481018590526001600160a01b03841690637593ff7190602401602060405180830381865afa158015610722573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074691906116ff565b6107635760405163ec67bbc560e01b815260040160405180910390fd5b6001600160a01b038281166000908152600160208181526040928390208981559182018890554360028301819055426003840181905584518b81529283018a9052938201526060810192909252918816907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a250505050505050565b60006103876107f883610f27565b611032565b600054600390600160a81b900460ff16158015610828575060005460ff808316600160a01b90920416105b6108445760405162461bcd60e51b8152600401610479906117a1565b6000805460ff60a81b1960ff8416600160a01b021661ffff60a01b1990911617600160a81b179055610877600f8361106b565b6000805460ff60a81b1916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b600054600290600160a81b900460ff161580156108e9575060005460ff808316600160a01b90920416105b6109055760405162461bcd60e51b8152600401610479906117a1565b6000805460ff60a81b1960ff8416600160a01b021661ffff60a01b1990911617600160a81b1790819055610944906008906001600160a01b031661106b565b60008054600161ff0160a01b031916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b600054600160a81b900460ff16158080156109b657506000546001600160a01b90910460ff16105b806109d75750303b1580156109d75750600054600160a01b900460ff166001145b6109f35760405162461bcd60e51b8152600401610479906117a1565b6000805460ff60a01b1916600160a01b1790558015610a20576000805460ff60a81b1916600160a81b1790555b610a2b60088961106b565b610a3987878787878761110f565b8015610a81576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080610a986008610d03565b6001600160a01b031663b7ab4db56040518163ffffffff1660e01b8152600401600060405180830381865afa158015610ad5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610afd9190810190611810565b905060005b8151811015610b4157610b2d828281518110610b2057610b206118d5565b6020026020010151611032565b15610b39576001909201915b600101610b02565b505090565b610b4e6111cb565b610b5781611227565b610b61828261106b565b5050565b6060610ba78585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691506112609050565b95945050505050565b60006103be8383611000565b60606103a284848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525086925061130a915050565b60606000610c3c8686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506113b292505050565b9050610c49818585611260565b9695505050505050565b610c5b6111cb565b610c6986868686868661110f565b505050505050565b610c9c6040518060800160405280600081526020016000815260200160008152602001600081525090565b60016000610ca984610f27565b6001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820154815260200160018201548152602001600282015481526020016003820154815250509050919050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115610d3a57610d3a611721565b60ff1681526020810191909152604001600020546001600160a01b0316905080610d79578160405163409140df60e11b815260040161047991906118eb565b919050565b610d886008610d03565b6040516304d971ab60e01b81526001600160a01b03838116600483015233602483015291909116906304d971ab90604401602060405180830381865afa158015610dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa91906116ff565b610e27576000356001600160e01b0319166004604051620f948f60ea1b8152600401610479929190611737565b6000610e3282610f27565b9050610e3d81611032565b610e5a5760405163f7050bef60e01b815260040160405180910390fd5b610e648143611000565b15610e825760405163070dff8360e01b815260040160405180910390fd5b6001600160a01b0380821660009081526001602081905260408083208381559182018390554360028301555190928516917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a2505050565b60606000610f1b8585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506113b292505050565b9050610ba7818461130a565b6000610f33600f610d03565b6040516350a9fc2960e01b81526001600160a01b03848116600483015291909116906350a9fc2990602401602060405180830381865afa158015610f7b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190611905565b6007546001600160a01b0382166000908152600160205260408120600301549091610fc99161177b565b421192915050565b6001600160a01b038316600090815260016020819052604082208054918101549091610ba7918691869161142e565b6001600160a01b0382166000908152600160205260408120805483108015906103a25750600101549091111592915050565b6001600160a01b03166000908152600160208190526040909120015443111590565b60008383111580156103a257505090911115919050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f8111156110a1576110a1611721565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f8111156110e2576110e2611721565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b84861061112f576040516338f4062560e11b815260040160405180910390fd5b82841061114f576040516316c7c7ef60e31b815260040160405180910390fd5b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611225576000356001600160e01b0319166001604051620f948f60ea1b8152600401610479929190611737565b565b806001600160a01b03163b60000361125d57604051630bfc64a360e21b81526001600160a01b0382166004820152602401610479565b50565b6060835167ffffffffffffffff81111561127c5761127c6117ef565b6040519080825280602002602001820160405280156112a5578160200160208202803683370190505b50905060005b8451811015611302576112d88582815181106112c9576112c96118d5565b60200260200101518585610fd1565b8282815181106112ea576112ea6118d5565b911515602092830291909101909101526001016112ab565b509392505050565b6060825167ffffffffffffffff811115611326576113266117ef565b60405190808252806020026020018201604052801561134f578160200160208202803683370190505b50905060005b83518110156113ab57611381848281518110611373576113736118d5565b602002602001015184611000565b828281518110611393576113936118d5565b91151560209283029190910190910152600101611355565b5092915050565b60606113be600f610d03565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b81526004016113e99190611922565b600060405180830381865afa158015611406573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103879190810190611810565b6000818511158015610ba7575050501115919050565b6001600160a01b038116811461125d57600080fd5b60006020828403121561146b57600080fd5b81356103be81611444565b60008060006060848603121561148b57600080fd5b833561149681611444565b95602085013595506040909401359392505050565b600080604083850312156114be57600080fd5b82356114c981611444565b946020939093013593505050565b600080600080600080600060e0888a0312156114f257600080fd5b87356114fd81611444565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b803560108110610d7957600080fd5b6000806040838503121561154e57600080fd5b6115578361152c565b9150602083013561156781611444565b809150509250929050565b60008083601f84011261158457600080fd5b50813567ffffffffffffffff81111561159c57600080fd5b6020830191508360208260051b85010111156115b757600080fd5b9250929050565b600080600080606085870312156115d457600080fd5b843567ffffffffffffffff8111156115eb57600080fd5b6115f787828801611572565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561164957835115158352928401929184019160010161162b565b50909695505050505050565b60008060006040848603121561166a57600080fd5b833567ffffffffffffffff81111561168157600080fd5b61168d86828701611572565b909790965060209590950135949350505050565b60008060008060008060c087890312156116ba57600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000602082840312156116f657600080fd5b6103be8261152c565b60006020828403121561171157600080fd5b815180151581146103be57600080fd5b634e487b7160e01b600052602160045260246000fd5b6001600160e01b03198316815260408101600b831061175857611758611721565b8260208301529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561038757610387611765565b8181038181111561038757610387611765565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b8051610d7981611444565b6000602080838503121561182357600080fd5b825167ffffffffffffffff8082111561183b57600080fd5b818501915085601f83011261184f57600080fd5b815181811115611861576118616117ef565b8060051b604051601f19603f83011681018181108582111715611886576118866117ef565b6040529182528482019250838101850191888311156118a457600080fd5b938501935b828510156118c9576118ba85611805565b845293850193928501926118a9565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60208101601083106118ff576118ff611721565b91905290565b60006020828403121561191757600080fd5b81516103be81611444565b6020808252825182820181905260009190848201906040850190845b818110156116495783516001600160a01b03168352928401929184019160010161193e56fea2646970667358221220eb4830c25cce95c4682d927ba3336e871f37ea856d5e29b12099a2213116b9e464736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638b042a72116100de578063bfa89b9b11610097578063de981f1b11610071578063de981f1b1461031b578063dec3628414610346578063f0caaafb1461034e578063fdadda811461036157600080fd5b8063bfa89b9b146102ba578063c09fe460146102c2578063d39fee34146102d557600080fd5b80638b042a72146102515780638d5b675914610271578063ac57bd7614610284578063ba30375514610297578063ba7e57bb146102aa578063bc1710e9146102b257600080fd5b80633101cfcb116101305780633101cfcb146102005780635cd8a76b146102135780637a50802d1461021b5780638142951a1461022357806384a9573b14610236578063865e6fd31461023e57600080fd5b806301b5020914610178578063088e8de7146101a057806309e34c38146101b35780630fbeb37f146101c55780632d538c2c146101d85780632ddc08a2146101ed575b600080fd5b61018b610186366004611459565b610374565b60405190151581526020015b60405180910390f35b61018b6101ae366004611476565b61038d565b6002545b604051908152602001610197565b61018b6101d33660046114ab565b6103aa565b6101eb6101e6366004611476565b6103c5565b005b61018b6101fb366004611459565b6107ea565b6101eb61020e366004611459565b6107fd565b6101eb6108be565b6005546101b7565b6101eb6102313660046114d7565b61098e565b6101b7610a8b565b6101eb61024c36600461153b565b610b46565b61026461025f3660046115be565b610b65565b604051610197919061160f565b61018b61027f3660046114ab565b610bb0565b610264610292366004611655565b610bbc565b6102646102a53660046115be565b610bfc565b6006546101b7565b6004546101b7565b6003546101b7565b6101eb6102d03660046116a1565b610c53565b6102e86102e3366004611459565b610c71565b60405161019791908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61032e6103293660046116e4565b610d03565b6040516001600160a01b039091168152602001610197565b6007546101b7565b6101eb61035c366004611459565b610d7e565b61026461036f366004611655565b610edb565b600061038761038283610f27565b610f9f565b92915050565b60006103a261039b85610f27565b8484610fd1565b949350505050565b60006103be6103b884610f27565b83611000565b9392505050565b60006103d16008610d03565b905060006103de85610f27565b604051633292276760e11b81526001600160a01b038781166004830152919250908316906365244ece90602401602060405180830381865afa158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c91906116ff565b610482576000356001600160e01b0319166007604051620f948f60ea1b8152600401610479929190611737565b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b0386811660048301523360248301528316906304d971ab90604401602060405180830381865afa1580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906116ff565b61051f576000356001600160e01b0319166004604051620f948f60ea1b8152600401610479929190611737565b61052881611032565b156105465760405163b194497760e01b815260040160405180910390fd5b61054f81610f9f565b61056c5760405163207dfd7760e11b815260040160405180910390fd5b600654610577610a8b565b106105955760405163437494d360e01b815260040160405180910390fd5b6105bb600454436105a6919061177b565b6005546105b3904361177b565b869190611054565b6105d8576040516301f19fb760e61b815260040160405180910390fd5b8284106105f8576040516301f19fb760e61b815260040160405180910390fd5b6000610604858561178e565b61060f90600161177b565b905061062a600254600354836110549092919063ffffffff16565b6106475760405163a1f1aaf560e01b815260040160405180910390fd5b6001600160a01b038316637593ff7161066160018861178e565b6040518263ffffffff1660e01b815260040161067f91815260200190565b602060405180830381865afa15801561069c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c091906116ff565b6106dd576040516301f19fb760e61b815260040160405180910390fd5b604051637593ff7160e01b8152600481018590526001600160a01b03841690637593ff7190602401602060405180830381865afa158015610722573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074691906116ff565b6107635760405163ec67bbc560e01b815260040160405180910390fd5b6001600160a01b038281166000908152600160208181526040928390208981559182018890554360028301819055426003840181905584518b81529283018a9052938201526060810192909252918816907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a250505050505050565b60006103876107f883610f27565b611032565b600054600390600160a81b900460ff16158015610828575060005460ff808316600160a01b90920416105b6108445760405162461bcd60e51b8152600401610479906117a1565b6000805460ff60a81b1960ff8416600160a01b021661ffff60a01b1990911617600160a81b179055610877600f8361106b565b6000805460ff60a81b1916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b600054600290600160a81b900460ff161580156108e9575060005460ff808316600160a01b90920416105b6109055760405162461bcd60e51b8152600401610479906117a1565b6000805460ff60a81b1960ff8416600160a01b021661ffff60a01b1990911617600160a81b1790819055610944906008906001600160a01b031661106b565b60008054600161ff0160a01b031916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b600054600160a81b900460ff16158080156109b657506000546001600160a01b90910460ff16105b806109d75750303b1580156109d75750600054600160a01b900460ff166001145b6109f35760405162461bcd60e51b8152600401610479906117a1565b6000805460ff60a01b1916600160a01b1790558015610a20576000805460ff60a81b1916600160a81b1790555b610a2b60088961106b565b610a3987878787878761110f565b8015610a81576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080610a986008610d03565b6001600160a01b031663b7ab4db56040518163ffffffff1660e01b8152600401600060405180830381865afa158015610ad5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610afd9190810190611810565b905060005b8151811015610b4157610b2d828281518110610b2057610b206118d5565b6020026020010151611032565b15610b39576001909201915b600101610b02565b505090565b610b4e6111cb565b610b5781611227565b610b61828261106b565b5050565b6060610ba78585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691506112609050565b95945050505050565b60006103be8383611000565b60606103a284848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525086925061130a915050565b60606000610c3c8686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506113b292505050565b9050610c49818585611260565b9695505050505050565b610c5b6111cb565b610c6986868686868661110f565b505050505050565b610c9c6040518060800160405280600081526020016000815260200160008152602001600081525090565b60016000610ca984610f27565b6001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820154815260200160018201548152602001600282015481526020016003820154815250509050919050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115610d3a57610d3a611721565b60ff1681526020810191909152604001600020546001600160a01b0316905080610d79578160405163409140df60e11b815260040161047991906118eb565b919050565b610d886008610d03565b6040516304d971ab60e01b81526001600160a01b03838116600483015233602483015291909116906304d971ab90604401602060405180830381865afa158015610dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa91906116ff565b610e27576000356001600160e01b0319166004604051620f948f60ea1b8152600401610479929190611737565b6000610e3282610f27565b9050610e3d81611032565b610e5a5760405163f7050bef60e01b815260040160405180910390fd5b610e648143611000565b15610e825760405163070dff8360e01b815260040160405180910390fd5b6001600160a01b0380821660009081526001602081905260408083208381559182018390554360028301555190928516917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a2505050565b60606000610f1b8585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506113b292505050565b9050610ba7818461130a565b6000610f33600f610d03565b6040516350a9fc2960e01b81526001600160a01b03848116600483015291909116906350a9fc2990602401602060405180830381865afa158015610f7b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190611905565b6007546001600160a01b0382166000908152600160205260408120600301549091610fc99161177b565b421192915050565b6001600160a01b038316600090815260016020819052604082208054918101549091610ba7918691869161142e565b6001600160a01b0382166000908152600160205260408120805483108015906103a25750600101549091111592915050565b6001600160a01b03166000908152600160208190526040909120015443111590565b60008383111580156103a257505090911115919050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f8111156110a1576110a1611721565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f8111156110e2576110e2611721565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b84861061112f576040516338f4062560e11b815260040160405180910390fd5b82841061114f576040516316c7c7ef60e31b815260040160405180910390fd5b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611225576000356001600160e01b0319166001604051620f948f60ea1b8152600401610479929190611737565b565b806001600160a01b03163b60000361125d57604051630bfc64a360e21b81526001600160a01b0382166004820152602401610479565b50565b6060835167ffffffffffffffff81111561127c5761127c6117ef565b6040519080825280602002602001820160405280156112a5578160200160208202803683370190505b50905060005b8451811015611302576112d88582815181106112c9576112c96118d5565b60200260200101518585610fd1565b8282815181106112ea576112ea6118d5565b911515602092830291909101909101526001016112ab565b509392505050565b6060825167ffffffffffffffff811115611326576113266117ef565b60405190808252806020026020018201604052801561134f578160200160208202803683370190505b50905060005b83518110156113ab57611381848281518110611373576113736118d5565b602002602001015184611000565b828281518110611393576113936118d5565b91151560209283029190910190910152600101611355565b5092915050565b60606113be600f610d03565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b81526004016113e99190611922565b600060405180830381865afa158015611406573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103879190810190611810565b6000818511158015610ba7575050501115919050565b6001600160a01b038116811461125d57600080fd5b60006020828403121561146b57600080fd5b81356103be81611444565b60008060006060848603121561148b57600080fd5b833561149681611444565b95602085013595506040909401359392505050565b600080604083850312156114be57600080fd5b82356114c981611444565b946020939093013593505050565b600080600080600080600060e0888a0312156114f257600080fd5b87356114fd81611444565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b803560108110610d7957600080fd5b6000806040838503121561154e57600080fd5b6115578361152c565b9150602083013561156781611444565b809150509250929050565b60008083601f84011261158457600080fd5b50813567ffffffffffffffff81111561159c57600080fd5b6020830191508360208260051b85010111156115b757600080fd5b9250929050565b600080600080606085870312156115d457600080fd5b843567ffffffffffffffff8111156115eb57600080fd5b6115f787828801611572565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561164957835115158352928401929184019160010161162b565b50909695505050505050565b60008060006040848603121561166a57600080fd5b833567ffffffffffffffff81111561168157600080fd5b61168d86828701611572565b909790965060209590950135949350505050565b60008060008060008060c087890312156116ba57600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000602082840312156116f657600080fd5b6103be8261152c565b60006020828403121561171157600080fd5b815180151581146103be57600080fd5b634e487b7160e01b600052602160045260246000fd5b6001600160e01b03198316815260408101600b831061175857611758611721565b8260208301529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561038757610387611765565b8181038181111561038757610387611765565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b8051610d7981611444565b6000602080838503121561182357600080fd5b825167ffffffffffffffff8082111561183b57600080fd5b818501915085601f83011261184f57600080fd5b815181811115611861576118616117ef565b8060051b604051601f19603f83011681018181108582111715611886576118866117ef565b6040529182528482019250838101850191888311156118a457600080fd5b938501935b828510156118c9576118ba85611805565b845293850193928501926118a9565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60208101601083106118ff576118ff611721565b91905290565b60006020828403121561191757600080fd5b81516103be81611444565b6020808252825182820181905260009190848201906040850190845b818110156116495783516001600160a01b03168352928401929184019160010161193e56fea2646970667358221220eb4830c25cce95c4682d927ba3336e871f37ea856d5e29b12099a2213116b9e464736f6c63430008130033", "devdoc": { "errors": { "ErrAlreadyOnMaintenance()": [ @@ -768,28 +858,48 @@ } ] }, + "events": { + "ContractUpdated(uint8,address)": { + "details": "Emitted when a contract is updated." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "MaintenanceConfigUpdated(uint256,uint256,uint256,uint256,uint256,uint256)": { + "details": "Emitted when the maintenance config is updated." + }, + "MaintenanceScheduleCancelled(address)": { + "details": "Emitted when a schedule of maintenance is cancelled." + }, + "MaintenanceScheduled(address,(uint256,uint256,uint256,uint256))": { + "details": "Emitted when a maintenance is scheduled." + } + }, "kind": "dev", "methods": { "cancelSchedule(address)": { - "details": "Cancel the schedule of maintenance for the `_consensusAddr`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - A schedule for the `_consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`." + "details": "Cancel the schedule of maintenance for the `consensusAddr`. Requirements: - The candidate `consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `consensusAddr`. - A schedule for the `consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`." }, - "checkCooldownEnds(address)": { - "details": "Returns whether the validator `_consensusAddr`" + "checkCooldownEnded(address)": { + "details": "Returns whether the validator `consensusAddr` has finished cooldown." }, "checkMaintained(address,uint256)": { - "details": "Returns whether the validator `_consensusAddr` maintained at the block number `_block`." + "details": "Returns whether the validator `consensusAddr` maintained at the block number `_block`." }, "checkMaintainedInBlockRange(address,uint256,uint256)": { - "details": "Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks." + "details": "Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks." }, "checkManyMaintained(address[],uint256)": { - "details": "Returns the bool array indicating the validators maintained at block number `_block` or not." + "details": "Returns the bool array indicating the validators maintained at block number `k` or not." }, "checkManyMaintainedInBlockRange(address[],uint256,uint256)": { "details": "Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not." }, "checkScheduled(address)": { - "details": "Returns whether the validator `_consensusAddr` has scheduled." + "details": "Returns whether the validator `consensusAddr` has schedule." + }, + "cooldownSecsToMaintain()": { + "details": "Returns the cooldown to maintain in seconds." }, "getContract(uint8)": { "details": "Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.", @@ -801,13 +911,28 @@ } }, "getSchedule(address)": { - "details": "Returns the detailed schedule of the validator `_consensusAddr`." + "details": "Returns the detailed schedule of the validator `consensusAddr`." }, "initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)": { "details": "Initializes the contract storage." }, + "maxMaintenanceDurationInBlock()": { + "details": "Returns the max duration for maintenance in block." + }, + "maxOffsetToStartSchedule()": { + "details": "The offset to the max block number that the schedule can start" + }, + "maxSchedule()": { + "details": "Returns the max number of scheduled maintenances." + }, + "minMaintenanceDurationInBlock()": { + "details": "Returns the min duration for maintenance in block." + }, + "minOffsetToStartSchedule()": { + "details": "The offset to the min block number that the schedule can start" + }, "schedule(address,uint256,uint256)": { - "details": "Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - The candidate `_consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`." + "details": "Schedules for maintenance from `startedAtBlock` to `endedAtBlock`. Requirements: - The candidate `consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `consensusAddr`. - The candidate `consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`." }, "setContract(uint8,address)": { "details": "Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.", @@ -819,31 +944,31 @@ "setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)": { "details": "Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`." }, - "totalSchedules()": { + "totalSchedule()": { "details": "Returns the total of current schedules." } }, "stateVariables": { - "_schedule": { - "details": "Mapping from consensus address => maintenance schedule." - }, - "cooldownSecsToMaintain": { + "_cooldownSecsToMaintain": { "details": "The cooldown time to request new schedule." }, - "maxMaintenanceDurationInBlock": { + "_maxMaintenanceDurationInBlock": { "details": "The max duration to maintenance in blocks." }, - "maxOffsetToStartSchedule": { + "_maxOffsetToStartSchedule": { "details": "The offset to the max block number that the schedule can start." }, - "maxSchedules": { + "_maxSchedule": { "details": "The max number of scheduled maintenances." }, - "minMaintenanceDurationInBlock": { + "_minMaintenanceDurationInBlock": { "details": "The min duration to maintenance in blocks." }, - "minOffsetToStartSchedule": { + "_minOffsetToStartSchedule": { "details": "The offset to the min block number that the schedule can start." + }, + "_schedule": { + "details": "Mapping from candidate id => maintenance schedule." } }, "version": 1 @@ -856,7 +981,7 @@ "storageLayout": { "storage": [ { - "astId": 39596, + "astId": 31444, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "______deprecatedValidator", "offset": 0, @@ -864,7 +989,7 @@ "type": "t_address" }, { - "astId": 1373, + "astId": 1124, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "_initialized", "offset": 20, @@ -872,7 +997,7 @@ "type": "t_uint8" }, { - "astId": 1376, + "astId": 1127, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "_initializing", "offset": 21, @@ -880,57 +1005,57 @@ "type": "t_bool" }, { - "astId": 23558, + "astId": 14251, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "_schedule", "offset": 0, "slot": "1", - "type": "t_mapping(t_address,t_struct(Schedule)11114_storage)" + "type": "t_mapping(t_address,t_struct(Schedule)5940_storage)" }, { - "astId": 23561, + "astId": 14254, "contract": "contracts/ronin/Maintenance.sol:Maintenance", - "label": "minMaintenanceDurationInBlock", + "label": "_minMaintenanceDurationInBlock", "offset": 0, "slot": "2", "type": "t_uint256" }, { - "astId": 23564, + "astId": 14257, "contract": "contracts/ronin/Maintenance.sol:Maintenance", - "label": "maxMaintenanceDurationInBlock", + "label": "_maxMaintenanceDurationInBlock", "offset": 0, "slot": "3", "type": "t_uint256" }, { - "astId": 23567, + "astId": 14260, "contract": "contracts/ronin/Maintenance.sol:Maintenance", - "label": "minOffsetToStartSchedule", + "label": "_minOffsetToStartSchedule", "offset": 0, "slot": "4", "type": "t_uint256" }, { - "astId": 23570, + "astId": 14263, "contract": "contracts/ronin/Maintenance.sol:Maintenance", - "label": "maxOffsetToStartSchedule", + "label": "_maxOffsetToStartSchedule", "offset": 0, "slot": "5", "type": "t_uint256" }, { - "astId": 23573, + "astId": 14266, "contract": "contracts/ronin/Maintenance.sol:Maintenance", - "label": "maxSchedules", + "label": "_maxSchedule", "offset": 0, "slot": "6", "type": "t_uint256" }, { - "astId": 23576, + "astId": 14269, "contract": "contracts/ronin/Maintenance.sol:Maintenance", - "label": "cooldownSecsToMaintain", + "label": "_cooldownSecsToMaintain", "offset": 0, "slot": "7", "type": "t_uint256" @@ -947,19 +1072,19 @@ "label": "bool", "numberOfBytes": "1" }, - "t_mapping(t_address,t_struct(Schedule)11114_storage)": { + "t_mapping(t_address,t_struct(Schedule)5940_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IMaintenance.Schedule)", "numberOfBytes": "32", - "value": "t_struct(Schedule)11114_storage" + "value": "t_struct(Schedule)5940_storage" }, - "t_struct(Schedule)11114_storage": { + "t_struct(Schedule)5940_storage": { "encoding": "inplace", "label": "struct IMaintenance.Schedule", "members": [ { - "astId": 11107, + "astId": 5933, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "from", "offset": 0, @@ -967,7 +1092,7 @@ "type": "t_uint256" }, { - "astId": 11109, + "astId": 5935, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "to", "offset": 0, @@ -975,7 +1100,7 @@ "type": "t_uint256" }, { - "astId": 11111, + "astId": 5937, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "lastUpdatedBlock", "offset": 0, @@ -983,7 +1108,7 @@ "type": "t_uint256" }, { - "astId": 11113, + "astId": 5939, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "requestTimestamp", "offset": 0, diff --git a/deployments/ronin-testnet/ProfileLogic.json b/deployments/ronin-testnet/ProfileLogic.json index e6c708553..55d66e2ac 100644 --- a/deployments/ronin-testnet/ProfileLogic.json +++ b/deployments/ronin-testnet/ProfileLogic.json @@ -1,5 +1,5 @@ { - "address": "0x246d81F6e2a1f4999Ca8aA0d253587a1dBf75E43", + "address": "0xD5640Fb85E6073a955D2Ed12A0f2ACFF153E4cab", "abi": [ { "inputs": [], @@ -75,6 +75,27 @@ "name": "ErrUnauthorized", "type": "error" }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "msgSig", + "type": "bytes4" + }, + { + "internalType": "enum ContractType", + "name": "expectedContractType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "actual", + "type": "address" + } + ], + "name": "ErrUnexpectedInternalCall", + "type": "error" + }, { "inputs": [ { @@ -195,7 +216,7 @@ "type": "address" }, { - "internalType": "address", + "internalType": "TConsensus", "name": "consensus", "type": "address" }, @@ -211,7 +232,7 @@ }, { "internalType": "address", - "name": "governor", + "name": "__reservedGovernor", "type": "address" }, { @@ -248,6 +269,53 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "id", + "type": "address" + }, + { + "internalType": "address", + "name": "treasury", + "type": "address" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "execApplyValidatorCandidate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "consensus", + "type": "address" + } + ], + "name": "getConsensus2Id", + "outputs": [ + { + "internalType": "address", + "name": "id", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -285,7 +353,7 @@ "type": "address" }, { - "internalType": "address", + "internalType": "TConsensus", "name": "consensus", "type": "address" }, @@ -301,7 +369,7 @@ }, { "internalType": "address", - "name": "governor", + "name": "__reservedGovernor", "type": "address" }, { @@ -318,6 +386,44 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "TConsensus[]", + "name": "consensusList", + "type": "address[]" + } + ], + "name": "getManyConsensus2Id", + "outputs": [ + { + "internalType": "address[]", + "name": "idList", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "idList", + "type": "address[]" + } + ], + "name": "getManyId2Consensus", + "outputs": [ + { + "internalType": "TConsensus[]", + "name": "consensusList", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -332,8 +438,19 @@ "type": "function" }, { - "inputs": [], - "name": "migrateTestnet", + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "address", + "name": "trustedOrgContract", + "type": "address" + } + ], + "name": "initializeV2", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -342,16 +459,16 @@ "inputs": [ { "internalType": "address", - "name": "consensus", + "name": "id", "type": "address" }, { "internalType": "address", - "name": "governor", + "name": "newAdminAddr", "type": "address" } ], - "name": "migrateTestnetManual", + "name": "requestChangeAdminAddress", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -359,44 +476,35 @@ { "inputs": [ { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "address", - "name": "consensus", - "type": "address" - }, - { - "internalType": "address", - "name": "admin", - "type": "address" - }, - { - "internalType": "address payable", - "name": "treasury", - "type": "address" - }, - { - "internalType": "address", - "name": "governor", - "type": "address" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "internalType": "struct IProfile.CandidateProfile", - "name": "profile", - "type": "tuple" + "internalType": "address", + "name": "id", + "type": "address" + }, + { + "internalType": "TConsensus", + "name": "newConsensusAddr", + "type": "address" } ], - "name": "registerProfile", + "name": "requestChangeConsensusAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "id", + "type": "address" + }, + { + "internalType": "address payable", + "name": "newTreasury", + "type": "address" + } + ], + "name": "requestChangeTreasuryAddr", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -420,41 +528,41 @@ "type": "function" } ], - "transactionHash": "0xad283bc06219949d17f915c10fcbf011226a5b7d33162efb9c88a93a4d3f95cb", + "transactionHash": "0x22eaa76d9fe83f586619605625b012f600716f41f2047ddc68c562b81ef4ea73", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x246d81F6e2a1f4999Ca8aA0d253587a1dBf75E43", - "transactionIndex": 0, - "gasUsed": "1284616", - "logsBloom": "0x00000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000004000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000", - "blockHash": "0x5b7613892d705605886c961b24cec5dea66b00e421239e0c3535070ed7101352", - "transactionHash": "0xad283bc06219949d17f915c10fcbf011226a5b7d33162efb9c88a93a4d3f95cb", + "contractAddress": "0xD5640Fb85E6073a955D2Ed12A0f2ACFF153E4cab", + "transactionIndex": 1, + "gasUsed": "1630051", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000020000400000000000000000000000000000000000000000000000000000000000000040200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5f1740f6dcb863eb1f629d035c7abb7cf45f9a4fcb8e0b74fbc177668e6927f8", + "transactionHash": "0x22eaa76d9fe83f586619605625b012f600716f41f2047ddc68c562b81ef4ea73", "logs": [ { - "transactionIndex": 0, - "blockNumber": 20756892, - "transactionHash": "0xad283bc06219949d17f915c10fcbf011226a5b7d33162efb9c88a93a4d3f95cb", - "address": "0x246d81F6e2a1f4999Ca8aA0d253587a1dBf75E43", + "transactionIndex": 1, + "blockNumber": 21941077, + "transactionHash": "0x22eaa76d9fe83f586619605625b012f600716f41f2047ddc68c562b81ef4ea73", + "address": "0xD5640Fb85E6073a955D2Ed12A0f2ACFF153E4cab", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 0, - "blockHash": "0x5b7613892d705605886c961b24cec5dea66b00e421239e0c3535070ed7101352" + "logIndex": 6, + "blockHash": "0x5f1740f6dcb863eb1f629d035c7abb7cf45f9a4fcb8e0b74fbc177668e6927f8" } ], - "blockNumber": 20756892, - "cumulativeGasUsed": "1284616", + "blockNumber": 21941077, + "cumulativeGasUsed": "2031041", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 6, - "solcInputHash": "e0bf9fd4a684fe34b60b71a3b24ddf73", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum RoleAccess\",\"name\":\"infoType\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"ErrDuplicatedInfo\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"ErrDuplicatedPubkey\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentProfile\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrIdAndConsensusDiffer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentProfile\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum RoleAccess\",\"name\":\"infoType\",\"type\":\"uint8\"}],\"name\":\"ErrZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroPubkey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"}],\"name\":\"ProfileAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"enum RoleAccess\",\"name\":\"addressType\",\"type\":\"uint8\"}],\"name\":\"ProfileAddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"internalType\":\"struct IProfile.CandidateProfile\",\"name\":\"profile\",\"type\":\"tuple\"}],\"name\":\"addNewProfile\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"changePubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"}],\"name\":\"getId2Profile\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"internalType\":\"struct IProfile.CandidateProfile\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorContract\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"migrateTestnet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"}],\"name\":\"migrateTestnetManual\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"internalType\":\"struct IProfile.CandidateProfile\",\"name\":\"profile\",\"type\":\"tuple\"}],\"name\":\"registerProfile\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrDuplicatedInfo(uint8,uint256)\":[{\"details\":\"Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key, and with value type of `infoType`.\"}],\"ErrExistentProfile()\":[{\"details\":\"Error of already existed profile.\"}],\"ErrIdAndConsensusDiffer()\":[{\"details\":\"Error when create a new profile whose id and consensus are not identical.\"}],\"ErrNonExistentProfile()\":[{\"details\":\"Error of non existed profile.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"addNewProfile((address,address,address,address,address,bytes))\":{\"details\":\"Requirements: - The profile must not be existent before. - Only contract admin can call this method.\"},\"changePubkey(address,bytes)\":{\"details\":\"Requirements: - The profile must be existed. - Only user with candidate admin role can call this method. - New public key must not be duplicated.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getId2Profile(address)\":{\"details\":\"Getter to query full `profile` from `id` address.\"},\"registerProfile((address,address,address,address,address,bytes))\":{\"details\":\"Requirements: - The profile must not be existent before. - Only user with candidate admin role can call this method.\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addNewProfile((address,address,address,address,address,bytes))\":{\"notice\":\"Add a new profile.\"},\"changePubkey(address,bytes)\":{\"notice\":\"The candidate admin changes the public key.\"},\"registerProfile((address,address,address,address,address,bytes))\":{\"notice\":\"The candidate admin registers a new profile.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/profile/Profile.sol\":\"Profile\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n address consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address governor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n /// @dev Event emitted when the pubkey of the `id` is changed.\\n event PubkeyChanged(address indexed id, bytes pubkey);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n /// @dev Error when create a new profile whose id and consensus are not identical.\\n error ErrIdAndConsensusDiffer();\\n /**\\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\\n * and with value type of `infoType`.\\n */\\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\\n error ErrDuplicatedPubkey(bytes pubkey);\\n error ErrZeroAddress(RoleAccess infoType);\\n error ErrZeroPubkey();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @notice The candidate admin registers a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only user with candidate admin role can call this method.\\n */\\n\\n function registerProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @notice The candidate admin changes the public key.\\n *\\n * @dev Requirements:\\n * - The profile must be existed.\\n * - Only user with candidate admin role can call this method.\\n * - New public key must not be duplicated.\\n */\\n\\n function changePubkey(address id, bytes memory pubkey) external;\\n}\\n\",\"keccak256\":\"0xa22fc36c00bc641b74359a9df037b8b00028ae679b2b5fa48cb23f1c5f07dbcf\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address ______deprecatedbridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnward() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address _consensusAddr, uint256 _effectiveTimestamp, uint256 _rate) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0x97dae7e2ed43c21c48200581501bfa065c7836299306ba2e7f39896c3a22ef2d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the fast finality reward is distributed.\\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\\n event FastFinalityRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(address validatorAddr, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0xac0b772f2fca9dafd7cc6742f91b442f9f545bf9472185b8d817fe045b680193\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x3fdfa86da33b889e5153075ffc028d6b0c607480a96b532fbbbc48ac7bbf27c9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n address _addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n address _addr,\\n uint256 _blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2b1846b05ca1d636299fb929c1bd7b392b236f5e3f7aa3e7eea2c6d57b8836fb\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /**\\n * @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n */\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducer() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x6823181ac93ea3320e6ebfb456624afda59ac2acb480de5c774783983c8f4749\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/ronin/profile/Profile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/validator/ICandidateManager.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport { ErrUnauthorized, RoleAccess } from \\\"../../utils/CommonErrors.sol\\\";\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\nimport \\\"./ProfileHandler.sol\\\";\\n\\npragma solidity ^0.8.9;\\n\\ncontract Profile is IProfile, ProfileHandler, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(address validatorContract) external initializer {\\n _setContract(ContractType.VALIDATOR, validatorContract);\\n }\\n\\n function migrateTestnet() external {\\n require(block.chainid == 2021, \\\"mismatch chainID\\\");\\n require(msg.sender == 0x968D0Cd7343f711216817E617d3f92a23dC91c07, \\\"not testnet admin\\\");\\n\\n CandidateProfile storage _profile;\\n\\n address[10] memory consensusList = [\\n 0xCaba9D9424D6bAD99CE352A943F59279B533417a,\\n 0x9f1Abc67beA4db5560371fF3089F4Bfe934c36Bc,\\n 0xA85ddDdCeEaB43DccAa259dd4936aC104386F9aa,\\n 0xAcf8Bf98D1632e602d0B1761771049aF21dd6597,\\n 0xE9bf2A788C27dADc6B169d52408b710d267b9bff,\\n 0xD086D2e3Fac052A3f695a4e8905Ce1722531163C,\\n // 0x9687e8C41fa369aD08FD278a43114C4207856a61, // missing\\n 0xa325Fd3a2f4f5CafE2c151eE428b5CeDeD628193,\\n 0x9422d990AcDc3f2b3AA3B97303aD3060F09d7ffC,\\n 0xc3C97512421BF3e339E9fd412f18584e53138bFA,\\n 0x78fD38faa30ea66702cc39383D2E84f9a4A56fA6\\n ];\\n\\n for (uint i; i < consensusList.length; i++) {\\n _migrateTestnetHelper(consensusList[i]);\\n }\\n\\n {\\n _profile = _getId2ProfileHelper(0xCaba9D9424D6bAD99CE352A943F59279B533417a);\\n _setGovernor(_profile, 0xb033ba62EC622dC54D0ABFE0254e79692147CA26);\\n }\\n {\\n _profile = _getId2ProfileHelper(0x9f1Abc67beA4db5560371fF3089F4Bfe934c36Bc);\\n _setGovernor(_profile, 0x087D08e3ba42e64E3948962dd1371F906D1278b9);\\n }\\n {\\n _profile = _getId2ProfileHelper(0xA85ddDdCeEaB43DccAa259dd4936aC104386F9aa);\\n _setGovernor(_profile, 0x52ec2e6BBcE45AfFF8955Da6410bb13812F4289F);\\n }\\n {\\n _profile = _getId2ProfileHelper(0xAcf8Bf98D1632e602d0B1761771049aF21dd6597);\\n _setGovernor(_profile, 0xd24D87DDc1917165435b306aAC68D99e0F49A3Fa);\\n }\\n }\\n\\n function migrateTestnetManual(address consensus, address governor) external {\\n require(block.chainid == 2021, \\\"mismatch chainID\\\");\\n require(msg.sender == 0x968D0Cd7343f711216817E617d3f92a23dC91c07, \\\"not testnet admin\\\");\\n\\n _migrateTestnetHelper(consensus);\\n if (governor != address(0)) {\\n CandidateProfile storage _profile = _getId2ProfileHelper(consensus);\\n _setGovernor(_profile, governor);\\n }\\n }\\n\\n function _migrateTestnetHelper(address consensus) internal {\\n CandidateProfile storage _profile = _getId2ProfileHelper(consensus);\\n ICandidateManager.ValidatorCandidate memory info = IRoninValidatorSet(getContract(ContractType.VALIDATOR))\\n .getCandidateInfo(consensus);\\n _setConsensus(_profile, consensus);\\n _setAdmin(_profile, info.admin);\\n _setTreasury(_profile, payable(info.treasuryAddr));\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function getId2Profile(address id) external view returns (CandidateProfile memory) {\\n return _id2Profile[id];\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function addNewProfile(CandidateProfile memory profile) external onlyAdmin {\\n CandidateProfile storage _profile = _id2Profile[profile.id];\\n if (_profile.id != address(0)) revert ErrExistentProfile();\\n _addNewProfile(_profile, profile);\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function registerProfile(CandidateProfile memory profile) external {\\n if (profile.id != profile.consensus) revert ErrIdAndConsensusDiffer();\\n\\n CandidateProfile storage _profile = _id2Profile[profile.id];\\n if (_profile.id != address(0)) revert ErrExistentProfile();\\n if (\\n msg.sender != profile.admin ||\\n !IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(profile.consensus, profile.admin)\\n ) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n _checkDuplicatedInRegistry(profile);\\n\\n _addNewProfile(_profile, profile);\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function changePubkey(address id, bytes memory pubkey) external {\\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\\n if (msg.sender != _profile.admin) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n _checkNonDuplicatedPubkey(pubkey);\\n _setPubkey(_profile, pubkey);\\n\\n emit PubkeyChanged(id, pubkey);\\n }\\n}\\n\",\"keccak256\":\"0x37a3415259543d42a8c3e91fce16e6e5f7781a8b595ad9059a7973f29be1863b\",\"license\":\"MIT\"},\"contracts/ronin/profile/ProfileHandler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../utils/RoleAccess.sol\\\";\\nimport { ProfileStorage } from \\\"./ProfileStorage.sol\\\";\\n\\nabstract contract ProfileHandler is ProfileStorage {\\n /**\\n * @dev Checks each element in the new profile and reverts if there is duplication with any existing profile.\\n */\\n function _checkDuplicatedInRegistry(CandidateProfile memory profile) internal view {\\n _checkNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, profile.consensus);\\n _checkNonZeroAndNonDuplicated(RoleAccess.CANDIDATE_ADMIN, profile.admin);\\n _checkNonZeroAndNonDuplicated(RoleAccess.TREASURY, profile.treasury);\\n _checkNonDuplicated(RoleAccess.TREASURY, profile.governor);\\n _checkNonDuplicatedPubkey(profile.pubkey);\\n }\\n\\n function _checkNonZeroAndNonDuplicated(RoleAccess addressType, address addr) internal view {\\n if (addr == address(0)) revert ErrZeroAddress(addressType);\\n _checkNonDuplicated(addressType, addr);\\n }\\n\\n function _checkNonDuplicated(RoleAccess addressType, address addr) internal view {\\n if (_registry[uint256(uint160(addr))]) {\\n revert ErrDuplicatedInfo(addressType, uint256(uint160(addr)));\\n }\\n }\\n\\n function _checkNonDuplicatedPubkey(bytes memory pubkey) internal view {\\n if (_registry[_hashPubkey(pubkey)]) {\\n revert ErrDuplicatedPubkey(pubkey);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xccc5e5a3769f7cc2265f73e3a2117754a71d1e504c0ee697ae5d25bcaa19d982\",\"license\":\"MIT\"},\"contracts/ronin/profile/ProfileStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { IProfile } from \\\"../../interfaces/IProfile.sol\\\";\\n\\nabstract contract ProfileStorage is IProfile, HasContracts {\\n /// @dev Mapping from id address => candidate profile.\\n mapping(address => CandidateProfile) internal _id2Profile;\\n /**\\n * @dev Mapping from any address or keccak256(pubkey) => whether it is already registered.\\n * This registry can only be toggled to `true` and NOT vice versa. All registered values\\n * cannot be reused.\\n */\\n mapping(uint256 => bool) internal _registry;\\n /// @dev Upgradeable gap.\\n bytes32[49] __gap;\\n\\n /**\\n * @dev Add a profile from memory to storage.\\n */\\n function _addNewProfile(CandidateProfile storage _profile, CandidateProfile memory newProfile) internal {\\n _profile.id = newProfile.id;\\n\\n _setConsensus(_profile, newProfile.consensus);\\n _setAdmin(_profile, newProfile.admin);\\n _setTreasury(_profile, newProfile.treasury);\\n _setGovernor(_profile, newProfile.governor);\\n _setPubkey(_profile, newProfile.pubkey);\\n\\n emit ProfileAdded(newProfile.id);\\n }\\n\\n function _setConsensus(CandidateProfile storage _profile, address consensus) internal {\\n _profile.consensus = consensus;\\n _registry[uint256(uint160(consensus))] = true;\\n }\\n\\n function _setAdmin(CandidateProfile storage _profile, address admin) internal {\\n _profile.admin = admin;\\n _registry[uint256(uint160(admin))] = true;\\n }\\n\\n function _setTreasury(CandidateProfile storage _profile, address payable treasury) internal {\\n _profile.treasury = treasury;\\n _registry[uint256(uint160(address(treasury)))] = true;\\n }\\n\\n /**\\n * @dev Allow to registry a profile without governor address since not all validators are governing validators.\\n */\\n function _setGovernor(CandidateProfile storage _profile, address governor) internal {\\n _profile.governor = governor;\\n if (governor != address(0)) {\\n _registry[uint256(uint160(governor))] = true;\\n }\\n }\\n\\n function _setPubkey(CandidateProfile storage _profile, bytes memory pubkey) internal {\\n _profile.pubkey = pubkey;\\n _registry[_hashPubkey(pubkey)] = true;\\n }\\n\\n /**\\n * @dev Get an existed profile struct from `id`. Revert if the profile does not exists.\\n */\\n function _getId2ProfileHelper(address id) internal view returns (CandidateProfile storage _profile) {\\n _profile = _id2Profile[id];\\n if (_profile.id == address(0)) revert ErrNonExistentProfile();\\n }\\n\\n /**\\n * @dev Returns hash of a public key.\\n */\\n function _hashPubkey(bytes memory pubkey) internal pure returns (uint256) {\\n return uint256(keccak256(pubkey));\\n }\\n}\\n\",\"keccak256\":\"0x9f3cc490c413463e17adc5319380dc5bd2d284282a25e50f73248db87b32af69\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x22942c8fea2d1ca863ac1f9c1662d714b8ac0856684e36f8aaf19508648c1053\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALITY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE,\\n /* 9 */ CONSENSUS,\\n /* 10 */ TREASURY\\n}\\n\",\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b603354610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60335460ff90811610156100dc576033805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6115c9806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80639029bc60116100665780639029bc60146100db57806392d48756146100ee578063c4d66de814610101578063de981f1b14610114578063f46609401461014457600080fd5b806301f01a0e1461009857806368a5c123146100a25780637b0aecaa146100b5578063865e6fd3146100c8575b600080fd5b6100a0610164565b005b6100a06100b0366004611038565b61044c565b6100a06100c3366004611088565b6104f0565b6100a06100d63660046110d0565b6105bf565b6100a06100e93660046110ec565b6105da565b6100a06100fc3660046110ec565b61073b565b6100a061010f3660046111b4565b610781565b6101276101223660046111d8565b610895565b6040516001600160a01b0390911681526020015b60405180910390f35b6101576101523660046111b4565b610910565b60405161013b9190611239565b466107e5146101ad5760405162461bcd60e51b815260206004820152601060248201526f1b5a5cdb585d18da0818da185a5b925160821b60448201526064015b60405180910390fd5b73968d0cd7343f711216817e617d3f92a23dc91c0733146102045760405162461bcd60e51b81526020600482015260116024820152703737ba103a32b9ba3732ba1030b236b4b760791b60448201526064016101a4565b604080516101408101825273caba9d9424d6bad99ce352a943f59279b533417a8152739f1abc67bea4db5560371ff3089f4bfe934c36bc602082015273a85ddddceeab43dccaa259dd4936ac104386f9aa9181019190915273acf8bf98d1632e602d0b1761771049af21dd6597606082015273e9bf2a788c27dadc6b169d52408b710d267b9bff608082015273d086d2e3fac052a3f695a4e8905ce1722531163c60a082015273a325fd3a2f4f5cafe2c151ee428b5ceded62819360c0820152739422d990acdc3f2b3aa3b97303ad3060f09d7ffc60e082015273c3c97512421bf3e339e9fd412f18584e53138bfa6101008201527378fd38faa30ea66702cc39383d2e84f9a4a56fa6610120820152600090815b600a811015610353576103418282600a8110610337576103376112a0565b6020020151610a40565b8061034b816112b6565b915050610319565b5061037173caba9d9424d6bad99ce352a943f59279b533417a610aed565b91506103918273b033ba62ec622dc54d0abfe0254e79692147ca26610b28565b6103ae739f1abc67bea4db5560371ff3089f4bfe934c36bc610aed565b91506103ce8273087d08e3ba42e64e3948962dd1371f906d1278b9610b28565b6103eb73a85ddddceeab43dccaa259dd4936ac104386f9aa610aed565b915061040b827352ec2e6bbce45afff8955da6410bb13812f4289f610b28565b61042873acf8bf98d1632e602d0b1761771049af21dd6597610aed565b91506104488273d24d87ddc1917165435b306aac68d99e0f49a3fa610b28565b5050565b600061045783610aed565b60028101549091506001600160a01b03163314610497576000356001600160e01b0319166001604051620f948f60ea1b81526004016101a4929190611307565b6104a082610b75565b6104aa8183610bb5565b826001600160a01b03167fe13225a225fbfeebd9d707546f3d7adee5d72738ac686cc5b97266c49745a56b836040516104e39190611325565b60405180910390a2505050565b466107e5146105345760405162461bcd60e51b815260206004820152601060248201526f1b5a5cdb585d18da0818da185a5b925160821b60448201526064016101a4565b73968d0cd7343f711216817e617d3f92a23dc91c07331461058b5760405162461bcd60e51b81526020600482015260116024820152703737ba103a32b9ba3732ba1030b236b4b760791b60448201526064016101a4565b61059482610a40565b6001600160a01b038116156104485760006105ae83610aed565b90506105ba8183610b28565b505050565b6105c7610bfb565b6105d081610c57565b6104488282610c8d565b80602001516001600160a01b031681600001516001600160a01b0316146106145760405163491db47560e01b815260040160405180910390fd5b80516001600160a01b0390811660009081526020819052604090208054909116156106525760405163249b38f960e01b815260040160405180910390fd5b81604001516001600160a01b0316336001600160a01b03161415806106fa575061067c6008610895565b602083015160408085015190516304d971ab60e01b81526001600160a01b03928316600482015290821660248201529116906304d971ab90604401602060405180830381865afa1580156106d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f89190611338565b155b15610728576000356001600160e01b0319166001604051620f948f60ea1b81526004016101a4929190611307565b61073182610d31565b6104488183610d7a565b610743610bfb565b80516001600160a01b0390811660009081526020819052604090208054909116156107315760405163249b38f960e01b815260040160405180910390fd5b603354610100900460ff16158080156107a15750603354600160ff909116105b806107bb5750303b1580156107bb575060335460ff166001145b61081e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016101a4565b6033805460ff191660011790558015610841576033805461ff0019166101001790555b61084c600883610c8d565b8015610448576033805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f8111156108cc576108cc6112dd565b60ff1681526020810191909152604001600020546001600160a01b031690508061090b578160405163409140df60e11b81526004016101a4919061135a565b919050565b6040805160c0810182526000808252602082018190529181018290526060808201839052608082019290925260a08101919091526001600160a01b0380831660009081526020818152604091829020825160c081018452815485168152600182015485169281019290925260028101548416928201929092526003820154831660608201526004820154909216608083015260058101805460a0840191906109b790611374565b80601f01602080910402602001604051908101604052809291908181526020018280546109e390611374565b8015610a305780601f10610a0557610100808354040283529160200191610a30565b820191906000526020600020905b815481529060010190602001808311610a1357829003601f168201915b5050505050815250509050919050565b6000610a4b82610aed565b90506000610a596008610895565b6040516328bde1e160e01b81526001600160a01b03858116600483015291909116906328bde1e19060240160e060405180830381865afa158015610aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac591906113ae565b9050610ad18284610e19565b610adf828260000151610e56565b6105ba828260400151610e96565b6001600160a01b038082166000908152602081905260409020805490911661090b576040516334152acb60e11b815260040160405180910390fd5b6004820180546001600160a01b0319166001600160a01b03831690811790915515610448576001600160a01b03166000908152600160208190526040909120805460ff1916909117905550565b805160208083019190912060009081526001909152604090205460ff1615610bb25780604051630f32bad960e31b81526004016101a49190611325565b50565b60058201610bc382826114a4565b506001806000610bd884805160209091012090565b81526020810191909152604001600020805460ff19169115159190911790555050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610c55576000356001600160e01b0319166001604051620f948f60ea1b81526004016101a4929190611307565b565b806001600160a01b03163b600003610bb257604051630bfc64a360e21b81526001600160a01b03821660048201526024016101a4565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115610cc357610cc36112dd565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115610d0457610d046112dd565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b610d4060098260200151610ed6565b610d4f60048260400151610ed6565b610d5e600a8260600151610ed6565b610d6d600a8260800151610f05565b610bb28160a00151610b75565b805182546001600160a01b0319166001600160a01b039091161782556020810151610da6908390610e19565b610db4828260400151610e56565b610dc2828260600151610e96565b610dd0828260800151610b28565b610dde828260a00151610bb5565b80516040516001600160a01b03909116907fc9da0ae38bd4761b72da1045c9b2618f0cd991dcac01e1f9bbf68474025f074390600090a25050565b600191820180546001600160a01b039092166001600160a01b0319909216821790556000908152602082905260409020805460ff19169091179055565b600290910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b600390910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b6001600160a01b038116610eff57816040516315fb58b960e21b81526004016101a49190611564565b61044882825b6001600160a01b03811660009081526001602052604090205460ff16156104485781816001600160a01b031660405163720b355560e11b81526004016101a4929190611578565b6001600160a01b0381168114610bb257600080fd5b803561090b81610f4c565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715610fa557610fa5610f6c565b60405290565b600082601f830112610fbc57600080fd5b813567ffffffffffffffff80821115610fd757610fd7610f6c565b604051601f8301601f19908116603f01168101908282118183101715610fff57610fff610f6c565b8160405283815286602085880101111561101857600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561104b57600080fd5b823561105681610f4c565b9150602083013567ffffffffffffffff81111561107257600080fd5b61107e85828601610fab565b9150509250929050565b6000806040838503121561109b57600080fd5b82356110a681610f4c565b915060208301356110b681610f4c565b809150509250929050565b80356010811061090b57600080fd5b600080604083850312156110e357600080fd5b6110a6836110c1565b6000602082840312156110fe57600080fd5b813567ffffffffffffffff8082111561111657600080fd5b9083019060c0828603121561112a57600080fd5b611132610f82565b823561113d81610f4c565b8152602083013561114d81610f4c565b6020820152604083013561116081610f4c565b604082015261117160608401610f61565b606082015261118260808401610f61565b608082015260a08301358281111561119957600080fd5b6111a587828601610fab565b60a08301525095945050505050565b6000602082840312156111c657600080fd5b81356111d181610f4c565b9392505050565b6000602082840312156111ea57600080fd5b6111d1826110c1565b6000815180845260005b81811015611219576020818501810151868301820152016111fd565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600060018060a01b038084511660208401528060208501511660408401528060408501511660608401528060608501511660808401528060808501511660a08401525060a083015160c08084015261129860e08401826111f3565b949350505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016112d657634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052602160045260246000fd5b600b8110611303576113036112dd565b9052565b6001600160e01b031983168152604081016111d160208301846112f3565b6020815260006111d160208301846111f3565b60006020828403121561134a57600080fd5b815180151581146111d157600080fd5b602081016010831061136e5761136e6112dd565b91905290565b600181811c9082168061138857607f821691505b6020821081036113a857634e487b7160e01b600052602260045260246000fd5b50919050565b600060e082840312156113c057600080fd5b60405160e0810181811067ffffffffffffffff821117156113e3576113e3610f6c565b60405282516113f181610f4c565b8152602083015161140181610f4c565b6020820152604083015161141481610f4c565b6040820152606083015161142781610f4c565b806060830152506080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b601f8211156105ba57600081815260208120601f850160051c8101602086101561147d5750805b601f850160051c820191505b8181101561149c57828155600101611489565b505050505050565b815167ffffffffffffffff8111156114be576114be610f6c565b6114d2816114cc8454611374565b84611456565b602080601f83116001811461150757600084156114ef5750858301515b600019600386901b1c1916600185901b17855561149c565b600085815260208120601f198616915b8281101561153657888601518255948401946001909101908401611517565b50858210156115545787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020810161157282846112f3565b92915050565b6040810161158682856112f3565b826020830152939250505056fea2646970667358221220a5ac12d953259e369a3e222bfeab3e542da089261ed5bed56dbc09e26f56a61264736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c80639029bc60116100665780639029bc60146100db57806392d48756146100ee578063c4d66de814610101578063de981f1b14610114578063f46609401461014457600080fd5b806301f01a0e1461009857806368a5c123146100a25780637b0aecaa146100b5578063865e6fd3146100c8575b600080fd5b6100a0610164565b005b6100a06100b0366004611038565b61044c565b6100a06100c3366004611088565b6104f0565b6100a06100d63660046110d0565b6105bf565b6100a06100e93660046110ec565b6105da565b6100a06100fc3660046110ec565b61073b565b6100a061010f3660046111b4565b610781565b6101276101223660046111d8565b610895565b6040516001600160a01b0390911681526020015b60405180910390f35b6101576101523660046111b4565b610910565b60405161013b9190611239565b466107e5146101ad5760405162461bcd60e51b815260206004820152601060248201526f1b5a5cdb585d18da0818da185a5b925160821b60448201526064015b60405180910390fd5b73968d0cd7343f711216817e617d3f92a23dc91c0733146102045760405162461bcd60e51b81526020600482015260116024820152703737ba103a32b9ba3732ba1030b236b4b760791b60448201526064016101a4565b604080516101408101825273caba9d9424d6bad99ce352a943f59279b533417a8152739f1abc67bea4db5560371ff3089f4bfe934c36bc602082015273a85ddddceeab43dccaa259dd4936ac104386f9aa9181019190915273acf8bf98d1632e602d0b1761771049af21dd6597606082015273e9bf2a788c27dadc6b169d52408b710d267b9bff608082015273d086d2e3fac052a3f695a4e8905ce1722531163c60a082015273a325fd3a2f4f5cafe2c151ee428b5ceded62819360c0820152739422d990acdc3f2b3aa3b97303ad3060f09d7ffc60e082015273c3c97512421bf3e339e9fd412f18584e53138bfa6101008201527378fd38faa30ea66702cc39383d2e84f9a4a56fa6610120820152600090815b600a811015610353576103418282600a8110610337576103376112a0565b6020020151610a40565b8061034b816112b6565b915050610319565b5061037173caba9d9424d6bad99ce352a943f59279b533417a610aed565b91506103918273b033ba62ec622dc54d0abfe0254e79692147ca26610b28565b6103ae739f1abc67bea4db5560371ff3089f4bfe934c36bc610aed565b91506103ce8273087d08e3ba42e64e3948962dd1371f906d1278b9610b28565b6103eb73a85ddddceeab43dccaa259dd4936ac104386f9aa610aed565b915061040b827352ec2e6bbce45afff8955da6410bb13812f4289f610b28565b61042873acf8bf98d1632e602d0b1761771049af21dd6597610aed565b91506104488273d24d87ddc1917165435b306aac68d99e0f49a3fa610b28565b5050565b600061045783610aed565b60028101549091506001600160a01b03163314610497576000356001600160e01b0319166001604051620f948f60ea1b81526004016101a4929190611307565b6104a082610b75565b6104aa8183610bb5565b826001600160a01b03167fe13225a225fbfeebd9d707546f3d7adee5d72738ac686cc5b97266c49745a56b836040516104e39190611325565b60405180910390a2505050565b466107e5146105345760405162461bcd60e51b815260206004820152601060248201526f1b5a5cdb585d18da0818da185a5b925160821b60448201526064016101a4565b73968d0cd7343f711216817e617d3f92a23dc91c07331461058b5760405162461bcd60e51b81526020600482015260116024820152703737ba103a32b9ba3732ba1030b236b4b760791b60448201526064016101a4565b61059482610a40565b6001600160a01b038116156104485760006105ae83610aed565b90506105ba8183610b28565b505050565b6105c7610bfb565b6105d081610c57565b6104488282610c8d565b80602001516001600160a01b031681600001516001600160a01b0316146106145760405163491db47560e01b815260040160405180910390fd5b80516001600160a01b0390811660009081526020819052604090208054909116156106525760405163249b38f960e01b815260040160405180910390fd5b81604001516001600160a01b0316336001600160a01b03161415806106fa575061067c6008610895565b602083015160408085015190516304d971ab60e01b81526001600160a01b03928316600482015290821660248201529116906304d971ab90604401602060405180830381865afa1580156106d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f89190611338565b155b15610728576000356001600160e01b0319166001604051620f948f60ea1b81526004016101a4929190611307565b61073182610d31565b6104488183610d7a565b610743610bfb565b80516001600160a01b0390811660009081526020819052604090208054909116156107315760405163249b38f960e01b815260040160405180910390fd5b603354610100900460ff16158080156107a15750603354600160ff909116105b806107bb5750303b1580156107bb575060335460ff166001145b61081e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016101a4565b6033805460ff191660011790558015610841576033805461ff0019166101001790555b61084c600883610c8d565b8015610448576033805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f8111156108cc576108cc6112dd565b60ff1681526020810191909152604001600020546001600160a01b031690508061090b578160405163409140df60e11b81526004016101a4919061135a565b919050565b6040805160c0810182526000808252602082018190529181018290526060808201839052608082019290925260a08101919091526001600160a01b0380831660009081526020818152604091829020825160c081018452815485168152600182015485169281019290925260028101548416928201929092526003820154831660608201526004820154909216608083015260058101805460a0840191906109b790611374565b80601f01602080910402602001604051908101604052809291908181526020018280546109e390611374565b8015610a305780601f10610a0557610100808354040283529160200191610a30565b820191906000526020600020905b815481529060010190602001808311610a1357829003601f168201915b5050505050815250509050919050565b6000610a4b82610aed565b90506000610a596008610895565b6040516328bde1e160e01b81526001600160a01b03858116600483015291909116906328bde1e19060240160e060405180830381865afa158015610aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac591906113ae565b9050610ad18284610e19565b610adf828260000151610e56565b6105ba828260400151610e96565b6001600160a01b038082166000908152602081905260409020805490911661090b576040516334152acb60e11b815260040160405180910390fd5b6004820180546001600160a01b0319166001600160a01b03831690811790915515610448576001600160a01b03166000908152600160208190526040909120805460ff1916909117905550565b805160208083019190912060009081526001909152604090205460ff1615610bb25780604051630f32bad960e31b81526004016101a49190611325565b50565b60058201610bc382826114a4565b506001806000610bd884805160209091012090565b81526020810191909152604001600020805460ff19169115159190911790555050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610c55576000356001600160e01b0319166001604051620f948f60ea1b81526004016101a4929190611307565b565b806001600160a01b03163b600003610bb257604051630bfc64a360e21b81526001600160a01b03821660048201526024016101a4565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115610cc357610cc36112dd565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115610d0457610d046112dd565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b610d4060098260200151610ed6565b610d4f60048260400151610ed6565b610d5e600a8260600151610ed6565b610d6d600a8260800151610f05565b610bb28160a00151610b75565b805182546001600160a01b0319166001600160a01b039091161782556020810151610da6908390610e19565b610db4828260400151610e56565b610dc2828260600151610e96565b610dd0828260800151610b28565b610dde828260a00151610bb5565b80516040516001600160a01b03909116907fc9da0ae38bd4761b72da1045c9b2618f0cd991dcac01e1f9bbf68474025f074390600090a25050565b600191820180546001600160a01b039092166001600160a01b0319909216821790556000908152602082905260409020805460ff19169091179055565b600290910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b600390910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b6001600160a01b038116610eff57816040516315fb58b960e21b81526004016101a49190611564565b61044882825b6001600160a01b03811660009081526001602052604090205460ff16156104485781816001600160a01b031660405163720b355560e11b81526004016101a4929190611578565b6001600160a01b0381168114610bb257600080fd5b803561090b81610f4c565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715610fa557610fa5610f6c565b60405290565b600082601f830112610fbc57600080fd5b813567ffffffffffffffff80821115610fd757610fd7610f6c565b604051601f8301601f19908116603f01168101908282118183101715610fff57610fff610f6c565b8160405283815286602085880101111561101857600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561104b57600080fd5b823561105681610f4c565b9150602083013567ffffffffffffffff81111561107257600080fd5b61107e85828601610fab565b9150509250929050565b6000806040838503121561109b57600080fd5b82356110a681610f4c565b915060208301356110b681610f4c565b809150509250929050565b80356010811061090b57600080fd5b600080604083850312156110e357600080fd5b6110a6836110c1565b6000602082840312156110fe57600080fd5b813567ffffffffffffffff8082111561111657600080fd5b9083019060c0828603121561112a57600080fd5b611132610f82565b823561113d81610f4c565b8152602083013561114d81610f4c565b6020820152604083013561116081610f4c565b604082015261117160608401610f61565b606082015261118260808401610f61565b608082015260a08301358281111561119957600080fd5b6111a587828601610fab565b60a08301525095945050505050565b6000602082840312156111c657600080fd5b81356111d181610f4c565b9392505050565b6000602082840312156111ea57600080fd5b6111d1826110c1565b6000815180845260005b81811015611219576020818501810151868301820152016111fd565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600060018060a01b038084511660208401528060208501511660408401528060408501511660608401528060608501511660808401528060808501511660a08401525060a083015160c08084015261129860e08401826111f3565b949350505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016112d657634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052602160045260246000fd5b600b8110611303576113036112dd565b9052565b6001600160e01b031983168152604081016111d160208301846112f3565b6020815260006111d160208301846111f3565b60006020828403121561134a57600080fd5b815180151581146111d157600080fd5b602081016010831061136e5761136e6112dd565b91905290565b600181811c9082168061138857607f821691505b6020821081036113a857634e487b7160e01b600052602260045260246000fd5b50919050565b600060e082840312156113c057600080fd5b60405160e0810181811067ffffffffffffffff821117156113e3576113e3610f6c565b60405282516113f181610f4c565b8152602083015161140181610f4c565b6020820152604083015161141481610f4c565b6040820152606083015161142781610f4c565b806060830152506080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b601f8211156105ba57600081815260208120601f850160051c8101602086101561147d5750805b601f850160051c820191505b8181101561149c57828155600101611489565b505050505050565b815167ffffffffffffffff8111156114be576114be610f6c565b6114d2816114cc8454611374565b84611456565b602080601f83116001811461150757600084156114ef5750858301515b600019600386901b1c1916600185901b17855561149c565b600085815260208120601f198616915b8281101561153657888601518255948401946001909101908401611517565b50858210156115545787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020810161157282846112f3565b92915050565b6040810161158682856112f3565b826020830152939250505056fea2646970667358221220a5ac12d953259e369a3e222bfeab3e542da089261ed5bed56dbc09e26f56a61264736f6c63430008110033", + "numDeployments": 7, + "solcInputHash": "f5939ebe47e4086c92eac99ab2681ceb", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum RoleAccess\",\"name\":\"infoType\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"ErrDuplicatedInfo\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"ErrDuplicatedPubkey\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentProfile\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrIdAndConsensusDiffer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentProfile\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum RoleAccess\",\"name\":\"infoType\",\"type\":\"uint8\"}],\"name\":\"ErrZeroAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroPubkey\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"}],\"name\":\"ProfileAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"enum RoleAccess\",\"name\":\"addressType\",\"type\":\"uint8\"}],\"name\":\"ProfileAddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__reservedGovernor\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"internalType\":\"struct IProfile.CandidateProfile\",\"name\":\"profile\",\"type\":\"tuple\"}],\"name\":\"addNewProfile\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"changePubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"getConsensus2Id\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"}],\"name\":\"getId2Profile\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__reservedGovernor\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"internalType\":\"struct IProfile.CandidateProfile\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusList\",\"type\":\"address[]\"}],\"name\":\"getManyConsensus2Id\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"idList\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"idList\",\"type\":\"address[]\"}],\"name\":\"getManyId2Consensus\",\"outputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusList\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorContract\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"trustedOrgContract\",\"type\":\"address\"}],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newAdminAddr\",\"type\":\"address\"}],\"name\":\"requestChangeAdminAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"newConsensusAddr\",\"type\":\"address\"}],\"name\":\"requestChangeConsensusAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"id\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"requestChangeTreasuryAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrDuplicatedInfo(uint8,uint256)\":[{\"details\":\"Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key, and with value type of `infoType`.\"}],\"ErrExistentProfile()\":[{\"details\":\"Error of already existed profile.\"}],\"ErrIdAndConsensusDiffer()\":[{\"details\":\"Error when create a new profile whose id and consensus are not identical.\"}],\"ErrNonExistentProfile()\":[{\"details\":\"Error of non existed profile.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"events\":{\"ContractUpdated(uint8,address)\":{\"details\":\"Emitted when a contract is updated.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"ProfileAdded(address)\":{\"details\":\"Event emitted when a profile with `id` is added.\"},\"ProfileAddressChanged(address,uint8)\":{\"details\":\"Event emitted when a address in a profile is changed.\"},\"PubkeyChanged(address,bytes)\":{\"details\":\"Event emitted when the pubkey of the `id` is changed.\"}},\"kind\":\"dev\",\"methods\":{\"addNewProfile((address,address,address,address,address,bytes))\":{\"details\":\"Requirements: - The profile must not be existent before. - Only contract admin can call this method.\"},\"changePubkey(address,bytes)\":{\"details\":\"Requirements: - The profile must be existed. - Only user with candidate admin role can call this method. - New public key must not be duplicated.\"},\"execApplyValidatorCandidate(address,address,address,bytes)\":{\"details\":\"Cross-contract function to add/update new profile of a validator candidate when they applying for candidate role. Requirements: - Only `stakingContract` can call this method.\"},\"getConsensus2Id(address)\":{\"details\":\"Getter to backward query from `consensus` address to `id` address.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getId2Profile(address)\":{\"details\":\"Getter to query full `profile` from `id` address.\"},\"getManyConsensus2Id(address[])\":{\"details\":\"Getter to backward batch query from `consensus` address to `id` address.\"},\"getManyId2Consensus(address[])\":{\"details\":\"Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\"},\"requestChangeAdminAddress(address,address)\":{\"details\":\"Side-effects on other contracts: - Update Staking contract: + [x] Update (id => PoolDetail) mapping in {BaseStaking.sol}. + [x] Update `_adminOfActivePoolMapping` in {BaseStaking.sol}. - Update Validator contract: + [x] Update (id => ValidatorCandidate) mapping\"},\"requestChangeConsensusAddr(address,address)\":{\"details\":\"Side-effects on other contracts: - Update in Staking contract for Consensus address mapping: + [x] Keep the same previous pool address. - Update in Validator contract for: + [x] Consensus Address mapping + [x] Bridge Address mapping + [x] Jail mapping + [x] Pending reward mapping + [x] Schedule mapping - Update in Slashing contract for: + [x] Handling slash indicator + [x] Handling slash fast finality + [x] Handling slash double sign - Update in Proposal contract for: + [-] Preserve the consensus address and recipient target of locked amount of emergency exit - Update Trusted Org contracts: + [x] Remove and delete weight of the old consensus + [x] Replace and add weight for the new consensus\"},\"requestChangeTreasuryAddr(address,address)\":{\"details\":\"Side-effects on other contracts: - Update Validator contract: + [x] Update (id => ValidatorCandidate) mapping - Update governance admin: + [-] Update recipient in the EmergencyExitBallot to the newTreasury. Cannot impl since we cannot cancel the previous the ballot and create a new ballot on behalf of the validator contract.\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addNewProfile((address,address,address,address,address,bytes))\":{\"notice\":\"Add a new profile.\"},\"changePubkey(address,bytes)\":{\"notice\":\"The candidate admin changes the public key.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/profile/Profile.sol\":\"Profile\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../udvts/Types.sol\\\";\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n TConsensus consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address __reservedGovernor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n /// @dev Event emitted when the pubkey of the `id` is changed.\\n event PubkeyChanged(address indexed id, bytes pubkey);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n /// @dev Error when create a new profile whose id and consensus are not identical.\\n error ErrIdAndConsensusDiffer();\\n /**\\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\\n * and with value type of `infoType`.\\n */\\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\\n error ErrDuplicatedPubkey(bytes pubkey);\\n error ErrZeroAddress(RoleAccess infoType);\\n error ErrZeroPubkey();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\\n\\n /// @dev Getter to backward query from `consensus` address to `id` address.\\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\\n\\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\\n * applying for candidate role.\\n *\\n * Requirements:\\n * - Only `stakingContract` can call this method.\\n */\\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\\n\\n /**\\n * @notice The candidate admin changes the public key.\\n *\\n * @dev Requirements:\\n * - The profile must be existed.\\n * - Only user with candidate admin role can call this method.\\n * - New public key must not be duplicated.\\n */\\n\\n function changePubkey(address id, bytes memory pubkey) external;\\n}\\n\",\"keccak256\":\"0x14dfb3198bf21724f5315198e1b23564902821ef56730c7db49e3d1165a36d36\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\nimport \\\"../udvts/Types.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n /**\\n * @dev Error indicating that a query for a duplicate entry was made.\\n */\\n error ErrQueryForDupplicated();\\n\\n /**\\n * @dev Error indicating that a query was made for a non-existent consensus address.\\n */\\n error ErrQueryForNonExistentConsensusAddress();\\n\\n /**\\n * @dev Error indicating that a governor address has already been added.\\n * @param addr The address of the governor that is already added.\\n */\\n error ErrGovernorAddressIsAlreadyAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is not added.\\n * @param addr The address of the consensus contract that is not added.\\n */\\n error ErrConsensusAddressIsNotAdded(TConsensus addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is already added.\\n * @param addr The address of the consensus contract that is already added.\\n */\\n error ErrConsensusAddressIsAlreadyAdded(TConsensus addr);\\n\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n TConsensus consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address __deprecatedBridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(TConsensus[] orgs);\\n /// @dev Emitted when the consensus address of a trusted organization is changed.\\n event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n *\\n * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\\n */\\n function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeight() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeightById(address cid) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganization() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x0b2a44131128f965e20cbea424987817cb504502e5d83d6523ae45ffeb5e53fe\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n /**\\n * @dev Address of the pool.\\n * @custom non-volatile-storage Permanently set to the first consensus address of the candidate.\\n */\\n address pid;\\n\\n /**\\n * @dev The address of the pool admin.\\n * @custom shadowed-storage This storage slot is always kept in sync with the admin in `Profile-CandidateProfile`.\\n */\\n address __shadowedPoolAdmin;\\n\\n /// @dev Self-staking amount\\n uint256 stakingAmount;\\n\\n /// @dev Total number of RON staking for the pool\\n uint256 stakingTotal;\\n\\n /// @dev Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n\\n /// @dev Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(TConsensus consensusAddr, address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `admin` is currently active.\\n */\\n function isAdminOfActivePool(address admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address admin) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool details.\\n */\\n function getPoolDetail(\\n TConsensus consensusAddr\\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\\n\\n function getPoolDetailById(\\n address poolId\\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 secs) external;\\n}\\n\",\"keccak256\":\"0xadaec16c22c590a42070d5e41fcc83c9fa89a4134528dd2159b5946ecbc64253\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed poolId, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed poolId, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed poolId,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed poolId,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 minRange, uint256 maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address candidateAdmin,\\n TConsensus consensusAddr,\\n address payable treasuryAddr,\\n uint256 commissionRate,\\n bytes calldata pubkey\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata pools, uint256 period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(TConsensus consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `consensusAddr` for `amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(TConsensus consensusAddr, uint256 amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n TConsensus consensusAddr,\\n uint256 effectiveDaysOnwards,\\n uint256 commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(TConsensus consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(TConsensus consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x8880174d4be9ceeed98a1f1cda5e833ce2afe8ee8b0e5921088a796a9a9bc69d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed poolId, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed poolId, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(TConsensus consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(TConsensus consensusAddr, uint256 amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(TConsensus consensusAddrSrc, TConsensus consensusAddrDst, uint256 amount) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(\\n address user,\\n TConsensus[] calldata consensusAddrList\\n ) external view returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(TConsensus[] calldata consensusAddrList) external returns (uint256 amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(\\n TConsensus[] calldata consensusAddrList,\\n TConsensus consensusAddrDst\\n ) external returns (uint256 amount);\\n}\\n\",\"keccak256\":\"0xe8a650a7348d45b2614ece66083f140801e8375bb8b733addf02209073991ef3\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\nimport { TPoolId, TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(TConsensus consensusAddr, address user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(\\n TConsensus[] calldata consensusAddrs,\\n address[] calldata userList\\n ) external view returns (uint256[] memory);\\n\\n function getManyStakingAmountsById(\\n address[] calldata poolIds,\\n address[] calldata userList\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(TConsensus consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\\n\\n function getManyStakingTotalsById(\\n address[] calldata poolIds\\n ) external view returns (uint256[] memory stakingAmounts_);\\n}\\n\",\"keccak256\":\"0x69626097d76dde60ce9fc73c6f8823ad7e8a5b6ff23ec3f20b9e1499f700d1b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./IStakingCallback.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking, IStakingCallback {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards, uint256 period) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address poolId, uint256 amount) external returns (uint256 actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xaa2491ed5276434d2a894ece749ad15835ff2791fa614d3cf3b58c0bdd418881\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStakingCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface IStakingCallback {\\n /**\\n * @dev Requirements:\\n * - Only Profile contract can call this method.\\n */\\n function execChangeAdminAddress(address poolAddr, address newAdminAddr) external;\\n}\\n\",\"keccak256\":\"0x64e1659e4fb15498be8956f696e72e4c7370cc7439ab5395c94f24e85b92e85b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n /**\\n * @dev The address of the candidate admin.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\\n */\\n address __shadowedAdmin;\\n /**\\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\\n */\\n TConsensus __shadowedConsensus;\\n /**\\n * @dev Address that receives mining reward of the validator\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\\n */\\n address payable __shadowedTreasury;\\n /// @dev Address of the bridge operator corresponding to the candidate\\n address ____deprecatedBridgeOperatorAddr;\\n /**\\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\\n * Values in range [0; 100_00] stands for 0-100%\\n */\\n uint256 commissionRate;\\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnward() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xd797160208b17456231633415848fffa0a5ba7e9ab7f81b241d1bd89c74c2c83\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManagerCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManagerCallback {\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address candidateAdmin,\\n address cid,\\n address payable treasuryAddr,\\n uint256 commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\\n * This updates the shadow storage slot of \\\"shadowedAdmin\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeAdminAddress(address cid, address newAdmin) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n * This updates the shadow storage slot of \\\"shadowedConsensus\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\\n * This updates the shadow storage slot of \\\"shadowedTreasury\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\\n}\\n\",\"keccak256\":\"0x0f241310c7f284374c26792fe73230a3b2cabc709d04f28a7b366292821f96dc\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the fast finality reward is distributed.\\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\\n event FastFinalityRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n /// @dev Error thrown when the info of releasing locked fund not exist.\\n error ErrLockedFundReleaseInfoNotFound(address cid);\\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\\n error ErrLockedFundMightBeRecycled(address cid);\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x98caa14d1e6dc6a9ab6d09c864a32790014890f9e2ad7951b77ff5658e0f7c8b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./ICandidateManagerCallback.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManagerCallback,\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0xf4f96a624e7c77bbce044c67e3f4b406e65871debc19e7bfab663c1fcfcbc7b0\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed cid,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed cid, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address cid, uint256 period) external;\\n}\\n\",\"keccak256\":\"0xbf540beae3c94d2b42e7bbb74f921086c23613fa4db43a5ca5310cb179b46d5e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xb63c6a5edcc82cc04af534e8398eee9a805bb9cb179f3e00750e6ff92354bed9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(TConsensus) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n TConsensus addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n TConsensus addr,\\n uint256 blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\\n\\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x27afa712094804b997f55e8f8d320760e07d7260ab33aeb8fb61c39849f09bf3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport { TConsensus } from \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducer() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x45ba68ae461f9c8ecde0fb3c7db78d6d9f44a4a6cc0f03e7b8edad0cced55643\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/ronin/profile/Profile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/validator/ICandidateManager.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport \\\"./ProfileXComponents.sol\\\";\\nimport { ErrUnauthorized, RoleAccess } from \\\"../../utils/CommonErrors.sol\\\";\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\npragma solidity ^0.8.9;\\n\\ncontract Profile is IProfile, ProfileXComponents, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(address validatorContract) external initializer {\\n _setContract(ContractType.VALIDATOR, validatorContract);\\n }\\n\\n function initializeV2(address stakingContract, address trustedOrgContract) external reinitializer(2) {\\n _setContract(ContractType.STAKING, stakingContract);\\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, trustedOrgContract);\\n\\n address[] memory validatorCandidates = IRoninValidatorSet(getContract(ContractType.VALIDATOR))\\n .getValidatorCandidates();\\n TConsensus[] memory consensuses;\\n assembly (\\\"memory-safe\\\") {\\n consensuses := validatorCandidates\\n }\\n for (uint256 i; i < validatorCandidates.length; ++i) {\\n _consensus2Id[consensuses[i]] = validatorCandidates[i];\\n }\\n\\n __migrationRenouncedCandidates();\\n }\\n\\n /**\\n * @dev Add addresses of renounced candidates into registry. Only called during {initializeV2}F.\\n */\\n function __migrationRenouncedCandidates() internal virtual {}\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function getId2Profile(address id) external view returns (CandidateProfile memory) {\\n return _id2Profile[id];\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList) {\\n consensusList = new TConsensus[](idList.length);\\n unchecked {\\n for (uint i; i < idList.length; ++i) {\\n consensusList[i] = _id2Profile[idList[i]].consensus;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function getConsensus2Id(TConsensus consensus) external view returns (address id) {\\n id = _consensus2Id[consensus];\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function getManyConsensus2Id(TConsensus[] calldata consensusList) external view returns (address[] memory idList) {\\n idList = new address[](consensusList.length);\\n unchecked {\\n for (uint i; i < consensusList.length; ++i) {\\n idList[i] = _consensus2Id[consensusList[i]];\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function addNewProfile(CandidateProfile memory profile) external onlyAdmin {\\n CandidateProfile storage _profile = _id2Profile[profile.id];\\n if (_profile.id != address(0)) revert ErrExistentProfile();\\n _addNewProfile(_profile, profile);\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n *\\n * @dev Side-effects on other contracts:\\n * - Update Staking contract:\\n * + [x] Update (id => PoolDetail) mapping in {BaseStaking.sol}.\\n * + [x] Update `_adminOfActivePoolMapping` in {BaseStaking.sol}.\\n * - Update Validator contract:\\n * + [x] Update (id => ValidatorCandidate) mapping\\n */\\n function requestChangeAdminAddress(address id, address newAdminAddr) external {\\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\\n _requireCandidateAdmin(_profile);\\n _requireNonZeroAndNonDuplicated(RoleAccess.ADMIN, newAdminAddr);\\n _setAdmin(_profile, newAdminAddr);\\n\\n IStaking stakingContract = IStaking(getContract(ContractType.STAKING));\\n stakingContract.execChangeAdminAddress(id, newAdminAddr);\\n\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n validatorContract.execChangeAdminAddress(id, newAdminAddr);\\n\\n emit ProfileAddressChanged(id, RoleAccess.ADMIN);\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n *\\n * @dev Side-effects on other contracts:\\n * - Update in Staking contract for Consensus address mapping:\\n * + [x] Keep the same previous pool address.\\n * - Update in Validator contract for:\\n * + [x] Consensus Address mapping\\n * + [x] Bridge Address mapping\\n * + [x] Jail mapping\\n * + [x] Pending reward mapping\\n * + [x] Schedule mapping\\n * - Update in Slashing contract for:\\n * + [x] Handling slash indicator\\n * + [x] Handling slash fast finality\\n * + [x] Handling slash double sign\\n * - Update in Proposal contract for:\\n * + [-] Preserve the consensus address and recipient target of locked amount of emergency exit\\n * - Update Trusted Org contracts:\\n * + [x] Remove and delete weight of the old consensus\\n * + [x] Replace and add weight for the new consensus\\n */\\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external {\\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\\n _requireCandidateAdmin(_profile);\\n _requireNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(newConsensusAddr));\\n\\n TConsensus oldConsensusAddr = _profile.consensus;\\n _setConsensus(_profile, newConsensusAddr);\\n\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n validatorContract.execChangeConsensusAddress(id, newConsensusAddr);\\n\\n IRoninTrustedOrganization trustedOrgContract = IRoninTrustedOrganization(\\n getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)\\n );\\n trustedOrgContract.execChangeConsensusAddressForTrustedOrg({\\n oldConsensusAddr: oldConsensusAddr,\\n newConsensusAddr: newConsensusAddr\\n });\\n\\n emit ProfileAddressChanged(id, RoleAccess.CONSENSUS);\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n *\\n * @dev Side-effects on other contracts:\\n * - Update Validator contract:\\n * + [x] Update (id => ValidatorCandidate) mapping\\n * - Update governance admin:\\n * + [-] Update recipient in the EmergencyExitBallot to the newTreasury.\\n * Cannot impl since we cannot cancel the previous the ballot and\\n * create a new ballot on behalf of the validator contract.\\n */\\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external {\\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\\n _requireCandidateAdmin(_profile);\\n _requireNonZeroAndNonDuplicated(RoleAccess.TREASURY, newTreasury);\\n _setTreasury(_profile, newTreasury);\\n\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n validatorContract.execChangeTreasuryAddress(id, newTreasury);\\n\\n emit ProfileAddressChanged(id, RoleAccess.TREASURY);\\n }\\n\\n /**\\n * @inheritdoc IProfile\\n */\\n function changePubkey(address id, bytes memory pubkey) external {\\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\\n _requireCandidateAdmin(_profile);\\n _requireNonDuplicatedPubkey(pubkey);\\n _setPubkey(_profile, pubkey);\\n\\n emit PubkeyChanged(id, pubkey);\\n }\\n\\n function _requireCandidateAdmin(CandidateProfile storage sProfile) internal view {\\n if (\\n msg.sender != sProfile.admin ||\\n !IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(sProfile.consensus, msg.sender)\\n ) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x05ba77878b7b85726265fedcd49051f0561c535396327c55f2a65989deef5a5a\",\"license\":\"MIT\"},\"contracts/ronin/profile/ProfileHandler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../udvts/Types.sol\\\";\\nimport \\\"../../utils/RoleAccess.sol\\\";\\nimport { ProfileStorage } from \\\"./ProfileStorage.sol\\\";\\n\\nabstract contract ProfileHandler is ProfileStorage {\\n /**\\n * @dev Checks each element in the new profile and reverts if there is duplication with any existing profile.\\n */\\n function _requireNonDuplicatedInRegistry(CandidateProfile memory profile) internal view {\\n _requireNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(profile.consensus));\\n _requireNonZeroAndNonDuplicated(RoleAccess.CANDIDATE_ADMIN, profile.admin);\\n _requireNonZeroAndNonDuplicated(RoleAccess.TREASURY, profile.treasury);\\n _requireNonDuplicated(RoleAccess.TREASURY, profile.__reservedGovernor);\\n _requireNonDuplicatedPubkey(profile.pubkey);\\n }\\n\\n function _requireNonZeroAndNonDuplicated(RoleAccess addressType, address addr) internal view {\\n if (addr == address(0)) revert ErrZeroAddress(addressType);\\n _requireNonDuplicated(addressType, addr);\\n }\\n\\n function _requireNonDuplicated(RoleAccess addressType, address addr) internal view {\\n if (_checkNonDuplicatedAddr(addr)) {\\n revert ErrDuplicatedInfo(addressType, uint256(uint160(addr)));\\n }\\n }\\n\\n function _checkNonDuplicatedAddr(address addr) internal view returns (bool) {\\n return _registry[uint256(uint160(addr))];\\n }\\n\\n function _requireNonDuplicatedPubkey(bytes memory pubkey) internal view {\\n if (_checkNonDuplicatedPubkey(pubkey)) {\\n revert ErrDuplicatedPubkey(pubkey);\\n }\\n }\\n\\n function _checkNonDuplicatedPubkey(bytes memory pubkey) internal view returns (bool) {\\n return _registry[_hashPubkey(pubkey)];\\n }\\n}\\n\",\"keccak256\":\"0xcf1544c9c8bd6994569ecc971600b36094a07dc52837e26ec82331b6b975b280\",\"license\":\"MIT\"},\"contracts/ronin/profile/ProfileStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../udvts/Types.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { IProfile } from \\\"../../interfaces/IProfile.sol\\\";\\n\\nabstract contract ProfileStorage is IProfile, HasContracts {\\n /// @dev Mapping from id address => candidate profile.\\n mapping(address => CandidateProfile) internal _id2Profile;\\n\\n /**\\n * @dev Mapping from any address or keccak256(pubkey) => whether it is already registered.\\n * This registry can only be toggled to `true` and NOT vice versa. All registered values\\n * cannot be reused.\\n */\\n mapping(uint256 => bool) internal _registry;\\n\\n /// @dev Mapping from consensus address => id address.\\n mapping(TConsensus => address) internal _consensus2Id;\\n\\n /// @dev Upgradeable gap.\\n bytes32[48] __gap;\\n\\n /**\\n * @dev Add a profile from memory to storage.\\n */\\n function _addNewProfile(CandidateProfile storage _profile, CandidateProfile memory newProfile) internal {\\n _profile.id = newProfile.id;\\n\\n _setConsensus(_profile, newProfile.consensus);\\n _setAdmin(_profile, newProfile.admin);\\n _setTreasury(_profile, newProfile.treasury);\\n _setGovernor(_profile, newProfile.__reservedGovernor);\\n _setPubkey(_profile, newProfile.pubkey);\\n\\n emit ProfileAdded(newProfile.id);\\n }\\n\\n function _setConsensus(CandidateProfile storage _profile, TConsensus consensus) internal {\\n delete _consensus2Id[_profile.consensus];\\n _consensus2Id[consensus] = _profile.id;\\n\\n _profile.consensus = consensus;\\n _registry[uint256(uint160(TConsensus.unwrap(consensus)))] = true;\\n }\\n\\n function _setAdmin(CandidateProfile storage _profile, address admin) internal {\\n _profile.admin = admin;\\n _registry[uint256(uint160(admin))] = true;\\n }\\n\\n function _setTreasury(CandidateProfile storage _profile, address payable treasury) internal {\\n _profile.treasury = treasury;\\n _registry[uint256(uint160(address(treasury)))] = true;\\n }\\n\\n /**\\n * @dev Allow to registry a profile without governor address since not all validators are governing validators.\\n */\\n function _setGovernor(CandidateProfile storage _profile, address governor) internal {\\n _profile.__reservedGovernor = governor;\\n if (governor != address(0)) {\\n _registry[uint256(uint160(governor))] = true;\\n }\\n }\\n\\n function _setPubkey(CandidateProfile storage _profile, bytes memory pubkey) internal {\\n _profile.pubkey = pubkey;\\n _registry[_hashPubkey(pubkey)] = true;\\n }\\n\\n /**\\n * @dev Get an existed profile struct from `id`. Revert if the profile does not exists.\\n */\\n function _getId2ProfileHelper(address id) internal view returns (CandidateProfile storage _profile) {\\n _profile = _id2Profile[id];\\n if (_profile.id == address(0)) revert ErrNonExistentProfile();\\n }\\n\\n /**\\n * @dev Returns hash of a public key.\\n */\\n function _hashPubkey(bytes memory pubkey) internal pure returns (uint256) {\\n return uint256(keccak256(pubkey));\\n }\\n}\\n\",\"keccak256\":\"0x9756c698e185d256bb050355b6b317e29d95923e5f78af39f9b5dc30ce35b596\",\"license\":\"MIT\"},\"contracts/ronin/profile/ProfileXComponents.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\nimport \\\"./ProfileHandler.sol\\\";\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract ProfileXComponents is IProfile, ProfileHandler {\\n /**\\n * @inheritdoc IProfile\\n */\\n function execApplyValidatorCandidate(\\n address admin,\\n address id,\\n address treasury,\\n bytes calldata pubkey\\n ) external override onlyContract(ContractType.STAKING) {\\n // Check existent profile\\n CandidateProfile storage _profile = _id2Profile[id];\\n if (_profile.id != address(0)) revert ErrExistentProfile();\\n\\n // Validate the info and add the profile\\n CandidateProfile memory profile = CandidateProfile({\\n id: id,\\n consensus: TConsensus.wrap(id),\\n admin: admin,\\n treasury: payable(treasury),\\n __reservedGovernor: address(0),\\n pubkey: pubkey\\n });\\n _requireNonDuplicatedInRegistry(profile);\\n _addNewProfile(_profile, profile);\\n }\\n}\\n\",\"keccak256\":\"0x3f3b217c36933a084fb66bedcddc673e89a98dad4f6fa85ceba0c19671388b45\",\"license\":\"MIT\"},\"contracts/udvts/Types.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ntype TPoolId is address;\\ntype TConsensus is address;\\n\\nusing { TPoolIdEq as == } for TPoolId global;\\nusing { TConsensusEq as == } for TConsensus global;\\n\\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\\n}\\n\\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\\n}\\n\",\"keccak256\":\"0x3017524670c86eaf3930447e482b6f372ae091bb5f8eb89570924599fa626ed7\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x7e228d0dbe377086fb2f7438b1e79b4e30b4eeb0225036b90a33effc5af06197\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALITY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE,\\n /* 9 */ CONSENSUS,\\n /* 10 */ TREASURY\\n}\\n\",\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b603354610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60335460ff90811610156100dc576033805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611c0a806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806392d487561161008c578063de981f1b11610066578063de981f1b146101f2578063eed1e42014610205578063f466094014610218578063f9226b1a1461023857600080fd5b806392d48756146101ac578063b261596f146101bf578063c4d66de8146101df57600080fd5b806350a9fc29116100c857806350a9fc291461012a57806368a5c1231461017357806384cb101014610186578063865e6fd31461019957600080fd5b80630840ba72146100ef578063183584c1146101045780631f97bdb114610117575b600080fd5b6101026100fd366004611382565b61024b565b005b610102610112366004611382565b610412565b610102610125366004611382565b6104f3565b6101566101383660046113bb565b6001600160a01b039081166000908152600260205260409020541690565b6040516001600160a01b0390911681526020015b60405180910390f35b6101026101813660046114bf565b610657565b610102610194366004611382565b6106c6565b6101026101a736600461151e565b61081b565b6101026101ba36600461153a565b61083a565b6101d26101cd36600461164e565b61088a565b60405161016a9190611690565b6101026101ed3660046113bb565b610963565b6101566102003660046116dd565b610a30565b6101026102133660046116f8565b610aab565b61022b6102263660046113bb565b610ba2565b60405161016a91906117e6565b6101d261024636600461164e565b610cd2565b603354600290610100900460ff1615801561026d575060335460ff8083169116105b6102925760405162461bcd60e51b81526004016102899061184d565b60405180910390fd5b6033805461ffff191660ff8316176101001790556102b1600984610da2565b6102bc600a83610da2565b60006102c86008610a30565b6001600160a01b031663ba77b06c6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610305573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261032d919081019061189b565b90508060005b82518110156103c95782818151811061034e5761034e61194d565b60200260200101516002600084848151811061036c5761036c61194d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550806103c290611963565b9050610333565b5050506033805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b600061041d83610e48565b905061042881610e83565b610433600a83610f4c565b61043d8183610f7f565b60006104496008610a30565b604051633b36143360e21b81526001600160a01b03868116600483015285811660248301529192509082169063ecd850cc90604401600060405180830381600087803b15801561049857600080fd5b505af11580156104ac573d6000803e3d6000fd5b50600a92506104b9915050565b6040516001600160a01b038616907fcd0cc620b4e50fadef5cf27b85b178b85e7092c14fe563e1a31fe4afc9b7a72890600090a350505050565b60006104fe83610e48565b905061050981610e83565b610514600983610f4c565b60018101546001600160a01b031661052c8284610fbf565b60006105386008610a30565b604051636c9fd18360e11b81526001600160a01b03878116600483015286811660248301529192509082169063d93fa30690604401600060405180830381600087803b15801561058757600080fd5b505af115801561059b573d6000803e3d6000fd5b5050505060006105ab600a610a30565b60405163a0c302a760e01b81526001600160a01b03858116600483015287811660248301529192509082169063a0c302a790604401600060405180830381600087803b1580156105fa57600080fd5b505af115801561060e573d6000803e3d6000fd5b506009925061061b915050565b6040516001600160a01b038816907fcd0cc620b4e50fadef5cf27b85b178b85e7092c14fe563e1a31fe4afc9b7a72890600090a3505050505050565b600061066283610e48565b905061066d81610e83565b6106768261102c565b6106808183611055565b826001600160a01b03167fe13225a225fbfeebd9d707546f3d7adee5d72738ac686cc5b97266c49745a56b836040516106b991906119a0565b60405180910390a2505050565b60006106d183610e48565b90506106dc81610e83565b6106e7600183610f4c565b6106f1818361109b565b60006106fd6009610a30565b60405163ea80d67d60e01b81526001600160a01b03868116600483015285811660248301529192509082169063ea80d67d90604401600060405180830381600087803b15801561074c57600080fd5b505af1158015610760573d6000803e3d6000fd5b5050505060006107706008610a30565b60405163ea80d67d60e01b81526001600160a01b03878116600483015286811660248301529192509082169063ea80d67d90604401600060405180830381600087803b1580156107bf57600080fd5b505af11580156107d3573d6000803e3d6000fd5b50600192506107e0915050565b6040516001600160a01b038716907fcd0cc620b4e50fadef5cf27b85b178b85e7092c14fe563e1a31fe4afc9b7a72890600090a35050505050565b6108236110db565b61082c81611135565b6108368282610da2565b5050565b6108426110db565b80516001600160a01b0390811660009081526020819052604090208054909116156108805760405163249b38f960e01b815260040160405180910390fd5b610836818361116b565b60608167ffffffffffffffff8111156108a5576108a56113df565b6040519080825280602002602001820160405280156108ce578160200160208202803683370190505b50905060005b8281101561095c576000808585848181106108f1576108f161194d565b905060200201602081019061090691906113bb565b6001600160a01b039081168252602082019290925260400160002060010154835191169083908390811061093c5761093c61194d565b6001600160a01b03909216602092830291909101909101526001016108d4565b5092915050565b603354610100900460ff16158080156109835750603354600160ff909116105b8061099d5750303b15801561099d575060335460ff166001145b6109b95760405162461bcd60e51b81526004016102899061184d565b6033805460ff1916600117905580156109dc576033805461ff0019166101001790555b6109e7600883610da2565b8015610836576033805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115610a6757610a6761198a565b60ff1681526020810191909152604001600020546001600160a01b0316905080610aa6578160405163409140df60e11b815260040161028991906119c7565b919050565b6009610ab68161120a565b6001600160a01b038086166000908152602081905260409020805490911615610af25760405163249b38f960e01b815260040160405180910390fd5b60006040518060c00160405280886001600160a01b03168152602001886001600160a01b03168152602001896001600160a01b03168152602001876001600160a01b0316815260200160006001600160a01b0316815260200186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152509050610b8e81611256565b610b98828261116b565b5050505050505050565b6040805160c0810182526000808252602082018190529181018290526060808201839052608082019290925260a08101919091526001600160a01b0380831660009081526020818152604091829020825160c081018452815485168152600182015485169281019290925260028101548416928201929092526003820154831660608201526004820154909216608083015260058101805460a084019190610c49906119db565b80601f0160208091040260200160405190810160405280929190818152602001828054610c75906119db565b8015610cc25780601f10610c9757610100808354040283529160200191610cc2565b820191906000526020600020905b815481529060010190602001808311610ca557829003601f168201915b5050505050815250509050919050565b60608167ffffffffffffffff811115610ced57610ced6113df565b604051908082528060200260200182016040528015610d16578160200160208202803683370190505b50905060005b8281101561095c5760026000858584818110610d3a57610d3a61194d565b9050602002016020810190610d4f91906113bb565b6001600160a01b0390811682526020820192909252604001600020548351911690839083908110610d8257610d8261194d565b6001600160a01b0390921660209283029190910190910152600101610d1c565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115610dd857610dd861198a565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115610e1957610e1961198a565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b565b6001600160a01b0380821660009081526020819052604090208054909116610aa6576040516334152acb60e11b815260040160405180910390fd5b60028101546001600160a01b031633141580610f1b5750610ea46008610a30565b60018201546040516304d971ab60e01b81526001600160a01b0391821660048201523360248201529116906304d971ab90604401602060405180830381865afa158015610ef5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f199190611a15565b155b15610f49576000356001600160e01b0319166001604051620f948f60ea1b8152600401610289929190611a47565b50565b6001600160a01b038116610f7557816040516315fb58b960e21b81526004016102899190611a65565b610836828261129f565b600390910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b600180830180546001600160a01b03908116600090815260026020908152604080832080546001600160a01b0319908116909155975496841680845281842080548a169890951697909717909355835490961690941790915592819052919020805460ff19169091179055565b611035816112e6565b15610f495780604051630f32bad960e31b815260040161028991906119a0565b600582016110638282611ac2565b50600180600061107884805160209091012090565b81526020810191909152604001600020805460ff19169115159190911790555050565b600290910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610e46576000356001600160e01b0319166001604051620f948f60ea1b8152600401610289929190611a47565b806001600160a01b03163b600003610f4957604051630bfc64a360e21b81526001600160a01b0382166004820152602401610289565b805182546001600160a01b0319166001600160a01b039091161782556020810151611197908390610fbf565b6111a582826040015161109b565b6111b3828260600151610f7f565b6111c1828260800151611315565b6111cf828260a00151611055565b80516040516001600160a01b03909116907fc9da0ae38bd4761b72da1045c9b2618f0cd991dcac01e1f9bbf68474025f074390600090a25050565b61121381610a30565b6001600160a01b0316336001600160a01b031614610f49576000356001600160e01b03191681336040516320e0f98d60e21b815260040161028993929190611b82565b61126560098260200151610f4c565b61127460048260400151610f4c565b611283600a8260600151610f4c565b611292600a826080015161129f565b610f498160a0015161102c565b6001600160a01b03811660009081526001602052604090205460ff16156108365781816001600160a01b031660405163720b355560e11b8152600401610289929190611bb9565b6000600160006112fb84805160209091012090565b815260208101919091526040016000205460ff1692915050565b6004820180546001600160a01b0319166001600160a01b03831690811790915515610836576001600160a01b03166000908152600160208190526040909120805460ff1916909117905550565b6001600160a01b0381168114610f4957600080fd5b8035610aa681611362565b6000806040838503121561139557600080fd5b82356113a081611362565b915060208301356113b081611362565b809150509250929050565b6000602082840312156113cd57600080fd5b81356113d881611362565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715611418576114186113df565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611447576114476113df565b604052919050565b600082601f83011261146057600080fd5b813567ffffffffffffffff81111561147a5761147a6113df565b61148d601f8201601f191660200161141e565b8181528460208386010111156114a257600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156114d257600080fd5b82356114dd81611362565b9150602083013567ffffffffffffffff8111156114f957600080fd5b6115058582860161144f565b9150509250929050565b803560108110610aa657600080fd5b6000806040838503121561153157600080fd5b6113a08361150f565b60006020828403121561154c57600080fd5b813567ffffffffffffffff8082111561156457600080fd5b9083019060c0828603121561157857600080fd5b6115806113f5565b823561158b81611362565b8152602083013561159b81611362565b602082015260408301356115ae81611362565b60408201526115bf60608401611377565b60608201526115d060808401611377565b608082015260a0830135828111156115e757600080fd5b6115f38782860161144f565b60a08301525095945050505050565b60008083601f84011261161457600080fd5b50813567ffffffffffffffff81111561162c57600080fd5b6020830191508360208260051b850101111561164757600080fd5b9250929050565b6000806020838503121561166157600080fd5b823567ffffffffffffffff81111561167857600080fd5b61168485828601611602565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156116d15783516001600160a01b0316835292840192918401916001016116ac565b50909695505050505050565b6000602082840312156116ef57600080fd5b6113d88261150f565b60008060008060006080868803121561171057600080fd5b853561171b81611362565b9450602086013561172b81611362565b9350604086013561173b81611362565b9250606086013567ffffffffffffffff8082111561175857600080fd5b818801915088601f83011261176c57600080fd5b81358181111561177b57600080fd5b89602082850101111561178d57600080fd5b9699959850939650602001949392505050565b6000815180845260005b818110156117c6576020818501810151868301820152016117aa565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600060018060a01b038084511660208401528060208501511660408401528060408501511660608401528060608501511660808401528060808501511660a08401525060a083015160c08084015261184560e08401826117a0565b949350505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060208083850312156118ae57600080fd5b825167ffffffffffffffff808211156118c657600080fd5b818501915085601f8301126118da57600080fd5b8151818111156118ec576118ec6113df565b8060051b91506118fd84830161141e565b818152918301840191848101908884111561191757600080fd5b938501935b83851015611941578451925061193183611362565b828252938501939085019061191c565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161198357634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052602160045260246000fd5b6020815260006113d860208301846117a0565b601081106119c3576119c361198a565b9052565b602081016119d582846119b3565b92915050565b600181811c908216806119ef57607f821691505b602082108103611a0f57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a2757600080fd5b815180151581146113d857600080fd5b600b81106119c3576119c361198a565b6001600160e01b031983168152604081016113d86020830184611a37565b602081016119d58284611a37565b601f821115611abd57600081815260208120601f850160051c81016020861015611a9a5750805b601f850160051c820191505b81811015611ab957828155600101611aa6565b5050505b505050565b815167ffffffffffffffff811115611adc57611adc6113df565b611af081611aea84546119db565b84611a73565b602080601f831160018114611b255760008415611b0d5750858301515b600019600386901b1c1916600185901b178555611ab9565b600085815260208120601f198616915b82811015611b5457888601518255948401946001909101908401611b35565b5085821015611b725787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160e01b03198416815260608101611ba060208301856119b3565b6001600160a01b03929092166040919091015292915050565b60408101611bc78285611a37565b826020830152939250505056fea2646970667358221220c90a4d4b576f78c895cc54c97daea46daeb57c36d6a640e3f47655efcaa510b464736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806392d487561161008c578063de981f1b11610066578063de981f1b146101f2578063eed1e42014610205578063f466094014610218578063f9226b1a1461023857600080fd5b806392d48756146101ac578063b261596f146101bf578063c4d66de8146101df57600080fd5b806350a9fc29116100c857806350a9fc291461012a57806368a5c1231461017357806384cb101014610186578063865e6fd31461019957600080fd5b80630840ba72146100ef578063183584c1146101045780631f97bdb114610117575b600080fd5b6101026100fd366004611382565b61024b565b005b610102610112366004611382565b610412565b610102610125366004611382565b6104f3565b6101566101383660046113bb565b6001600160a01b039081166000908152600260205260409020541690565b6040516001600160a01b0390911681526020015b60405180910390f35b6101026101813660046114bf565b610657565b610102610194366004611382565b6106c6565b6101026101a736600461151e565b61081b565b6101026101ba36600461153a565b61083a565b6101d26101cd36600461164e565b61088a565b60405161016a9190611690565b6101026101ed3660046113bb565b610963565b6101566102003660046116dd565b610a30565b6101026102133660046116f8565b610aab565b61022b6102263660046113bb565b610ba2565b60405161016a91906117e6565b6101d261024636600461164e565b610cd2565b603354600290610100900460ff1615801561026d575060335460ff8083169116105b6102925760405162461bcd60e51b81526004016102899061184d565b60405180910390fd5b6033805461ffff191660ff8316176101001790556102b1600984610da2565b6102bc600a83610da2565b60006102c86008610a30565b6001600160a01b031663ba77b06c6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610305573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261032d919081019061189b565b90508060005b82518110156103c95782818151811061034e5761034e61194d565b60200260200101516002600084848151811061036c5761036c61194d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550806103c290611963565b9050610333565b5050506033805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b600061041d83610e48565b905061042881610e83565b610433600a83610f4c565b61043d8183610f7f565b60006104496008610a30565b604051633b36143360e21b81526001600160a01b03868116600483015285811660248301529192509082169063ecd850cc90604401600060405180830381600087803b15801561049857600080fd5b505af11580156104ac573d6000803e3d6000fd5b50600a92506104b9915050565b6040516001600160a01b038616907fcd0cc620b4e50fadef5cf27b85b178b85e7092c14fe563e1a31fe4afc9b7a72890600090a350505050565b60006104fe83610e48565b905061050981610e83565b610514600983610f4c565b60018101546001600160a01b031661052c8284610fbf565b60006105386008610a30565b604051636c9fd18360e11b81526001600160a01b03878116600483015286811660248301529192509082169063d93fa30690604401600060405180830381600087803b15801561058757600080fd5b505af115801561059b573d6000803e3d6000fd5b5050505060006105ab600a610a30565b60405163a0c302a760e01b81526001600160a01b03858116600483015287811660248301529192509082169063a0c302a790604401600060405180830381600087803b1580156105fa57600080fd5b505af115801561060e573d6000803e3d6000fd5b506009925061061b915050565b6040516001600160a01b038816907fcd0cc620b4e50fadef5cf27b85b178b85e7092c14fe563e1a31fe4afc9b7a72890600090a3505050505050565b600061066283610e48565b905061066d81610e83565b6106768261102c565b6106808183611055565b826001600160a01b03167fe13225a225fbfeebd9d707546f3d7adee5d72738ac686cc5b97266c49745a56b836040516106b991906119a0565b60405180910390a2505050565b60006106d183610e48565b90506106dc81610e83565b6106e7600183610f4c565b6106f1818361109b565b60006106fd6009610a30565b60405163ea80d67d60e01b81526001600160a01b03868116600483015285811660248301529192509082169063ea80d67d90604401600060405180830381600087803b15801561074c57600080fd5b505af1158015610760573d6000803e3d6000fd5b5050505060006107706008610a30565b60405163ea80d67d60e01b81526001600160a01b03878116600483015286811660248301529192509082169063ea80d67d90604401600060405180830381600087803b1580156107bf57600080fd5b505af11580156107d3573d6000803e3d6000fd5b50600192506107e0915050565b6040516001600160a01b038716907fcd0cc620b4e50fadef5cf27b85b178b85e7092c14fe563e1a31fe4afc9b7a72890600090a35050505050565b6108236110db565b61082c81611135565b6108368282610da2565b5050565b6108426110db565b80516001600160a01b0390811660009081526020819052604090208054909116156108805760405163249b38f960e01b815260040160405180910390fd5b610836818361116b565b60608167ffffffffffffffff8111156108a5576108a56113df565b6040519080825280602002602001820160405280156108ce578160200160208202803683370190505b50905060005b8281101561095c576000808585848181106108f1576108f161194d565b905060200201602081019061090691906113bb565b6001600160a01b039081168252602082019290925260400160002060010154835191169083908390811061093c5761093c61194d565b6001600160a01b03909216602092830291909101909101526001016108d4565b5092915050565b603354610100900460ff16158080156109835750603354600160ff909116105b8061099d5750303b15801561099d575060335460ff166001145b6109b95760405162461bcd60e51b81526004016102899061184d565b6033805460ff1916600117905580156109dc576033805461ff0019166101001790555b6109e7600883610da2565b8015610836576033805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115610a6757610a6761198a565b60ff1681526020810191909152604001600020546001600160a01b0316905080610aa6578160405163409140df60e11b815260040161028991906119c7565b919050565b6009610ab68161120a565b6001600160a01b038086166000908152602081905260409020805490911615610af25760405163249b38f960e01b815260040160405180910390fd5b60006040518060c00160405280886001600160a01b03168152602001886001600160a01b03168152602001896001600160a01b03168152602001876001600160a01b0316815260200160006001600160a01b0316815260200186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152509050610b8e81611256565b610b98828261116b565b5050505050505050565b6040805160c0810182526000808252602082018190529181018290526060808201839052608082019290925260a08101919091526001600160a01b0380831660009081526020818152604091829020825160c081018452815485168152600182015485169281019290925260028101548416928201929092526003820154831660608201526004820154909216608083015260058101805460a084019190610c49906119db565b80601f0160208091040260200160405190810160405280929190818152602001828054610c75906119db565b8015610cc25780601f10610c9757610100808354040283529160200191610cc2565b820191906000526020600020905b815481529060010190602001808311610ca557829003601f168201915b5050505050815250509050919050565b60608167ffffffffffffffff811115610ced57610ced6113df565b604051908082528060200260200182016040528015610d16578160200160208202803683370190505b50905060005b8281101561095c5760026000858584818110610d3a57610d3a61194d565b9050602002016020810190610d4f91906113bb565b6001600160a01b0390811682526020820192909252604001600020548351911690839083908110610d8257610d8261194d565b6001600160a01b0390921660209283029190910190910152600101610d1c565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115610dd857610dd861198a565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115610e1957610e1961198a565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b565b6001600160a01b0380821660009081526020819052604090208054909116610aa6576040516334152acb60e11b815260040160405180910390fd5b60028101546001600160a01b031633141580610f1b5750610ea46008610a30565b60018201546040516304d971ab60e01b81526001600160a01b0391821660048201523360248201529116906304d971ab90604401602060405180830381865afa158015610ef5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f199190611a15565b155b15610f49576000356001600160e01b0319166001604051620f948f60ea1b8152600401610289929190611a47565b50565b6001600160a01b038116610f7557816040516315fb58b960e21b81526004016102899190611a65565b610836828261129f565b600390910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b600180830180546001600160a01b03908116600090815260026020908152604080832080546001600160a01b0319908116909155975496841680845281842080548a169890951697909717909355835490961690941790915592819052919020805460ff19169091179055565b611035816112e6565b15610f495780604051630f32bad960e31b815260040161028991906119a0565b600582016110638282611ac2565b50600180600061107884805160209091012090565b81526020810191909152604001600020805460ff19169115159190911790555050565b600290910180546001600160a01b039092166001600160a01b0319909216821790556000908152600160208190526040909120805460ff19169091179055565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610e46576000356001600160e01b0319166001604051620f948f60ea1b8152600401610289929190611a47565b806001600160a01b03163b600003610f4957604051630bfc64a360e21b81526001600160a01b0382166004820152602401610289565b805182546001600160a01b0319166001600160a01b039091161782556020810151611197908390610fbf565b6111a582826040015161109b565b6111b3828260600151610f7f565b6111c1828260800151611315565b6111cf828260a00151611055565b80516040516001600160a01b03909116907fc9da0ae38bd4761b72da1045c9b2618f0cd991dcac01e1f9bbf68474025f074390600090a25050565b61121381610a30565b6001600160a01b0316336001600160a01b031614610f49576000356001600160e01b03191681336040516320e0f98d60e21b815260040161028993929190611b82565b61126560098260200151610f4c565b61127460048260400151610f4c565b611283600a8260600151610f4c565b611292600a826080015161129f565b610f498160a0015161102c565b6001600160a01b03811660009081526001602052604090205460ff16156108365781816001600160a01b031660405163720b355560e11b8152600401610289929190611bb9565b6000600160006112fb84805160209091012090565b815260208101919091526040016000205460ff1692915050565b6004820180546001600160a01b0319166001600160a01b03831690811790915515610836576001600160a01b03166000908152600160208190526040909120805460ff1916909117905550565b6001600160a01b0381168114610f4957600080fd5b8035610aa681611362565b6000806040838503121561139557600080fd5b82356113a081611362565b915060208301356113b081611362565b809150509250929050565b6000602082840312156113cd57600080fd5b81356113d881611362565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715611418576114186113df565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611447576114476113df565b604052919050565b600082601f83011261146057600080fd5b813567ffffffffffffffff81111561147a5761147a6113df565b61148d601f8201601f191660200161141e565b8181528460208386010111156114a257600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156114d257600080fd5b82356114dd81611362565b9150602083013567ffffffffffffffff8111156114f957600080fd5b6115058582860161144f565b9150509250929050565b803560108110610aa657600080fd5b6000806040838503121561153157600080fd5b6113a08361150f565b60006020828403121561154c57600080fd5b813567ffffffffffffffff8082111561156457600080fd5b9083019060c0828603121561157857600080fd5b6115806113f5565b823561158b81611362565b8152602083013561159b81611362565b602082015260408301356115ae81611362565b60408201526115bf60608401611377565b60608201526115d060808401611377565b608082015260a0830135828111156115e757600080fd5b6115f38782860161144f565b60a08301525095945050505050565b60008083601f84011261161457600080fd5b50813567ffffffffffffffff81111561162c57600080fd5b6020830191508360208260051b850101111561164757600080fd5b9250929050565b6000806020838503121561166157600080fd5b823567ffffffffffffffff81111561167857600080fd5b61168485828601611602565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156116d15783516001600160a01b0316835292840192918401916001016116ac565b50909695505050505050565b6000602082840312156116ef57600080fd5b6113d88261150f565b60008060008060006080868803121561171057600080fd5b853561171b81611362565b9450602086013561172b81611362565b9350604086013561173b81611362565b9250606086013567ffffffffffffffff8082111561175857600080fd5b818801915088601f83011261176c57600080fd5b81358181111561177b57600080fd5b89602082850101111561178d57600080fd5b9699959850939650602001949392505050565b6000815180845260005b818110156117c6576020818501810151868301820152016117aa565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600060018060a01b038084511660208401528060208501511660408401528060408501511660608401528060608501511660808401528060808501511660a08401525060a083015160c08084015261184560e08401826117a0565b949350505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060208083850312156118ae57600080fd5b825167ffffffffffffffff808211156118c657600080fd5b818501915085601f8301126118da57600080fd5b8151818111156118ec576118ec6113df565b8060051b91506118fd84830161141e565b818152918301840191848101908884111561191757600080fd5b938501935b83851015611941578451925061193183611362565b828252938501939085019061191c565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161198357634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052602160045260246000fd5b6020815260006113d860208301846117a0565b601081106119c3576119c361198a565b9052565b602081016119d582846119b3565b92915050565b600181811c908216806119ef57607f821691505b602082108103611a0f57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611a2757600080fd5b815180151581146113d857600080fd5b600b81106119c3576119c361198a565b6001600160e01b031983168152604081016113d86020830184611a37565b602081016119d58284611a37565b601f821115611abd57600081815260208120601f850160051c81016020861015611a9a5750805b601f850160051c820191505b81811015611ab957828155600101611aa6565b5050505b505050565b815167ffffffffffffffff811115611adc57611adc6113df565b611af081611aea84546119db565b84611a73565b602080601f831160018114611b255760008415611b0d5750858301515b600019600386901b1c1916600185901b178555611ab9565b600085815260208120601f198616915b82811015611b5457888601518255948401946001909101908401611b35565b5085821015611b725787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160e01b03198416815260608101611ba060208301856119b3565b6001600160a01b03929092166040919091015292915050565b60408101611bc78285611a37565b826020830152939250505056fea2646970667358221220c90a4d4b576f78c895cc54c97daea46daeb57c36d6a640e3f47655efcaa510b464736f6c63430008130033", "devdoc": { "errors": { "ErrContractTypeNotFound(uint8)": [ @@ -491,12 +599,39 @@ } } ], + "ErrUnexpectedInternalCall(bytes4,uint8,address)": [ + { + "details": "Error indicating that the caller is unauthorized to perform a specific function.", + "params": { + "actual": "The actual address that called to the function.", + "expectedContractType": "The contract type required to perform the function.", + "msgSig": "The function signature (bytes4)." + } + } + ], "ErrZeroCodeContract(address)": [ { "details": "Error of set to non-contract." } ] }, + "events": { + "ContractUpdated(uint8,address)": { + "details": "Emitted when a contract is updated." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "ProfileAdded(address)": { + "details": "Event emitted when a profile with `id` is added." + }, + "ProfileAddressChanged(address,uint8)": { + "details": "Event emitted when a address in a profile is changed." + }, + "PubkeyChanged(address,bytes)": { + "details": "Event emitted when the pubkey of the `id` is changed." + } + }, "kind": "dev", "methods": { "addNewProfile((address,address,address,address,address,bytes))": { @@ -505,6 +640,12 @@ "changePubkey(address,bytes)": { "details": "Requirements: - The profile must be existed. - Only user with candidate admin role can call this method. - New public key must not be duplicated." }, + "execApplyValidatorCandidate(address,address,address,bytes)": { + "details": "Cross-contract function to add/update new profile of a validator candidate when they applying for candidate role. Requirements: - Only `stakingContract` can call this method." + }, + "getConsensus2Id(address)": { + "details": "Getter to backward query from `consensus` address to `id` address." + }, "getContract(uint8)": { "details": "Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.", "params": { @@ -517,8 +658,20 @@ "getId2Profile(address)": { "details": "Getter to query full `profile` from `id` address." }, - "registerProfile((address,address,address,address,address,bytes))": { - "details": "Requirements: - The profile must not be existent before. - Only user with candidate admin role can call this method." + "getManyConsensus2Id(address[])": { + "details": "Getter to backward batch query from `consensus` address to `id` address." + }, + "getManyId2Consensus(address[])": { + "details": "Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist." + }, + "requestChangeAdminAddress(address,address)": { + "details": "Side-effects on other contracts: - Update Staking contract: + [x] Update (id => PoolDetail) mapping in {BaseStaking.sol}. + [x] Update `_adminOfActivePoolMapping` in {BaseStaking.sol}. - Update Validator contract: + [x] Update (id => ValidatorCandidate) mapping" + }, + "requestChangeConsensusAddr(address,address)": { + "details": "Side-effects on other contracts: - Update in Staking contract for Consensus address mapping: + [x] Keep the same previous pool address. - Update in Validator contract for: + [x] Consensus Address mapping + [x] Bridge Address mapping + [x] Jail mapping + [x] Pending reward mapping + [x] Schedule mapping - Update in Slashing contract for: + [x] Handling slash indicator + [x] Handling slash fast finality + [x] Handling slash double sign - Update in Proposal contract for: + [-] Preserve the consensus address and recipient target of locked amount of emergency exit - Update Trusted Org contracts: + [x] Remove and delete weight of the old consensus + [x] Replace and add weight for the new consensus" + }, + "requestChangeTreasuryAddr(address,address)": { + "details": "Side-effects on other contracts: - Update Validator contract: + [x] Update (id => ValidatorCandidate) mapping - Update governance admin: + [-] Update recipient in the EmergencyExitBallot to the newTreasury. Cannot impl since we cannot cancel the previous the ballot and create a new ballot on behalf of the validator contract." }, "setContract(uint8,address)": { "details": "Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.", @@ -538,9 +691,6 @@ }, "changePubkey(address,bytes)": { "notice": "The candidate admin changes the public key." - }, - "registerProfile((address,address,address,address,address,bytes))": { - "notice": "The candidate admin registers a new profile." } }, "version": 1 @@ -548,15 +698,15 @@ "storageLayout": { "storage": [ { - "astId": 3062, + "astId": 7915, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "_id2Profile", "offset": 0, "slot": "0", - "type": "t_mapping(t_address,t_struct(CandidateProfile)1339_storage)" + "type": "t_mapping(t_address,t_struct(CandidateProfile)1613_storage)" }, { - "astId": 3067, + "astId": 7920, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "_registry", "offset": 0, @@ -564,12 +714,20 @@ "type": "t_mapping(t_uint256,t_bool)" }, { - "astId": 3072, + "astId": 7926, "contract": "contracts/ronin/profile/Profile.sol:Profile", - "label": "__gap", + "label": "_consensus2Id", "offset": 0, "slot": "2", - "type": "t_array(t_bytes32)49_storage" + "type": "t_mapping(t_userDefinedValueType(TConsensus)10745,t_address)" + }, + { + "astId": 7931, + "contract": "contracts/ronin/profile/Profile.sol:Profile", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_bytes32)48_storage" }, { "astId": 581, @@ -599,11 +757,11 @@ "label": "address payable", "numberOfBytes": "20" }, - "t_array(t_bytes32)49_storage": { + "t_array(t_bytes32)48_storage": { "base": "t_bytes32", "encoding": "inplace", - "label": "bytes32[49]", - "numberOfBytes": "1568" + "label": "bytes32[48]", + "numberOfBytes": "1536" }, "t_bool": { "encoding": "inplace", @@ -620,12 +778,12 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_mapping(t_address,t_struct(CandidateProfile)1339_storage)": { + "t_mapping(t_address,t_struct(CandidateProfile)1613_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IProfile.CandidateProfile)", "numberOfBytes": "32", - "value": "t_struct(CandidateProfile)1339_storage" + "value": "t_struct(CandidateProfile)1613_storage" }, "t_mapping(t_uint256,t_bool)": { "encoding": "mapping", @@ -634,12 +792,19 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_struct(CandidateProfile)1339_storage": { + "t_mapping(t_userDefinedValueType(TConsensus)10745,t_address)": { + "encoding": "mapping", + "key": "t_userDefinedValueType(TConsensus)10745", + "label": "mapping(TConsensus => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_struct(CandidateProfile)1613_storage": { "encoding": "inplace", "label": "struct IProfile.CandidateProfile", "members": [ { - "astId": 1323, + "astId": 1596, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "id", "offset": 0, @@ -647,15 +812,15 @@ "type": "t_address" }, { - "astId": 1326, + "astId": 1600, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "consensus", "offset": 0, "slot": "1", - "type": "t_address" + "type": "t_userDefinedValueType(TConsensus)10745" }, { - "astId": 1329, + "astId": 1603, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "admin", "offset": 0, @@ -663,7 +828,7 @@ "type": "t_address" }, { - "astId": 1332, + "astId": 1606, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "treasury", "offset": 0, @@ -671,15 +836,15 @@ "type": "t_address_payable" }, { - "astId": 1335, + "astId": 1609, "contract": "contracts/ronin/profile/Profile.sol:Profile", - "label": "governor", + "label": "__reservedGovernor", "offset": 0, "slot": "4", "type": "t_address" }, { - "astId": 1338, + "astId": 1612, "contract": "contracts/ronin/profile/Profile.sol:Profile", "label": "pubkey", "offset": 0, @@ -698,6 +863,11 @@ "encoding": "inplace", "label": "uint8", "numberOfBytes": "1" + }, + "t_userDefinedValueType(TConsensus)10745": { + "encoding": "inplace", + "label": "TConsensus", + "numberOfBytes": "20" } } } diff --git a/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json b/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json index 957bdae35..b89107986 100644 --- a/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json +++ b/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json @@ -1,37 +1,37 @@ { - "address": "0xa7E978bD77b1B64D100eC0a62898395cb4B47a56", + "address": "0x8632bAB71eB2d23F3f8FE49914E2dC33170c7B78", "abi": [ { "inputs": [ { - "internalType": "address", - "name": "voter", + "internalType": "TConsensus", + "name": "addr", "type": "address" } ], - "name": "ErrBridgeVoterIsAlreadyAdded", + "name": "ErrConsensusAddressIsAlreadyAdded", "type": "error" }, { "inputs": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "addr", "type": "address" } ], - "name": "ErrConsensusAddressIsAlreadyAdded", + "name": "ErrConsensusAddressIsNotAdded", "type": "error" }, { "inputs": [ { - "internalType": "address", - "name": "addr", - "type": "address" + "internalType": "enum ContractType", + "name": "contractType", + "type": "uint8" } ], - "name": "ErrConsensusAddressIsNotAdded", + "name": "ErrContractTypeNotFound", "type": "error" }, { @@ -114,6 +114,103 @@ "name": "ErrUnauthorized", "type": "error" }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "msgSig", + "type": "bytes4" + }, + { + "internalType": "enum ContractType", + "name": "expectedContractType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "actual", + "type": "address" + } + ], + "name": "ErrUnexpectedInternalCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "ErrZeroCodeContract", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "TConsensus", + "name": "consensusAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "governor", + "type": "address" + }, + { + "internalType": "address", + "name": "__deprecatedBridgeVoter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "weight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "addedBlock", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IRoninTrustedOrganization.TrustedOrganization", + "name": "orgAfterChanged", + "type": "tuple" + }, + { + "indexed": false, + "internalType": "TConsensus", + "name": "oldConsensus", + "type": "address" + } + ], + "name": "ConsensusAddressOfTrustedOrgChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum ContractType", + "name": "contractType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "ContractUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -170,7 +267,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -181,7 +278,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -209,7 +306,7 @@ "inputs": [ { "indexed": false, - "internalType": "address[]", + "internalType": "TConsensus[]", "name": "orgs", "type": "address[]" } @@ -223,7 +320,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -234,7 +331,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -262,7 +359,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -273,7 +370,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -318,7 +415,7 @@ }, { "inputs": [], - "name": "countTrustedOrganizations", + "name": "countTrustedOrganization", "outputs": [ { "internalType": "uint256", @@ -329,6 +426,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "oldAddr", + "type": "address" + }, + { + "internalType": "TConsensus", + "name": "newAddr", + "type": "address" + } + ], + "name": "execChangeConsensusAddressForTrustedOrg", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "getAllTrustedOrganizations", @@ -336,7 +451,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -347,7 +462,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -362,7 +477,7 @@ } ], "internalType": "struct IRoninTrustedOrganization.TrustedOrganization[]", - "name": "_list", + "name": "list", "type": "tuple[]" } ], @@ -372,12 +487,12 @@ { "inputs": [ { - "internalType": "address", - "name": "_addr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], - "name": "getBridgeVoterWeight", + "name": "getConsensusWeight", "outputs": [ { "internalType": "uint256", @@ -391,17 +506,17 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_list", - "type": "address[]" + "internalType": "address", + "name": "cid", + "type": "address" } ], - "name": "getBridgeVoterWeights", + "name": "getConsensusWeightById", "outputs": [ { - "internalType": "uint256[]", - "name": "_res", - "type": "uint256[]" + "internalType": "uint256", + "name": "", + "type": "uint256" } ], "stateMutability": "view", @@ -410,17 +525,17 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", - "type": "address" + "internalType": "TConsensus[]", + "name": "list", + "type": "address[]" } ], - "name": "getConsensusWeight", + "name": "getConsensusWeights", "outputs": [ { - "internalType": "uint256", + "internalType": "uint256[]", "name": "", - "type": "uint256" + "type": "uint256[]" } ], "stateMutability": "view", @@ -430,21 +545,40 @@ "inputs": [ { "internalType": "address[]", - "name": "_list", + "name": "cids", "type": "address[]" } ], - "name": "getConsensusWeights", + "name": "getConsensusWeightsById", "outputs": [ { "internalType": "uint256[]", - "name": "_res", + "name": "", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "enum ContractType", + "name": "contractType", + "type": "uint8" + } + ], + "name": "getContract", + "outputs": [ + { + "internalType": "address", + "name": "contract_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -504,7 +638,7 @@ { "inputs": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "_consensusAddr", "type": "address" } @@ -514,7 +648,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -525,7 +659,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -560,7 +694,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -571,7 +705,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -598,7 +732,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -609,7 +743,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -624,17 +758,17 @@ } ], "internalType": "struct IRoninTrustedOrganization.TrustedOrganization[]", - "name": "_trustedOrgs", + "name": "trustedOrgs", "type": "tuple[]" }, { "internalType": "uint256", - "name": "__num", + "name": "num", "type": "uint256" }, { "internalType": "uint256", - "name": "__denom", + "name": "denom", "type": "uint256" } ], @@ -643,6 +777,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "profileContract", + "type": "address" + } + ], + "name": "initializeV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "minimumVoteWeight", @@ -659,8 +806,8 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_list", + "internalType": "TConsensus[]", + "name": "list", "type": "address[]" } ], @@ -669,6 +816,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "enum ContractType", + "name": "contractType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -701,12 +866,12 @@ { "inputs": [ { - "internalType": "address[]", + "internalType": "TConsensus[]", "name": "_list", "type": "address[]" } ], - "name": "sumBridgeVoterWeights", + "name": "sumConsensusWeight", "outputs": [ { "internalType": "uint256", @@ -725,26 +890,7 @@ "type": "address[]" } ], - "name": "sumConsensusWeights", - "outputs": [ - { - "internalType": "uint256", - "name": "_res", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "name": "sumGovernorWeights", + "name": "sumGovernorWeight", "outputs": [ { "internalType": "uint256", @@ -757,7 +903,7 @@ }, { "inputs": [], - "name": "totalWeights", + "name": "totalWeight", "outputs": [ { "internalType": "uint256", @@ -773,7 +919,7 @@ { "components": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -784,7 +930,7 @@ }, { "internalType": "address", - "name": "bridgeVoter", + "name": "__deprecatedBridgeVoter", "type": "address" }, { @@ -809,38 +955,30 @@ "type": "function" } ], - "transactionHash": "0x4fe58ac15ac894d1830b577da8002ab437aba751fd649e0466cc49294916dd24", + "transactionHash": "0x65cd3feeb7c9e283108736051d95b78a4ed80c44cce1048e1587ea2f1f54a190", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0xa7E978bD77b1B64D100eC0a62898395cb4B47a56", + "contractAddress": "0x8632bAB71eB2d23F3f8FE49914E2dC33170c7B78", "transactionIndex": 0, - "gasUsed": "1741402", + "gasUsed": "2067725", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x767997c534643e1402838ee4808de00a325423605694e47d6a54c2500f373098", - "transactionHash": "0x4fe58ac15ac894d1830b577da8002ab437aba751fd649e0466cc49294916dd24", + "blockHash": "0xac88da2118af4a9e5cc7235c5d4308dc66e66e78dcc07247ab596dc6f5ae43fc", + "transactionHash": "0x65cd3feeb7c9e283108736051d95b78a4ed80c44cce1048e1587ea2f1f54a190", "logs": [], - "blockNumber": 19351156, - "cumulativeGasUsed": "1741402", + "blockNumber": 21941081, + "cumulativeGasUsed": "2067725", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 6, - "solcInputHash": "95921af9e3b453fd5a2d5edf43163a69", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"}],\"name\":\"ErrBridgeVoterIsAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrConsensusAddressIsAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrConsensusAddressIsNotAdded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrDuplicated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrEmptyArray\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrGovernorAddressIsAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidRequest\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidThreshold\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidVoteWeight\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrQueryForDupplicated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrQueryForNonExistentConsensusAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"ThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"orgs\",\"type\":\"address[]\"}],\"name\":\"TrustedOrganizationsRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsUpdated\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"addTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_voteWeight\",\"type\":\"uint256\"}],\"name\":\"checkThreshold\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"countTrustedOrganizations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllTrustedOrganizations\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getBridgeVoterWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getBridgeVoterWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getConsensusWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"getGovernorWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"num_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getTrustedOrganization\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_idx\",\"type\":\"uint256\"}],\"name\":\"getTrustedOrganizationAt\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_trustedOrgs\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"__num\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__denom\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"removeTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"}],\"name\":\"setThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumBridgeVoterWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"updateTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrBridgeVoterIsAlreadyAdded(address)\":[{\"details\":\"Error indicating that a bridge voter has already been added.\",\"params\":{\"voter\":\"The address of the bridge voter that is already added.\"}}],\"ErrConsensusAddressIsAlreadyAdded(address)\":[{\"details\":\"Error indicating that a consensus address is already added.\",\"params\":{\"addr\":\"The address of the consensus contract that is already added.\"}}],\"ErrConsensusAddressIsNotAdded(address)\":[{\"details\":\"Error indicating that a consensus address is not added.\",\"params\":{\"addr\":\"The address of the consensus contract that is not added.\"}}],\"ErrDuplicated(bytes4)\":[{\"details\":\"Error thrown when a duplicated element is detected in an array.\",\"params\":{\"msgSig\":\"The function signature that invoke the error.\"}}],\"ErrEmptyArray()\":[{\"details\":\"Error indicating that an array is empty when it should contain elements.\"}],\"ErrGovernorAddressIsAlreadyAdded(address)\":[{\"details\":\"Error indicating that a governor address has already been added.\",\"params\":{\"addr\":\"The address of the governor that is already added.\"}}],\"ErrInvalidRequest()\":[{\"details\":\"Error indicating that a request is invalid.\"}],\"ErrInvalidThreshold(bytes4)\":[{\"details\":\"Error indicating that the provided threshold is invalid for a specific function signature.\",\"params\":{\"msgSig\":\"The function signature (bytes4) that the invalid threshold applies to.\"}}],\"ErrInvalidVoteWeight(bytes4)\":[{\"details\":\"Error indicating that a vote weight is invalid for a specific function signature.\",\"params\":{\"msgSig\":\"The function signature (bytes4) that encountered an invalid vote weight.\"}}],\"ErrQueryForDupplicated()\":[{\"details\":\"Error indicating that a query for a duplicate entry was made.\"}],\"ErrQueryForNonExistentConsensusAddress()\":[{\"details\":\"Error indicating that a query was made for a non-existent consensus address.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}]},\"kind\":\"dev\",\"methods\":{\"addTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Adds a list of addresses into the trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. - The field `addedBlock` should be blank. Emits the event `TrustedOrganizationAdded` once an organization is added.\"},\"checkThreshold(uint256)\":{\"details\":\"Checks whether the `_voteWeight` passes the threshold.\"},\"countTrustedOrganizations()\":{\"details\":\"Returns the number of trusted organizations.\"},\"getAllTrustedOrganizations()\":{\"details\":\"Returns all of the trusted organizations.\"},\"getBridgeVoterWeight(address)\":{\"details\":\"Returns the weight of a bridge voter.\"},\"getBridgeVoterWeights(address[])\":{\"details\":\"Returns the weights of a list of bridge voter addresses.\"},\"getConsensusWeight(address)\":{\"details\":\"Returns the weight of a consensus.\"},\"getConsensusWeights(address[])\":{\"details\":\"Returns the weights of a list of consensus addresses.\"},\"getGovernorWeight(address)\":{\"details\":\"Returns the weight of a governor.\"},\"getGovernorWeights(address[])\":{\"details\":\"Returns the weights of a list of governor addresses.\"},\"getThreshold()\":{\"details\":\"Returns the threshold.\"},\"getTrustedOrganization(address)\":{\"details\":\"Returns the trusted organization by consensus address. Reverts once the consensus address is non-existent.\"},\"getTrustedOrganizationAt(uint256)\":{\"details\":\"Returns the trusted organization at `_index`.\"},\"initialize((address,address,address,uint256,uint256)[],uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"minimumVoteWeight()\":{\"details\":\"Returns the minimum vote weight to pass the threshold.\"},\"removeTrustedOrganizations(address[])\":{\"details\":\"Removes a list of addresses from the trusted organization. Requirements: - The method caller is admin. Emits the event `TrustedOrganizationRemoved` once an organization is removed.\",\"params\":{\"_consensusAddrs\":\"The list of consensus addresses linked to corresponding trusted organization that to be removed.\"}},\"setThreshold(uint256,uint256)\":{\"details\":\"Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event.\"},\"sumBridgeVoterWeights(address[])\":{\"details\":\"Returns total weights of the bridge voter list.\"},\"sumConsensusWeights(address[])\":{\"details\":\"Returns total weights of the consensus list.\"},\"sumGovernorWeights(address[])\":{\"details\":\"Returns total weights of the governor list.\"},\"totalWeights()\":{\"details\":\"Returns total weights.\"},\"updateTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Updates weights for a list of existent trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. Emits the `TrustedOrganizationUpdated` event.\"}},\"stateVariables\":{\"_addedBlock\":{\"details\":\"Mapping from consensus address => added block\"},\"_bridgeVoterList\":{\"details\":\"Bridge voters array\"},\"_bridgeVoterWeight\":{\"details\":\"Mapping from bridge voter address => weight\"},\"_consensusList\":{\"details\":\"Consensus array\"},\"_consensusWeight\":{\"details\":\"Mapping from consensus address => weight\"},\"_governorList\":{\"details\":\"Governors array\"},\"_governorWeight\":{\"details\":\"Mapping from governor address => weight\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/multi-chains/RoninTrustedOrganization.sol\":\"RoninTrustedOrganization\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x06e5962713a77abf6d5ba646e1cc1cfb6f9c50e7d52520dd82a10bf309534187\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n /**\\n * @dev Error indicating that a query for a duplicate entry was made.\\n */\\n error ErrQueryForDupplicated();\\n\\n /**\\n * @dev Error indicating that a query was made for a non-existent consensus address.\\n */\\n error ErrQueryForNonExistentConsensusAddress();\\n\\n /**\\n * @dev Error indicating that a bridge voter has already been added.\\n * @param voter The address of the bridge voter that is already added.\\n */\\n error ErrBridgeVoterIsAlreadyAdded(address voter);\\n\\n /**\\n * @dev Error indicating that a governor address has already been added.\\n * @param addr The address of the governor that is already added.\\n */\\n error ErrGovernorAddressIsAlreadyAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is not added.\\n * @param addr The address of the consensus contract that is not added.\\n */\\n error ErrConsensusAddressIsNotAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is already added.\\n * @param addr The address of the consensus contract that is already added.\\n */\\n error ErrConsensusAddressIsAlreadyAdded(address addr);\\n\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x28b0407cf740164f3ddf4a44952423604439cda580f286c6ed1edcdb59b219d0\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/multi-chains/RoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../extensions/collections/HasProxyAdmin.sol\\\";\\n\\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\\n uint256 internal _num;\\n uint256 internal _denom;\\n uint256 internal _totalWeight;\\n uint256 internal _nonce;\\n\\n /// @dev Mapping from consensus address => weight\\n mapping(address => uint256) internal _consensusWeight;\\n /// @dev Mapping from governor address => weight\\n mapping(address => uint256) internal _governorWeight;\\n /// @dev Mapping from bridge voter address => weight\\n mapping(address => uint256) internal _bridgeVoterWeight;\\n\\n /// @dev Mapping from consensus address => added block\\n mapping(address => uint256) internal _addedBlock;\\n\\n /// @dev Consensus array\\n address[] internal _consensusList;\\n /// @dev Governors array\\n address[] internal _governorList;\\n /// @dev Bridge voters array\\n address[] internal _bridgeVoterList;\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n TrustedOrganization[] calldata _trustedOrgs,\\n uint256 __num,\\n uint256 __denom\\n ) external initializer {\\n if (_trustedOrgs.length > 0) {\\n _addTrustedOrganizations(_trustedOrgs);\\n }\\n _setThreshold(__num, __denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\\n return (_num, _denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\\n return _voteWeight * _denom >= _num * _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function minimumVoteWeight() external view virtual returns (uint256) {\\n return (_num * _totalWeight + _denom - 1) / _denom;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external override onlyAdmin returns (uint256, uint256) {\\n return _setThreshold(_numerator, _denominator);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n _addTrustedOrganizations(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n if (_list.length == 0) revert ErrEmptyArray();\\n for (uint256 _i; _i < _list.length; ) {\\n _updateTrustedOrganization(_list[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit TrustedOrganizationsUpdated(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\\n if (_list.length == 0) revert ErrEmptyArray();\\n\\n for (uint _i = 0; _i < _list.length; ) {\\n _removeTrustedOrganization(_list[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit TrustedOrganizationsRemoved(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function totalWeights() external view virtual returns (uint256) {\\n return _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\\n return _consensusWeight[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256) {\\n return _governorWeight[_governor];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\\n return _bridgeVoterWeight[_addr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; ) {\\n _res[_i] = _consensusWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; ) {\\n _res[_i] = _governorWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; ) {\\n _res[_i] = _bridgeVoterWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; ) {\\n _res += _consensusWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; ) {\\n _res += _governorWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; ) {\\n _res += _bridgeVoterWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function countTrustedOrganizations() external view override returns (uint256) {\\n return _consensusList.length;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\\n _list = new TrustedOrganization[](_consensusList.length);\\n address _addr;\\n for (uint256 _i; _i < _list.length; ) {\\n _addr = _consensusList[_i];\\n _list[_i].consensusAddr = _addr;\\n _list[_i].governor = _governorList[_i];\\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\\n _list[_i].weight = _consensusWeight[_addr];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\\n for (uint _i = 0; _i < _consensusList.length; ) {\\n if (_consensusList[_i] == _consensusAddr) {\\n return getTrustedOrganizationAt(_i);\\n }\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n revert ErrQueryForNonExistentConsensusAddress();\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\\n address _addr = _consensusList[_idx];\\n return\\n TrustedOrganization(\\n _addr,\\n _governorList[_idx],\\n _bridgeVoterList[_idx],\\n _consensusWeight[_addr],\\n _addedBlock[_addr]\\n );\\n }\\n\\n /**\\n * @dev Adds a list of trusted organizations.\\n */\\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\\n for (uint256 _i; _i < _list.length; ) {\\n _addTrustedOrganization(_list[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit TrustedOrganizationsAdded(_list);\\n }\\n\\n /**\\n * @dev Adds a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is not added.\\n * - The govenor address is not added.\\n * - The bridge voter address is not added.\\n *\\n */\\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n if (_v.addedBlock != 0) revert ErrInvalidRequest();\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n if (_consensusWeight[_v.consensusAddr] > 0) revert ErrConsensusAddressIsAlreadyAdded(_v.consensusAddr);\\n\\n if (_governorWeight[_v.governor] > 0) revert ErrGovernorAddressIsAlreadyAdded(_v.governor);\\n\\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) revert ErrBridgeVoterIsAlreadyAdded(_v.bridgeVoter);\\n\\n _consensusList.push(_v.consensusAddr);\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n\\n _governorList.push(_v.governor);\\n _governorWeight[_v.governor] = _v.weight;\\n\\n _bridgeVoterList.push(_v.bridgeVoter);\\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\\n\\n _addedBlock[_v.consensusAddr] = block.number;\\n\\n _totalWeight += _v.weight;\\n }\\n\\n /**\\n * @dev Updates a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is already added.\\n *\\n */\\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n uint256 _weight = _consensusWeight[_v.consensusAddr];\\n if (_weight == 0) revert ErrConsensusAddressIsNotAdded(_v.consensusAddr);\\n\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; ) {\\n if (_consensusList[_i] == _v.consensusAddr) {\\n _totalWeight -= _weight;\\n _totalWeight += _v.weight;\\n\\n if (_governorList[_i] != _v.governor) {\\n if (_governorWeight[_v.governor] != 0) revert ErrQueryForDupplicated();\\n\\n delete _governorWeight[_governorList[_i]];\\n _governorList[_i] = _v.governor;\\n }\\n\\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\\n if (_bridgeVoterWeight[_v.bridgeVoter] != 0) revert ErrQueryForDupplicated();\\n\\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\\n _bridgeVoterList[_i] = _v.bridgeVoter;\\n }\\n\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n _governorWeight[_v.governor] = _v.weight;\\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\\n return;\\n }\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Removes a trusted organization.\\n *\\n * Requirements:\\n * - The consensus address is added.\\n *\\n */\\n function _removeTrustedOrganization(address _addr) internal virtual {\\n uint256 _weight = _consensusWeight[_addr];\\n if (_weight == 0) revert ErrConsensusAddressIsNotAdded(_addr);\\n\\n uint256 _index;\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; ) {\\n if (_consensusList[_i] == _addr) {\\n _index = _i;\\n break;\\n }\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n\\n _totalWeight -= _weight;\\n\\n delete _addedBlock[_addr];\\n delete _consensusWeight[_addr];\\n _consensusList[_index] = _consensusList[_count - 1];\\n _consensusList.pop();\\n\\n delete _governorWeight[_governorList[_index]];\\n _governorList[_index] = _governorList[_count - 1];\\n _governorList.pop();\\n\\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\\n _bridgeVoterList.pop();\\n }\\n\\n /**\\n * @dev Sets threshold and returns the old one.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function _setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) internal virtual returns (uint256 _previousNum, uint256 _previousDenom) {\\n if (_numerator > _denominator) revert ErrInvalidThreshold(msg.sig);\\n\\n _previousNum = _num;\\n _previousDenom = _denom;\\n _num = _numerator;\\n _denom = _denominator;\\n unchecked {\\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\\n }\\n }\\n\\n /**\\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\\n *\\n * Requirements:\\n * - The weight must be larger than 0.\\n * - The consensus address, governor address, and bridge voter address are different.\\n */\\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\\n if (_v.weight == 0) revert ErrInvalidVoteWeight(msg.sig);\\n\\n address[] memory _addresses = new address[](3);\\n _addresses[0] = _v.consensusAddr;\\n _addresses[1] = _v.governor;\\n _addresses[2] = _v.bridgeVoter;\\n\\n if (AddressArrayUtils.hasDuplicate(_addresses)) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n}\\n\",\"keccak256\":\"0x7cf1258dab3c0071272f5733b3a9ce6b1dda9d12abd055f3359934c7c1fc34f2\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\",\"keccak256\":\"0x3914292a405307cba9e93085edcaf5f1203ca2d55abf998bf1d2af1e86f5a4c6\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD\\n}\\n\",\"keccak256\":\"0xf72feff9afafcb5cadc1b05c6e0b998ea5d66c7ece57c3e482e560d0a1bb4079\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE\\n}\\n\",\"keccak256\":\"0xa98cec38c640c4e37f475debbcd366226f1188c3f5ea6e29de768bd33e021873\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611e8a806100206000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063b505a07c116100b8578063d9d5dadb1161007c578063d9d5dadb146102d5578063dafae408146102e8578063db6693a21461030b578063e75235b81461032b578063e8c0685e14610336578063f09267c21461034957600080fd5b8063b505a07c14610256578063b9c3620914610269578063cacf8fb514610291578063cc7e6b3b14610299578063d78392f8146102ac57600080fd5b80635f14a1c31161010a5780635f14a1c3146101fa578063708236251461020d5780637c37103c146102205780637de5dedd14610233578063926323d51461023b578063a85c7d6e1461024357600080fd5b80630ed285df14610147578063150740051461015c57806341feed1c1461017a578063520fce62146101b157806356241911146101d1575b600080fd5b61015a6101553660046119d3565b61035c565b005b610164610372565b6040516101719190611a52565b60405180910390f35b6101a3610188366004611abc565b6001600160a01b031660009081526005602052604090205490565b604051908152602001610171565b6101c46101bf366004611ad7565b61055e565b6040516101719190611b4c565b6101a36101df366004611abc565b6001600160a01b031660009081526007602052604090205490565b6101a3610208366004611ad7565b610629565b6101c461021b366004611ad7565b61068e565b61015a61022e366004611b84565b610752565b6101a3610880565b6003546101a3565b61015a610251366004611ad7565b6108bd565b61015a6102643660046119d3565b610967565b61027c610277366004611bd5565b610a06565b60408051928352602083019190915201610171565b6009546101a3565b6101c46102a7366004611ad7565b610a27565b6101a36102ba366004611abc565b6001600160a01b031660009081526006602052604090205490565b6101a36102e3366004611ad7565b610aeb565b6102fb6102f6366004611bf7565b610b50565b6040519015158152602001610171565b61031e610319366004611abc565b610b77565b6040516101719190611c10565b60015460025461027c565b6101a3610344366004611ad7565b610c16565b61031e610357366004611bf7565b610c7b565b610364610d81565b61036e8282610ddd565b5050565b60095460609067ffffffffffffffff81111561039057610390611c24565b6040519080825280602002602001820160405280156103e957816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816103ae5790505b5090506000805b8251811015610559576009818154811061040c5761040c611c3a565b9060005260206000200160009054906101000a90046001600160a01b031691508183828151811061043f5761043f611c3a565b60209081029190910101516001600160a01b039091169052600a80548290811061046b5761046b611c3a565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061049b5761049b611c3a565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600b81815481106104d2576104d2611c3a565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061050257610502611c3a565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061054257610542611c3a565b6020908102919091010151606001526001016103f0565b505090565b60608167ffffffffffffffff81111561057957610579611c24565b6040519080825280602002602001820160405280156105a2578160200160208202803683370190505b50905060005b815181101561062257600560008585848181106105c7576105c7611c3a565b90506020020160208101906105dc9190611abc565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061060f5761060f611c3a565b60209081029190910101526001016105a8565b5092915050565b6000805b82811015610622576006600085858481811061064b5761064b611c3a565b90506020020160208101906106609190611abc565b6001600160a01b031681526020810191909152604001600020546106849083611c66565b915060010161062d565b60608167ffffffffffffffff8111156106a9576106a9611c24565b6040519080825280602002602001820160405280156106d2578160200160208202803683370190505b50905060005b815181101561062257600760008585848181106106f7576106f7611c3a565b905060200201602081019061070c9190611abc565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061073f5761073f611c3a565b60209081029190910101526001016106d8565b600054610100900460ff16158080156107725750600054600160ff909116105b8061078c5750303b15801561078c575060005460ff166001145b6107f45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610817576000805461ff0019166101001790555b8315610827576108278585610ddd565b6108318383610e52565b50508015610879576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6000600254600160025460035460015461089a9190611c79565b6108a49190611c66565b6108ae9190611c90565b6108b89190611ca3565b905090565b6108c5610d81565b60008190036108e7576040516316ee9d3b60e11b815260040160405180910390fd5b60005b818110156109295761092183838381811061090757610907611c3a565b905060200201602081019061091c9190611abc565b610ee8565b6001016108ea565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a7828260405161095b929190611cc5565b60405180910390a15050565b61096f610d81565b6000819003610991576040516316ee9d3b60e11b815260040160405180910390fd5b60005b818110156109d4576109cc8383838181106109b1576109b1611c3a565b905060a002018036038101906109c79190611d11565b61124a565b600101610994565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda828260405161095b929190611da2565b600080610a11610d81565b610a1b8484610e52565b915091505b9250929050565b60608167ffffffffffffffff811115610a4257610a42611c24565b604051908082528060200260200182016040528015610a6b578160200160208202803683370190505b50905060005b81518110156106225760066000858584818110610a9057610a90611c3a565b9050602002016020810190610aa59190611abc565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610ad857610ad8611c3a565b6020908102919091010152600101610a71565b6000805b828110156106225760076000858584818110610b0d57610b0d611c3a565b9050602002016020810190610b229190611abc565b6001600160a01b03168152602081019190915260400160002054610b469083611c66565b9150600101610aef565b6000600354600154610b629190611c79565b600254610b6f9084611c79565b101592915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052905b600954811015610bfc57826001600160a01b031660098281548110610bca57610bca611c3a565b6000918252602090912001546001600160a01b031603610bf457610bed81610c7b565b9392505050565b600101610ba3565b5060405163e57fdbef60e01b815260040160405180910390fd5b6000805b828110156106225760056000858584818110610c3857610c38611c3a565b9050602002016020810190610c4d9190611abc565b6001600160a01b03168152602081019190915260400160002054610c719083611c66565b9150600101610c1a565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152600060098381548110610cbb57610cbb611c3a565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610d0857610d08611c3a565b600091825260209182902001546001600160a01b03168252600b8054929091019186908110610d3957610d39611c3a565b60009182526020808320909101546001600160a01b03908116845294909416808252600585526040808320548487015290825260089094528390205492019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610ddb576000356001600160e01b0319166001604051620f948f60ea1b81526004016107eb929190611e2b565b565b60005b81811015610e2057610e18838383818110610dfd57610dfd611c3a565b905060a00201803603810190610e139190611d11565b611571565b600101610de0565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c828260405161095b929190611da2565b60008082841115610e84576040516387f6f09560e01b81526001600160e01b03196000351660048201526024016107eb565b50506001805460028054858455908490556004805493840190556040805183815260208101839052929391928592879290917f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b6001600160a01b03811660009081526005602052604081205490819003610f2d576040516349f748eb60e01b81526001600160a01b03831660048201526024016107eb565b600954600090815b81811015610f8457846001600160a01b031660098281548110610f5a57610f5a611c3a565b6000918252602090912001546001600160a01b031603610f7c57809250610f84565b600101610f35565b508260036000828254610f979190611c90565b90915550506001600160a01b038416600090815260086020908152604080832083905560059091528120556009610fcf600183611c90565b81548110610fdf57610fdf611c3a565b600091825260209091200154600980546001600160a01b03909216918490811061100b5761100b611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061104a5761104a611e67565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a848154811061108957611089611c3a565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a6110bb600183611c90565b815481106110cb576110cb611c3a565b600091825260209091200154600a80546001600160a01b0390921691849081106110f7576110f7611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a80548061113657611136611e67565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560076000600b848154811061117557611175611c3a565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600b6111a7600183611c90565b815481106111b7576111b7611c3a565b600091825260209091200154600b80546001600160a01b0390921691849081106111e3576111e3611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b80548061122257611222611e67565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b611253816117bc565b80516001600160a01b03166000908152600560205260408120549081900361129c5781516040516349f748eb60e01b81526001600160a01b0390911660048201526024016107eb565b60095460005b8181101561156b5783600001516001600160a01b0316600982815481106112cb576112cb611c3a565b6000918252602090912001546001600160a01b0316036115635782600360008282546112f79190611c90565b9091555050606084015160038054600090611313908490611c66565b9250508190555083602001516001600160a01b0316600a828154811061133b5761133b611c3a565b6000918252602090912001546001600160a01b031614611416576020808501516001600160a01b031660009081526006909152604090205415611391576040516346da180960e01b815260040160405180910390fd5b60066000600a83815481106113a8576113a8611c3a565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a8054839081106113e7576113e7611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b83604001516001600160a01b0316600b828154811061143757611437611c3a565b6000918252602090912001546001600160a01b031614611511576040808501516001600160a01b03166000908152600760205220541561148a576040516346da180960e01b815260040160405180910390fd5b60076000600b83815481106114a1576114a1611c3a565b60009182526020808320909101546001600160a01b031683528201929092526040908101822091909155840151600b8054839081106114e2576114e2611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945584518187015184168352600682528483205593519483015190911681526007909252902055565b6001016112a2565b50505050565b6080810151156115945760405163129c2ce160e31b815260040160405180910390fd5b61159d816117bc565b80516001600160a01b0316600090815260056020526040902054156115e357805160405163ada9a35360e01b81526001600160a01b0390911660048201526024016107eb565b6020808201516001600160a01b031660009081526006909152604090205415611630576020810151604051637f5e2f5960e11b81526001600160a01b0390911660048201526024016107eb565b6040808201516001600160a01b03166000908152600760205220541561167a576040808201519051630f69702d60e01b81526001600160a01b0390911660048201526024016107eb565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a805480890182559089527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180548716918a16919091179055835190518816875260068252828720558188018051600b8054978801815588527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db99096018054909516958816959095179093558151935186168552600783528085209390935585519094168352600890528120439055905160038054919290916117b4908490611c66565b909155505050565b80606001516000036117ef57604051637f11b8a360e11b81526001600160e01b03196000351660048201526024016107eb565b604080516003808252608082019092526000916020820160608036833701905050905081600001518160008151811061182a5761182a611c3a565b60200260200101906001600160a01b031690816001600160a01b03168152505081602001518160018151811061186257611862611c3a565b60200260200101906001600160a01b031690816001600160a01b03168152505081604001518160028151811061189a5761189a611c3a565b60200260200101906001600160a01b031690816001600160a01b0316815250506118c3816118ef565b1561036e57604051630d697db160e11b81526001600160e01b03196000351660048201526024016107eb565b6000815160000361190257506000919050565b60005b600183510381101561198557600181015b835181101561197c5783818151811061193157611931611c3a565b60200260200101516001600160a01b031684838151811061195457611954611c3a565b60200260200101516001600160a01b031603611974575060019392505050565b600101611916565b50600101611905565b50600092915050565b60008083601f8401126119a057600080fd5b50813567ffffffffffffffff8111156119b857600080fd5b60208301915083602060a083028501011115610a2057600080fd5b600080602083850312156119e657600080fd5b823567ffffffffffffffff8111156119fd57600080fd5b611a098582860161198e565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611a9457611a81838551611a15565b9284019260a09290920191600101611a6e565b50909695505050505050565b80356001600160a01b0381168114611ab757600080fd5b919050565b600060208284031215611ace57600080fd5b610bed82611aa0565b60008060208385031215611aea57600080fd5b823567ffffffffffffffff80821115611b0257600080fd5b818501915085601f830112611b1657600080fd5b813581811115611b2557600080fd5b8660208260051b8501011115611b3a57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611a9457835183529284019291840191600101611b68565b60008060008060608587031215611b9a57600080fd5b843567ffffffffffffffff811115611bb157600080fd5b611bbd8782880161198e565b90989097506020870135966040013595509350505050565b60008060408385031215611be857600080fd5b50508035926020909101359150565b600060208284031215611c0957600080fd5b5035919050565b60a08101611c1e8284611a15565b92915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115611c1e57611c1e611c50565b8082028115828204841417611c1e57611c1e611c50565b81810381811115611c1e57611c1e611c50565b600082611cc057634e487b7160e01b600052601260045260246000fd5b500490565b60208082528181018390526000908460408401835b86811015611d06576001600160a01b03611cf384611aa0565b1682529183019190830190600101611cda565b509695505050505050565b600060a08284031215611d2357600080fd5b60405160a0810181811067ffffffffffffffff82111715611d5457634e487b7160e01b600052604160045260246000fd5b604052611d6083611aa0565b8152611d6e60208401611aa0565b6020820152611d7f60408401611aa0565b604082015260608301356060820152608083013560808201528091505092915050565b6020808252818101839052600090604080840186845b87811015611e1e576001600160a01b0380611dd284611aa0565b16845280611de1878501611aa0565b168685015280611df2868501611aa0565b168486015250606082810135908401526080808301359084015260a09283019290910190600101611db8565b5090979650505050505050565b6001600160e01b0319831681526040810160098310611e5a57634e487b7160e01b600052602160045260246000fd5b8260208301529392505050565b634e487b7160e01b600052603160045260246000fdfea164736f6c6343000811000a", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063b505a07c116100b8578063d9d5dadb1161007c578063d9d5dadb146102d5578063dafae408146102e8578063db6693a21461030b578063e75235b81461032b578063e8c0685e14610336578063f09267c21461034957600080fd5b8063b505a07c14610256578063b9c3620914610269578063cacf8fb514610291578063cc7e6b3b14610299578063d78392f8146102ac57600080fd5b80635f14a1c31161010a5780635f14a1c3146101fa578063708236251461020d5780637c37103c146102205780637de5dedd14610233578063926323d51461023b578063a85c7d6e1461024357600080fd5b80630ed285df14610147578063150740051461015c57806341feed1c1461017a578063520fce62146101b157806356241911146101d1575b600080fd5b61015a6101553660046119d3565b61035c565b005b610164610372565b6040516101719190611a52565b60405180910390f35b6101a3610188366004611abc565b6001600160a01b031660009081526005602052604090205490565b604051908152602001610171565b6101c46101bf366004611ad7565b61055e565b6040516101719190611b4c565b6101a36101df366004611abc565b6001600160a01b031660009081526007602052604090205490565b6101a3610208366004611ad7565b610629565b6101c461021b366004611ad7565b61068e565b61015a61022e366004611b84565b610752565b6101a3610880565b6003546101a3565b61015a610251366004611ad7565b6108bd565b61015a6102643660046119d3565b610967565b61027c610277366004611bd5565b610a06565b60408051928352602083019190915201610171565b6009546101a3565b6101c46102a7366004611ad7565b610a27565b6101a36102ba366004611abc565b6001600160a01b031660009081526006602052604090205490565b6101a36102e3366004611ad7565b610aeb565b6102fb6102f6366004611bf7565b610b50565b6040519015158152602001610171565b61031e610319366004611abc565b610b77565b6040516101719190611c10565b60015460025461027c565b6101a3610344366004611ad7565b610c16565b61031e610357366004611bf7565b610c7b565b610364610d81565b61036e8282610ddd565b5050565b60095460609067ffffffffffffffff81111561039057610390611c24565b6040519080825280602002602001820160405280156103e957816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816103ae5790505b5090506000805b8251811015610559576009818154811061040c5761040c611c3a565b9060005260206000200160009054906101000a90046001600160a01b031691508183828151811061043f5761043f611c3a565b60209081029190910101516001600160a01b039091169052600a80548290811061046b5761046b611c3a565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061049b5761049b611c3a565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600b81815481106104d2576104d2611c3a565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061050257610502611c3a565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061054257610542611c3a565b6020908102919091010151606001526001016103f0565b505090565b60608167ffffffffffffffff81111561057957610579611c24565b6040519080825280602002602001820160405280156105a2578160200160208202803683370190505b50905060005b815181101561062257600560008585848181106105c7576105c7611c3a565b90506020020160208101906105dc9190611abc565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061060f5761060f611c3a565b60209081029190910101526001016105a8565b5092915050565b6000805b82811015610622576006600085858481811061064b5761064b611c3a565b90506020020160208101906106609190611abc565b6001600160a01b031681526020810191909152604001600020546106849083611c66565b915060010161062d565b60608167ffffffffffffffff8111156106a9576106a9611c24565b6040519080825280602002602001820160405280156106d2578160200160208202803683370190505b50905060005b815181101561062257600760008585848181106106f7576106f7611c3a565b905060200201602081019061070c9190611abc565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061073f5761073f611c3a565b60209081029190910101526001016106d8565b600054610100900460ff16158080156107725750600054600160ff909116105b8061078c5750303b15801561078c575060005460ff166001145b6107f45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610817576000805461ff0019166101001790555b8315610827576108278585610ddd565b6108318383610e52565b50508015610879576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6000600254600160025460035460015461089a9190611c79565b6108a49190611c66565b6108ae9190611c90565b6108b89190611ca3565b905090565b6108c5610d81565b60008190036108e7576040516316ee9d3b60e11b815260040160405180910390fd5b60005b818110156109295761092183838381811061090757610907611c3a565b905060200201602081019061091c9190611abc565b610ee8565b6001016108ea565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a7828260405161095b929190611cc5565b60405180910390a15050565b61096f610d81565b6000819003610991576040516316ee9d3b60e11b815260040160405180910390fd5b60005b818110156109d4576109cc8383838181106109b1576109b1611c3a565b905060a002018036038101906109c79190611d11565b61124a565b600101610994565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda828260405161095b929190611da2565b600080610a11610d81565b610a1b8484610e52565b915091505b9250929050565b60608167ffffffffffffffff811115610a4257610a42611c24565b604051908082528060200260200182016040528015610a6b578160200160208202803683370190505b50905060005b81518110156106225760066000858584818110610a9057610a90611c3a565b9050602002016020810190610aa59190611abc565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610ad857610ad8611c3a565b6020908102919091010152600101610a71565b6000805b828110156106225760076000858584818110610b0d57610b0d611c3a565b9050602002016020810190610b229190611abc565b6001600160a01b03168152602081019190915260400160002054610b469083611c66565b9150600101610aef565b6000600354600154610b629190611c79565b600254610b6f9084611c79565b101592915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052905b600954811015610bfc57826001600160a01b031660098281548110610bca57610bca611c3a565b6000918252602090912001546001600160a01b031603610bf457610bed81610c7b565b9392505050565b600101610ba3565b5060405163e57fdbef60e01b815260040160405180910390fd5b6000805b828110156106225760056000858584818110610c3857610c38611c3a565b9050602002016020810190610c4d9190611abc565b6001600160a01b03168152602081019190915260400160002054610c719083611c66565b9150600101610c1a565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152600060098381548110610cbb57610cbb611c3a565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610d0857610d08611c3a565b600091825260209182902001546001600160a01b03168252600b8054929091019186908110610d3957610d39611c3a565b60009182526020808320909101546001600160a01b03908116845294909416808252600585526040808320548487015290825260089094528390205492019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610ddb576000356001600160e01b0319166001604051620f948f60ea1b81526004016107eb929190611e2b565b565b60005b81811015610e2057610e18838383818110610dfd57610dfd611c3a565b905060a00201803603810190610e139190611d11565b611571565b600101610de0565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c828260405161095b929190611da2565b60008082841115610e84576040516387f6f09560e01b81526001600160e01b03196000351660048201526024016107eb565b50506001805460028054858455908490556004805493840190556040805183815260208101839052929391928592879290917f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b6001600160a01b03811660009081526005602052604081205490819003610f2d576040516349f748eb60e01b81526001600160a01b03831660048201526024016107eb565b600954600090815b81811015610f8457846001600160a01b031660098281548110610f5a57610f5a611c3a565b6000918252602090912001546001600160a01b031603610f7c57809250610f84565b600101610f35565b508260036000828254610f979190611c90565b90915550506001600160a01b038416600090815260086020908152604080832083905560059091528120556009610fcf600183611c90565b81548110610fdf57610fdf611c3a565b600091825260209091200154600980546001600160a01b03909216918490811061100b5761100b611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061104a5761104a611e67565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a848154811061108957611089611c3a565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a6110bb600183611c90565b815481106110cb576110cb611c3a565b600091825260209091200154600a80546001600160a01b0390921691849081106110f7576110f7611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a80548061113657611136611e67565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560076000600b848154811061117557611175611c3a565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600b6111a7600183611c90565b815481106111b7576111b7611c3a565b600091825260209091200154600b80546001600160a01b0390921691849081106111e3576111e3611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b80548061122257611222611e67565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b611253816117bc565b80516001600160a01b03166000908152600560205260408120549081900361129c5781516040516349f748eb60e01b81526001600160a01b0390911660048201526024016107eb565b60095460005b8181101561156b5783600001516001600160a01b0316600982815481106112cb576112cb611c3a565b6000918252602090912001546001600160a01b0316036115635782600360008282546112f79190611c90565b9091555050606084015160038054600090611313908490611c66565b9250508190555083602001516001600160a01b0316600a828154811061133b5761133b611c3a565b6000918252602090912001546001600160a01b031614611416576020808501516001600160a01b031660009081526006909152604090205415611391576040516346da180960e01b815260040160405180910390fd5b60066000600a83815481106113a8576113a8611c3a565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a8054839081106113e7576113e7611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b83604001516001600160a01b0316600b828154811061143757611437611c3a565b6000918252602090912001546001600160a01b031614611511576040808501516001600160a01b03166000908152600760205220541561148a576040516346da180960e01b815260040160405180910390fd5b60076000600b83815481106114a1576114a1611c3a565b60009182526020808320909101546001600160a01b031683528201929092526040908101822091909155840151600b8054839081106114e2576114e2611c3a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945584518187015184168352600682528483205593519483015190911681526007909252902055565b6001016112a2565b50505050565b6080810151156115945760405163129c2ce160e31b815260040160405180910390fd5b61159d816117bc565b80516001600160a01b0316600090815260056020526040902054156115e357805160405163ada9a35360e01b81526001600160a01b0390911660048201526024016107eb565b6020808201516001600160a01b031660009081526006909152604090205415611630576020810151604051637f5e2f5960e11b81526001600160a01b0390911660048201526024016107eb565b6040808201516001600160a01b03166000908152600760205220541561167a576040808201519051630f69702d60e01b81526001600160a01b0390911660048201526024016107eb565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a805480890182559089527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180548716918a16919091179055835190518816875260068252828720558188018051600b8054978801815588527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db99096018054909516958816959095179093558151935186168552600783528085209390935585519094168352600890528120439055905160038054919290916117b4908490611c66565b909155505050565b80606001516000036117ef57604051637f11b8a360e11b81526001600160e01b03196000351660048201526024016107eb565b604080516003808252608082019092526000916020820160608036833701905050905081600001518160008151811061182a5761182a611c3a565b60200260200101906001600160a01b031690816001600160a01b03168152505081602001518160018151811061186257611862611c3a565b60200260200101906001600160a01b031690816001600160a01b03168152505081604001518160028151811061189a5761189a611c3a565b60200260200101906001600160a01b031690816001600160a01b0316815250506118c3816118ef565b1561036e57604051630d697db160e11b81526001600160e01b03196000351660048201526024016107eb565b6000815160000361190257506000919050565b60005b600183510381101561198557600181015b835181101561197c5783818151811061193157611931611c3a565b60200260200101516001600160a01b031684838151811061195457611954611c3a565b60200260200101516001600160a01b031603611974575060019392505050565b600101611916565b50600101611905565b50600092915050565b60008083601f8401126119a057600080fd5b50813567ffffffffffffffff8111156119b857600080fd5b60208301915083602060a083028501011115610a2057600080fd5b600080602083850312156119e657600080fd5b823567ffffffffffffffff8111156119fd57600080fd5b611a098582860161198e565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611a9457611a81838551611a15565b9284019260a09290920191600101611a6e565b50909695505050505050565b80356001600160a01b0381168114611ab757600080fd5b919050565b600060208284031215611ace57600080fd5b610bed82611aa0565b60008060208385031215611aea57600080fd5b823567ffffffffffffffff80821115611b0257600080fd5b818501915085601f830112611b1657600080fd5b813581811115611b2557600080fd5b8660208260051b8501011115611b3a57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611a9457835183529284019291840191600101611b68565b60008060008060608587031215611b9a57600080fd5b843567ffffffffffffffff811115611bb157600080fd5b611bbd8782880161198e565b90989097506020870135966040013595509350505050565b60008060408385031215611be857600080fd5b50508035926020909101359150565b600060208284031215611c0957600080fd5b5035919050565b60a08101611c1e8284611a15565b92915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115611c1e57611c1e611c50565b8082028115828204841417611c1e57611c1e611c50565b81810381811115611c1e57611c1e611c50565b600082611cc057634e487b7160e01b600052601260045260246000fd5b500490565b60208082528181018390526000908460408401835b86811015611d06576001600160a01b03611cf384611aa0565b1682529183019190830190600101611cda565b509695505050505050565b600060a08284031215611d2357600080fd5b60405160a0810181811067ffffffffffffffff82111715611d5457634e487b7160e01b600052604160045260246000fd5b604052611d6083611aa0565b8152611d6e60208401611aa0565b6020820152611d7f60408401611aa0565b604082015260608301356060820152608083013560808201528091505092915050565b6020808252818101839052600090604080840186845b87811015611e1e576001600160a01b0380611dd284611aa0565b16845280611de1878501611aa0565b168685015280611df2868501611aa0565b168486015250606082810135908401526080808301359084015260a09283019290910190600101611db8565b5090979650505050505050565b6001600160e01b0319831681526040810160098310611e5a57634e487b7160e01b600052602160045260246000fd5b8260208301529392505050565b634e487b7160e01b600052603160045260246000fdfea164736f6c6343000811000a", + "numDeployments": 7, + "solcInputHash": "f5939ebe47e4086c92eac99ab2681ceb", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrConsensusAddressIsAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrConsensusAddressIsNotAdded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrDuplicated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrEmptyArray\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrGovernorAddressIsAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidRequest\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidThreshold\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidVoteWeight\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrQueryForDupplicated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrQueryForNonExistentConsensusAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"orgAfterChanged\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"TConsensus\",\"name\":\"oldConsensus\",\"type\":\"address\"}],\"name\":\"ConsensusAddressOfTrustedOrgChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"ThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"TConsensus[]\",\"name\":\"orgs\",\"type\":\"address[]\"}],\"name\":\"TrustedOrganizationsRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsUpdated\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"addTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_voteWeight\",\"type\":\"uint256\"}],\"name\":\"checkThreshold\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"countTrustedOrganization\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"oldAddr\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"newAddr\",\"type\":\"address\"}],\"name\":\"execChangeConsensusAddressForTrustedOrg\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllTrustedOrganizations\",\"outputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"getConsensusWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"}],\"name\":\"getConsensusWeightById\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"list\",\"type\":\"address[]\"}],\"name\":\"getConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"cids\",\"type\":\"address[]\"}],\"name\":\"getConsensusWeightsById\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"getGovernorWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"num_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getTrustedOrganization\",\"outputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_idx\",\"type\":\"uint256\"}],\"name\":\"getTrustedOrganizationAt\",\"outputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"trustedOrgs\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"profileContract\",\"type\":\"address\"}],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"list\",\"type\":\"address[]\"}],\"name\":\"removeTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"}],\"name\":\"setThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumConsensusWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumGovernorWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__deprecatedBridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"updateTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrConsensusAddressIsAlreadyAdded(address)\":[{\"details\":\"Error indicating that a consensus address is already added.\",\"params\":{\"addr\":\"The address of the consensus contract that is already added.\"}}],\"ErrConsensusAddressIsNotAdded(address)\":[{\"details\":\"Error indicating that a consensus address is not added.\",\"params\":{\"addr\":\"The address of the consensus contract that is not added.\"}}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrDuplicated(bytes4)\":[{\"details\":\"Error thrown when a duplicated element is detected in an array.\",\"params\":{\"msgSig\":\"The function signature that invoke the error.\"}}],\"ErrEmptyArray()\":[{\"details\":\"Error indicating that an array is empty when it should contain elements.\"}],\"ErrGovernorAddressIsAlreadyAdded(address)\":[{\"details\":\"Error indicating that a governor address has already been added.\",\"params\":{\"addr\":\"The address of the governor that is already added.\"}}],\"ErrInvalidRequest()\":[{\"details\":\"Error indicating that a request is invalid.\"}],\"ErrInvalidThreshold(bytes4)\":[{\"details\":\"Error indicating that the provided threshold is invalid for a specific function signature.\",\"params\":{\"msgSig\":\"The function signature (bytes4) that the invalid threshold applies to.\"}}],\"ErrInvalidVoteWeight(bytes4)\":[{\"details\":\"Error indicating that a vote weight is invalid for a specific function signature.\",\"params\":{\"msgSig\":\"The function signature (bytes4) that encountered an invalid vote weight.\"}}],\"ErrQueryForDupplicated()\":[{\"details\":\"Error indicating that a query for a duplicate entry was made.\"}],\"ErrQueryForNonExistentConsensusAddress()\":[{\"details\":\"Error indicating that a query was made for a non-existent consensus address.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"events\":{\"ConsensusAddressOfTrustedOrgChanged((address,address,address,uint256,uint256),address)\":{\"details\":\"Emitted when the consensus address of a trusted organization is changed.\"},\"ContractUpdated(uint8,address)\":{\"details\":\"Emitted when a contract is updated.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"ThresholdUpdated(uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Emitted when the threshold is updated\"},\"TrustedOrganizationsAdded((address,address,address,uint256,uint256)[])\":{\"details\":\"Emitted when the trusted organization is added.\"},\"TrustedOrganizationsRemoved(address[])\":{\"details\":\"Emitted when the trusted organization is removed.\"},\"TrustedOrganizationsUpdated((address,address,address,uint256,uint256)[])\":{\"details\":\"Emitted when the trusted organization is updated.\"}},\"kind\":\"dev\",\"methods\":{\"addTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Adds a list of addresses into the trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. - The field `addedBlock` should be blank. Emits the event `TrustedOrganizationAdded` once an organization is added.\"},\"checkThreshold(uint256)\":{\"details\":\"Checks whether the `_voteWeight` passes the threshold.\"},\"countTrustedOrganization()\":{\"details\":\"Returns the number of trusted organizations.\"},\"execChangeConsensusAddressForTrustedOrg(address,address)\":{\"details\":\"Fallback function of `Profile-requestChangeConsensusAddress`. Requirements: - The caller must be the Profile contract. Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\"},\"getAllTrustedOrganizations()\":{\"details\":\"Returns all of the trusted organizations.\"},\"getConsensusWeight(address)\":{\"details\":\"Returns the weight of a consensus.\"},\"getConsensusWeightById(address)\":{\"details\":\"Returns the weight of a consensus.\"},\"getConsensusWeights(address[])\":{\"details\":\"Returns the weights of a list of consensus addresses.\"},\"getConsensusWeightsById(address[])\":{\"details\":\"Returns the weights of a list of consensus addresses.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getGovernorWeight(address)\":{\"details\":\"Returns the weight of a governor.\"},\"getGovernorWeights(address[])\":{\"details\":\"Returns the weights of a list of governor addresses.\"},\"getThreshold()\":{\"details\":\"Returns the threshold.\"},\"getTrustedOrganization(address)\":{\"details\":\"Returns the trusted organization by consensus address. Reverts once the consensus address is non-existent.\"},\"getTrustedOrganizationAt(uint256)\":{\"details\":\"Returns the trusted organization at `_index`.\"},\"initialize((address,address,address,uint256,uint256)[],uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"minimumVoteWeight()\":{\"details\":\"Returns the minimum vote weight to pass the threshold.\"},\"removeTrustedOrganizations(address[])\":{\"details\":\"Removes a list of addresses from the trusted organization. Requirements: - The method caller is admin. Emits the event `TrustedOrganizationRemoved` once an organization is removed.\",\"params\":{\"consensusAddrs\":\"The list of consensus addresses linked to corresponding trusted organization that to be removed.\"}},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setThreshold(uint256,uint256)\":{\"details\":\"Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event.\"},\"sumConsensusWeight(address[])\":{\"details\":\"Returns total weights of the consensus list.\"},\"sumGovernorWeight(address[])\":{\"details\":\"Returns total weights of the governor list.\"},\"totalWeight()\":{\"details\":\"Returns total weights.\"},\"updateTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Updates weights for a list of existent trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. Emits the `TrustedOrganizationUpdated` event.\"}},\"stateVariables\":{\"__deprecatedBridgeVoterList\":{\"details\":\"Bridge voters array\"},\"__deprecatedBridgeVoterWeight\":{\"details\":\"Mapping from bridge voter address => weight\"},\"_addedBlock\":{\"details\":\"Mapping from consensus address => added block\"},\"_consensusList\":{\"details\":\"Consensus array\"},\"_consensusWeight\":{\"details\":\"Mapping from consensus address => weight\"},\"_governorList\":{\"details\":\"Governors array\"},\"_governorWeight\":{\"details\":\"Mapping from governor address => weight\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/multi-chains/RoninTrustedOrganization.sol\":\"RoninTrustedOrganization\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../udvts/Types.sol\\\";\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n TConsensus consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address __reservedGovernor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n /// @dev Event emitted when the pubkey of the `id` is changed.\\n event PubkeyChanged(address indexed id, bytes pubkey);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n /// @dev Error when create a new profile whose id and consensus are not identical.\\n error ErrIdAndConsensusDiffer();\\n /**\\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\\n * and with value type of `infoType`.\\n */\\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\\n error ErrDuplicatedPubkey(bytes pubkey);\\n error ErrZeroAddress(RoleAccess infoType);\\n error ErrZeroPubkey();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\\n\\n /// @dev Getter to backward query from `consensus` address to `id` address.\\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\\n\\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\\n * applying for candidate role.\\n *\\n * Requirements:\\n * - Only `stakingContract` can call this method.\\n */\\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\\n\\n /**\\n * @notice The candidate admin changes the public key.\\n *\\n * @dev Requirements:\\n * - The profile must be existed.\\n * - Only user with candidate admin role can call this method.\\n * - New public key must not be duplicated.\\n */\\n\\n function changePubkey(address id, bytes memory pubkey) external;\\n}\\n\",\"keccak256\":\"0x14dfb3198bf21724f5315198e1b23564902821ef56730c7db49e3d1165a36d36\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\nimport \\\"../udvts/Types.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n /**\\n * @dev Error indicating that a query for a duplicate entry was made.\\n */\\n error ErrQueryForDupplicated();\\n\\n /**\\n * @dev Error indicating that a query was made for a non-existent consensus address.\\n */\\n error ErrQueryForNonExistentConsensusAddress();\\n\\n /**\\n * @dev Error indicating that a governor address has already been added.\\n * @param addr The address of the governor that is already added.\\n */\\n error ErrGovernorAddressIsAlreadyAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is not added.\\n * @param addr The address of the consensus contract that is not added.\\n */\\n error ErrConsensusAddressIsNotAdded(TConsensus addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is already added.\\n * @param addr The address of the consensus contract that is already added.\\n */\\n error ErrConsensusAddressIsAlreadyAdded(TConsensus addr);\\n\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n TConsensus consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address __deprecatedBridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(TConsensus[] orgs);\\n /// @dev Emitted when the consensus address of a trusted organization is changed.\\n event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n *\\n * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\\n */\\n function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeight() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeightById(address cid) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganization() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x0b2a44131128f965e20cbea424987817cb504502e5d83d6523ae45ffeb5e53fe\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/multi-chains/RoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../interfaces/IProfile.sol\\\";\\nimport \\\"../extensions/collections/HasProxyAdmin.sol\\\";\\nimport \\\"../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../udvts/Types.sol\\\";\\n\\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, HasContracts, Initializable {\\n uint256 internal _num;\\n uint256 internal _denom;\\n uint256 internal _totalWeight;\\n uint256 internal _nonce;\\n\\n /// @dev Mapping from consensus address => weight\\n mapping(TConsensus => uint256) internal _consensusWeight;\\n /// @dev Mapping from governor address => weight\\n mapping(address => uint256) internal _governorWeight;\\n /// @dev Mapping from bridge voter address => weight\\n mapping(address => uint256) internal __deprecatedBridgeVoterWeight;\\n\\n /// @dev Mapping from consensus address => added block\\n mapping(TConsensus => uint256) internal _addedBlock;\\n\\n /// @dev Consensus array\\n TConsensus[] internal _consensusList;\\n /// @dev Governors array\\n address[] internal _governorList;\\n /// @dev Bridge voters array\\n address[] internal __deprecatedBridgeVoterList;\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(TrustedOrganization[] calldata trustedOrgs, uint256 num, uint256 denom) external initializer {\\n if (trustedOrgs.length > 0) {\\n _addTrustedOrganizations(trustedOrgs);\\n }\\n _setThreshold(num, denom);\\n }\\n\\n function initializeV2(address profileContract) external reinitializer(2) {\\n _setContract(ContractType.PROFILE, profileContract);\\n for (uint i; i < __deprecatedBridgeVoterList.length; ++i) {\\n delete __deprecatedBridgeVoterWeight[__deprecatedBridgeVoterList[i]];\\n }\\n delete __deprecatedBridgeVoterList;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\\n return (_num, _denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\\n return _voteWeight * _denom >= _num * _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function minimumVoteWeight() external view virtual returns (uint256) {\\n return (_num * _totalWeight + _denom - 1) / _denom;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external override onlyAdmin returns (uint256, uint256) {\\n return _setThreshold(_numerator, _denominator);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n _addTrustedOrganizations(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n if (_list.length == 0) revert ErrEmptyArray();\\n for (uint256 _i; _i < _list.length; ) {\\n _updateTrustedOrganization(_list[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit TrustedOrganizationsUpdated(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function removeTrustedOrganizations(TConsensus[] calldata list) external override onlyAdmin {\\n if (list.length == 0) revert ErrEmptyArray();\\n\\n for (uint _i = 0; _i < list.length; ) {\\n _removeTrustedOrganization(list[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit TrustedOrganizationsRemoved(list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function totalWeight() external view virtual returns (uint256) {\\n return _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256) {\\n return _getConsensusWeightByConsensus(consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeightById(address cid) external view returns (uint256) {\\n return _getConsensusWeightByConsensus(__cid2css(cid));\\n }\\n\\n function _getConsensusWeightByConsensus(TConsensus consensusAddr) internal view returns (uint256) {\\n return _consensusWeight[consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256) {\\n return _governorWeight[_governor];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory) {\\n return _getManyConsensusWeightsByConsensus(list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory) {\\n TConsensus[] memory consensusList = __cid2cssBatch(cids);\\n return _getManyConsensusWeightsByConsensus(consensusList);\\n }\\n\\n function _getManyConsensusWeightsByConsensus(TConsensus[] memory list) internal view returns (uint256[] memory res) {\\n res = new uint256[](list.length);\\n for (uint i = 0; i < res.length; ++i) {\\n res[i] = _getConsensusWeightByConsensus(list[i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; ) {\\n _res[_i] = _governorWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumConsensusWeight(TConsensus[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; ) {\\n _res += _consensusWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumGovernorWeight(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; ) {\\n _res += _governorWeight[_list[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function countTrustedOrganization() external view override returns (uint256) {\\n return _consensusList.length;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory list) {\\n list = new TrustedOrganization[](_consensusList.length);\\n TConsensus consensus;\\n for (uint256 _i; _i < list.length; ) {\\n consensus = _consensusList[_i];\\n list[_i].consensusAddr = consensus;\\n list[_i].governor = _governorList[_i];\\n list[_i].__deprecatedBridgeVoter = address(0);\\n list[_i].weight = _consensusWeight[consensus];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganization(TConsensus _consensusAddr) external view returns (TrustedOrganization memory) {\\n for (uint i = 0; i < _consensusList.length; ++i) {\\n if (_consensusList[i] == _consensusAddr) {\\n return getTrustedOrganizationAt(i);\\n }\\n }\\n revert ErrQueryForNonExistentConsensusAddress();\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\\n TConsensus consensus = _consensusList[_idx];\\n return\\n TrustedOrganization(\\n consensus,\\n _governorList[_idx],\\n address(0),\\n _consensusWeight[consensus],\\n _addedBlock[consensus]\\n );\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function execChangeConsensusAddressForTrustedOrg(\\n TConsensus oldAddr,\\n TConsensus newAddr\\n ) external override onlyContract(ContractType.PROFILE) {\\n uint256 index = _findTrustedOrgIndexByConsensus(oldAddr);\\n _consensusList[index] = newAddr;\\n _consensusWeight[newAddr] = _consensusWeight[oldAddr];\\n _addedBlock[newAddr] = block.number;\\n\\n _deleteConsensusInMappings(oldAddr);\\n\\n emit ConsensusAddressOfTrustedOrgChanged(getTrustedOrganizationAt(index), oldAddr);\\n }\\n\\n /**\\n * @dev Adds a list of trusted organizations.\\n */\\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\\n for (uint256 _i; _i < _list.length; ) {\\n _addTrustedOrganization(_list[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit TrustedOrganizationsAdded(_list);\\n }\\n\\n /**\\n * @dev Adds a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is not added.\\n * - The governor address is not added.\\n * - The bridge voter address is not added.\\n *\\n */\\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n if (_v.addedBlock != 0) revert ErrInvalidRequest();\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n if (_consensusWeight[_v.consensusAddr] > 0) revert ErrConsensusAddressIsAlreadyAdded(_v.consensusAddr);\\n\\n if (_governorWeight[_v.governor] > 0) revert ErrGovernorAddressIsAlreadyAdded(_v.governor);\\n\\n _consensusList.push(_v.consensusAddr);\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n\\n _governorList.push(_v.governor);\\n _governorWeight[_v.governor] = _v.weight;\\n\\n _addedBlock[_v.consensusAddr] = block.number;\\n\\n _totalWeight += _v.weight;\\n }\\n\\n /**\\n * @dev Updates info of an existing trusted org.\\n * Replace the governor address if they are different, set all weights to the new weight.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is already added.\\n *\\n */\\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n uint256 _weight = _consensusWeight[_v.consensusAddr];\\n if (_weight == 0) revert ErrConsensusAddressIsNotAdded(_v.consensusAddr);\\n\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; ) {\\n if (_consensusList[_i] == _v.consensusAddr) {\\n _totalWeight -= _weight;\\n _totalWeight += _v.weight;\\n\\n // Replace governor address\\n if (_governorList[_i] != _v.governor) {\\n if (_governorWeight[_v.governor] != 0) revert ErrQueryForDupplicated();\\n\\n delete _governorWeight[_governorList[_i]];\\n _governorList[_i] = _v.governor;\\n }\\n\\n // Add new weight for both consensus and governor address\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n _governorWeight[_v.governor] = _v.weight;\\n return;\\n }\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Removes a trusted organization by consensus address.\\n *\\n * Requirements:\\n * - The consensus address is added.\\n *\\n */\\n function _removeTrustedOrganization(TConsensus addr) internal virtual {\\n uint256 weight = _consensusWeight[addr];\\n if (weight == 0) revert ErrConsensusAddressIsNotAdded(addr);\\n\\n uint256 index = _findTrustedOrgIndexByConsensus(addr);\\n\\n _totalWeight -= weight;\\n _deleteConsensusInMappings(addr);\\n\\n uint256 count = _consensusList.length;\\n _consensusList[index] = _consensusList[count - 1];\\n _consensusList.pop();\\n\\n delete _governorWeight[_governorList[index]];\\n _governorList[index] = _governorList[count - 1];\\n _governorList.pop();\\n }\\n\\n function _findTrustedOrgIndexByConsensus(TConsensus addr) private view returns (uint256 index) {\\n uint256 count = _consensusList.length;\\n for (uint256 i = 0; i < count; i++) {\\n if (_consensusList[i] == addr) {\\n return i;\\n }\\n }\\n }\\n\\n function _deleteConsensusInMappings(TConsensus addr) private {\\n delete _addedBlock[addr];\\n delete _consensusWeight[addr];\\n }\\n\\n /**\\n * @dev Sets threshold and returns the old one.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function _setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) internal virtual returns (uint256 _previousNum, uint256 _previousDenom) {\\n if (_numerator > _denominator) revert ErrInvalidThreshold(msg.sig);\\n\\n _previousNum = _num;\\n _previousDenom = _denom;\\n _num = _numerator;\\n _denom = _denominator;\\n unchecked {\\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\\n }\\n }\\n\\n /**\\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\\n *\\n * Requirements:\\n * - The weight must be larger than 0.\\n * - The consensus address, governor address, and bridge voter address are different.\\n */\\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\\n if (_v.weight == 0) revert ErrInvalidVoteWeight(msg.sig);\\n\\n address[] memory _addresses = new address[](3);\\n _addresses[0] = TConsensus.unwrap(_v.consensusAddr);\\n _addresses[1] = _v.governor;\\n _addresses[2] = _v.__deprecatedBridgeVoter;\\n\\n if (AddressArrayUtils.hasDuplicate(_addresses)) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n function __cid2css(address cid) internal view returns (TConsensus) {\\n return (IProfile(getContract(ContractType.PROFILE)).getId2Profile(cid)).consensus;\\n }\\n\\n function __cid2cssBatch(address[] memory cids) internal view returns (TConsensus[] memory) {\\n return IProfile(getContract(ContractType.PROFILE)).getManyId2Consensus(cids);\\n }\\n}\\n\",\"keccak256\":\"0x5629e9c9676597e386212588adf808c5ae511aecb6c3c950ab5450d74ac939e3\",\"license\":\"MIT\"},\"contracts/udvts/Types.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ntype TPoolId is address;\\ntype TConsensus is address;\\n\\nusing { TPoolIdEq as == } for TPoolId global;\\nusing { TConsensusEq as == } for TConsensus global;\\n\\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\\n}\\n\\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\\n}\\n\",\"keccak256\":\"0x3017524670c86eaf3930447e482b6f372ae091bb5f8eb89570924599fa626ed7\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x7e228d0dbe377086fb2f7438b1e79b4e30b4eeb0225036b90a33effc5af06197\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALITY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE,\\n /* 9 */ CONSENSUS,\\n /* 10 */ TREASURY\\n}\\n\",\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612471806100206000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063a0c302a7116100de578063cc7e6b3b11610097578063db6693a211610071578063db6693a214610349578063de981f1b14610369578063e75235b814610394578063f09267c21461039f57600080fd5b8063cc7e6b3b146102ea578063d78392f8146102fd578063dafae4081461032657600080fd5b8063a0c302a71461026e578063a85c7d6e14610281578063b505a07c14610294578063b7f67e97146102a7578063b8cc3a50146102af578063b9c36209146102c257600080fd5b8063691845a911610130578063691845a9146102125780637c37103c146102255780637de5dedd14610238578063865e6fd314610240578063903bb3c51461025357806396c82e571461026657600080fd5b80630ed285df14610178578063150740051461018d57806329b6eca9146101ab5780632cccb53c146101be57806341feed1c146101de578063520fce62146101ff575b600080fd5b61018b610186366004611b8d565b6103b2565b005b6101956103c8565b6040516101a29190611c0b565b60405180910390f35b61018b6101b9366004611c6e565b610584565b6101d16101cc366004611ccf565b610696565b6040516101a29190611d04565b6101f16101ec366004611c6e565b6106eb565b6040519081526020016101a2565b6101d161020d366004611ccf565b610709565b6101f1610220366004611ccf565b61074e565b61018b610233366004611d3c565b6107ba565b6101f161089c565b61018b61024e366004611d9b565b6108d9565b6101f1610261366004611ccf565b6108f4565b6003546101f1565b61018b61027c366004611dd2565b610959565b61018b61028f366004611ccf565b610a29565b61018b6102a2366004611b8d565b610ac7565b6009546101f1565b6101f16102bd366004611c6e565b610b66565b6102d56102d0366004611df0565b610b8f565b604080519283526020830191909152016101a2565b6101d16102f8366004611ccf565b610bb0565b6101f161030b366004611c6e565b6001600160a01b031660009081526006602052604090205490565b610339610334366004611e12565b610c73565b60405190151581526020016101a2565b61035c610357366004611c6e565b610c9a565b6040516101a29190611e2b565b61037c610377366004611e39565b610d3b565b6040516001600160a01b0390911681526020016101a2565b6001546002546102d5565b61035c6103ad366004611e12565b610db6565b6103ba610e95565b6103c48282610ef1565b5050565b6009546060906001600160401b038111156103e5576103e5611e54565b60405190808252806020026020018201604052801561043e57816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816104035790505b5090506000805b825181101561057f576009818154811061046157610461611e6a565b9060005260206000200160009054906101000a90046001600160a01b031691508183828151811061049457610494611e6a565b60209081029190910101516001600160a01b039091169052600a8054829081106104c0576104c0611e6a565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104f0576104f0611e6a565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600083828151811061052857610528611e6a565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061056857610568611e6a565b602090810291909101015160600152600101610445565b505090565b600054600290610100900460ff161580156105a6575060005460ff8083169116105b6105cb5760405162461bcd60e51b81526004016105c290611e80565b60405180910390fd5b6000805461ffff191660ff8316176101001790556105ea600f83610f66565b60005b600b548110156106435760076000600b838154811061060e5761060e611e6a565b60009182526020808320909101546001600160a01b0316835282019290925260400181205561063c81611ee4565b90506105ed565b50610650600b6000611b17565b6000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b606060006106d684848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061100a92505050565b90506106e181611086565b9150505b92915050565b6001600160a01b0381166000908152600560205260408120546106e5565b606061074783838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061108692505050565b9392505050565b6000805b828110156107b3576005600085858481811061077057610770611e6a565b90506020020160208101906107859190611c6e565b6001600160a01b031681526020810191909152604001600020546107a99083611efd565b9150600101610752565b5092915050565b600054610100900460ff16158080156107da5750600054600160ff909116105b806107f45750303b1580156107f4575060005460ff166001145b6108105760405162461bcd60e51b81526004016105c290611e80565b6000805460ff191660011790558015610833576000805461ff0019166101001790555b8315610843576108438585610ef1565b61084d8383611144565b50508015610895576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600060025460016002546003546001546108b69190611f10565b6108c09190611efd565b6108ca9190611f27565b6108d49190611f3a565b905090565b6108e1610e95565b6108ea816111da565b6103c48282610f66565b6000805b828110156107b3576006600085858481811061091657610916611e6a565b905060200201602081019061092b9190611c6e565b6001600160a01b0316815260208101919091526040016000205461094f9083611efd565b91506001016108f8565b600f61096481611213565b600061096f8461125f565b9050826009828154811061098557610985611e6a565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055868316808352600580835260408085208054968a1686528186209690965560088452808520439055918452908320839055905290557faf495cd00cf8595e5fc29a082a18b71cad844d97ab40237b7405693a910c50a2610a0c82610db6565b85604051610a1b929190611f5c565b60405180910390a150505050565b610a31610e95565b6000819003610a53576040516316ee9d3b60e11b815260040160405180910390fd5b60005b81811015610a9557610a8d838383818110610a7357610a73611e6a565b9050602002016020810190610a889190611c6e565b6112c7565b600101610a56565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a7828260405161068a929190611f82565b610acf610e95565b6000819003610af1576040516316ee9d3b60e11b815260040160405180910390fd5b60005b81811015610b3457610b2c838383818110610b1157610b11611e6a565b905060a00201803603810190610b279190612028565b6114f5565b600101610af4565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda828260405161068a9291906120af565b60006106e5610b748361170e565b6001600160a01b031660009081526005602052604090205490565b600080610b9a610e95565b610ba48484611144565b915091505b9250929050565b6060816001600160401b03811115610bca57610bca611e54565b604051908082528060200260200182016040528015610bf3578160200160208202803683370190505b50905060005b81518110156107b35760066000858584818110610c1857610c18611e6a565b9050602002016020810190610c2d9190611c6e565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610c6057610c60611e6a565b6020908102919091010152600101610bf9565b6000600354600154610c859190611f10565b600254610c929084611f10565b101592915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052905b600954811015610d2157610d0360098281548110610ce657610ce6611e6a565b6000918252602090912001546001600160a01b0385811691161490565b15610d115761074781610db6565b610d1a81611ee4565b9050610cc6565b5060405163e57fdbef60e01b815260040160405180910390fd5b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115610d7257610d72612140565b60ff1681526020810191909152604001600020546001600160a01b0316905080610db1578160405163409140df60e11b81526004016105c2919061216a565b919050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152600060098381548110610df657610df6611e6a565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610e4357610e43611e6a565b60009182526020808320909101546001600160a01b0390811684528382018390529490941680825260058552604080832054818501529082526008909452929092205460609092019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610eef576000356001600160e01b0319166001604051620f948f60ea1b81526004016105c2929190612178565b565b60005b81811015610f3457610f2c838383818110610f1157610f11611e6a565b905060a00201803603810190610f279190612028565b611794565b600101610ef4565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c828260405161068a9291906120af565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115610f9c57610f9c612140565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115610fdd57610fdd612140565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6060611016600f610d3b565b6001600160a01b031663b261596f836040518263ffffffff1660e01b815260040161104191906121a6565b600060405180830381865afa15801561105e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106e591908101906121f2565b606081516001600160401b038111156110a1576110a1611e54565b6040519080825280602002602001820160405280156110ca578160200160208202803683370190505b50905060005b815181101561113e576111118382815181106110ee576110ee611e6a565b60200260200101516001600160a01b031660009081526005602052604090205490565b82828151811061112357611123611e6a565b602090810291909101015261113781611ee4565b90506110d0565b50919050565b60008082841115611176576040516387f6f09560e01b81526001600160e01b03196000351660048201526024016105c2565b50506001805460028054858455908490556004805493840190556040805183815260208101839052929391928592879290917f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b806001600160a01b03163b60000361121057604051630bfc64a360e21b81526001600160a01b03821660048201526024016105c2565b50565b61121c81610d3b565b6001600160a01b0316336001600160a01b031614611210576000356001600160e01b03191681336040516320e0f98d60e21b81526004016105c2939291906122a3565b600954600090815b818110156112c0576112a26009828154811061128557611285611e6a565b6000918252602090912001546001600160a01b0386811691161490565b156112ae579392505050565b806112b881611ee4565b915050611267565b5050919050565b6001600160a01b0381166000908152600560205260408120549081900361130c576040516349f748eb60e01b81526001600160a01b03831660048201526024016105c2565b60006113178361125f565b9050816003600082825461132b9190611f27565b90915550506001600160a01b038316600090815260086020908152604080832083905560059091528120556009805490611366600183611f27565b8154811061137657611376611e6a565b600091825260209091200154600980546001600160a01b0390921691849081106113a2576113a2611e6a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060098054806113e1576113e16122da565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a848154811061142057611420611e6a565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a611452600183611f27565b8154811061146257611462611e6a565b600091825260209091200154600a80546001600160a01b03909216918490811061148e5761148e611e6a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a8054806114cd576114cd6122da565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b6114fe81611945565b80516001600160a01b0316600090815260056020526040812054908190036115475781516040516349f748eb60e01b81526001600160a01b0390911660048201526024016105c2565b60095460005b818110156117085761158a6009828154811061156b5761156b611e6a565b60009182526020909120015485516001600160a01b0390811691161490565b156117005782600360008282546115a19190611f27565b90915550506060840151600380546000906115bd908490611efd565b9250508190555083602001516001600160a01b0316600a82815481106115e5576115e5611e6a565b6000918252602090912001546001600160a01b0316146116c0576020808501516001600160a01b03166000908152600690915260409020541561163b576040516346da180960e01b815260040160405180910390fd5b60066000600a838154811061165257611652611e6a565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a80548390811061169157611691611e6a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945593519484015190911681526006909252902055565b60010161154d565b50505050565b600061171a600f610d3b565b6040516303d1982560e61b81526001600160a01b038481166004830152919091169063f466094090602401600060405180830381865afa158015611762573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261178a9190810190612374565b6020015192915050565b6080810151156117b75760405163129c2ce160e31b815260040160405180910390fd5b6117c081611945565b80516001600160a01b03166000908152600560205260409020541561180657805160405163ada9a35360e01b81526001600160a01b0390911660048201526024016105c2565b6020808201516001600160a01b031660009081526006909152604090205415611853576020810151604051637f5e2f5960e11b81526001600160a01b0390911660048201526024016105c2565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a8054978801815588527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890960180549095169588169590951790935581519351861685526006835280852093909355855190941683526008905281204390559051600380549192909161193d908490611efd565b909155505050565b806060015160000361197857604051637f11b8a360e11b81526001600160e01b03196000351660048201526024016105c2565b60408051600380825260808201909252600091602082016060803683370190505090508160000151816000815181106119b3576119b3611e6a565b60200260200101906001600160a01b031690816001600160a01b0316815250508160200151816001815181106119eb576119eb611e6a565b60200260200101906001600160a01b031690816001600160a01b031681525050816040015181600281518110611a2357611a23611e6a565b60200260200101906001600160a01b031690816001600160a01b031681525050611a4c81611a78565b156103c457604051630d697db160e11b81526001600160e01b03196000351660048201526024016105c2565b60008151600003611a8b57506000919050565b60005b6001835103811015611b0e57600181015b8351811015611b0557838181518110611aba57611aba611e6a565b60200260200101516001600160a01b0316848381518110611add57611add611e6a565b60200260200101516001600160a01b031603611afd575060019392505050565b600101611a9f565b50600101611a8e565b50600092915050565b508054600082559060005260206000209081019061121091905b80821115611b455760008155600101611b31565b5090565b60008083601f840112611b5b57600080fd5b5081356001600160401b03811115611b7257600080fd5b60208301915083602060a083028501011115610ba957600080fd5b60008060208385031215611ba057600080fd5b82356001600160401b03811115611bb657600080fd5b611bc285828601611b49565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611c4d57611c3a838551611bce565b9284019260a09290920191600101611c27565b50909695505050505050565b6001600160a01b038116811461121057600080fd5b600060208284031215611c8057600080fd5b813561074781611c59565b60008083601f840112611c9d57600080fd5b5081356001600160401b03811115611cb457600080fd5b6020830191508360208260051b8501011115610ba957600080fd5b60008060208385031215611ce257600080fd5b82356001600160401b03811115611cf857600080fd5b611bc285828601611c8b565b6020808252825182820181905260009190848201906040850190845b81811015611c4d57835183529284019291840191600101611d20565b60008060008060608587031215611d5257600080fd5b84356001600160401b03811115611d6857600080fd5b611d7487828801611b49565b90989097506020870135966040013595509350505050565b803560108110610db157600080fd5b60008060408385031215611dae57600080fd5b611db783611d8c565b91506020830135611dc781611c59565b809150509250929050565b60008060408385031215611de557600080fd5b8235611db781611c59565b60008060408385031215611e0357600080fd5b50508035926020909101359150565b600060208284031215611e2457600080fd5b5035919050565b60a081016106e58284611bce565b600060208284031215611e4b57600080fd5b61074782611d8c565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600060018201611ef657611ef6611ece565b5060010190565b808201808211156106e5576106e5611ece565b80820281158282048414176106e5576106e5611ece565b818103818111156106e5576106e5611ece565b600082611f5757634e487b7160e01b600052601260045260246000fd5b500490565b60c08101611f6a8285611bce565b6001600160a01b039290921660a09190910152919050565b60208082528181018390526000908460408401835b86811015611fc5578235611faa81611c59565b6001600160a01b031682529183019190830190600101611f97565b509695505050505050565b60405160c081016001600160401b0381118282101715611ff257611ff2611e54565b60405290565b604051601f8201601f191681016001600160401b038111828210171561202057612020611e54565b604052919050565b600060a0828403121561203a57600080fd5b60405160a081018181106001600160401b038211171561205c5761205c611e54565b604052823561206a81611c59565b8152602083013561207a81611c59565b6020820152604083013561208d81611c59565b6040820152606083810135908201526080928301359281019290925250919050565b6020808252818101839052600090604080840186845b878110156121335781356120d881611c59565b6001600160a01b03908116845282860135906120f382611c59565b90811684870152828501359061210882611c59565b1683850152606082810135908401526080808301359084015260a092830192909101906001016120c5565b5090979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6010811061216657612166612140565b9052565b602081016106e58284612156565b6001600160e01b03198316815260408101600b831061219957612199612140565b8260208301529392505050565b6020808252825182820181905260009190848201906040850190845b81811015611c4d5783516001600160a01b0316835292840192918401916001016121c2565b8051610db181611c59565b6000602080838503121561220557600080fd5b82516001600160401b038082111561221c57600080fd5b818501915085601f83011261223057600080fd5b81518181111561224257612242611e54565b8060051b9150612253848301611ff8565b818152918301840191848101908884111561226d57600080fd5b938501935b83851015612297578451925061228783611c59565b8282529385019390850190612272565b98975050505050505050565b6001600160e01b031984168152606081016122c16020830185612156565b6001600160a01b03929092166040919091015292915050565b634e487b7160e01b600052603160045260246000fd5b600082601f83011261230157600080fd5b81516001600160401b0381111561231a5761231a611e54565b602061232e601f8301601f19168201611ff8565b828152858284870101111561234257600080fd5b60005b83811015612360578581018301518282018401528201612345565b506000928101909101919091529392505050565b60006020828403121561238657600080fd5b81516001600160401b038082111561239d57600080fd5b9083019060c082860312156123b157600080fd5b6123b9611fd0565b82516123c481611c59565b815260208301516123d481611c59565b602082015260408301516123e781611c59565b60408201526123f8606084016121e7565b6060820152612409608084016121e7565b608082015260a08301518281111561242057600080fd5b61242c878286016122f0565b60a0830152509594505050505056fea26469706673582212206d2b21c3330e8dd570a3e1f28604df1654a7715ea24a32adbd252de98c97f87564736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063a0c302a7116100de578063cc7e6b3b11610097578063db6693a211610071578063db6693a214610349578063de981f1b14610369578063e75235b814610394578063f09267c21461039f57600080fd5b8063cc7e6b3b146102ea578063d78392f8146102fd578063dafae4081461032657600080fd5b8063a0c302a71461026e578063a85c7d6e14610281578063b505a07c14610294578063b7f67e97146102a7578063b8cc3a50146102af578063b9c36209146102c257600080fd5b8063691845a911610130578063691845a9146102125780637c37103c146102255780637de5dedd14610238578063865e6fd314610240578063903bb3c51461025357806396c82e571461026657600080fd5b80630ed285df14610178578063150740051461018d57806329b6eca9146101ab5780632cccb53c146101be57806341feed1c146101de578063520fce62146101ff575b600080fd5b61018b610186366004611b8d565b6103b2565b005b6101956103c8565b6040516101a29190611c0b565b60405180910390f35b61018b6101b9366004611c6e565b610584565b6101d16101cc366004611ccf565b610696565b6040516101a29190611d04565b6101f16101ec366004611c6e565b6106eb565b6040519081526020016101a2565b6101d161020d366004611ccf565b610709565b6101f1610220366004611ccf565b61074e565b61018b610233366004611d3c565b6107ba565b6101f161089c565b61018b61024e366004611d9b565b6108d9565b6101f1610261366004611ccf565b6108f4565b6003546101f1565b61018b61027c366004611dd2565b610959565b61018b61028f366004611ccf565b610a29565b61018b6102a2366004611b8d565b610ac7565b6009546101f1565b6101f16102bd366004611c6e565b610b66565b6102d56102d0366004611df0565b610b8f565b604080519283526020830191909152016101a2565b6101d16102f8366004611ccf565b610bb0565b6101f161030b366004611c6e565b6001600160a01b031660009081526006602052604090205490565b610339610334366004611e12565b610c73565b60405190151581526020016101a2565b61035c610357366004611c6e565b610c9a565b6040516101a29190611e2b565b61037c610377366004611e39565b610d3b565b6040516001600160a01b0390911681526020016101a2565b6001546002546102d5565b61035c6103ad366004611e12565b610db6565b6103ba610e95565b6103c48282610ef1565b5050565b6009546060906001600160401b038111156103e5576103e5611e54565b60405190808252806020026020018201604052801561043e57816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816104035790505b5090506000805b825181101561057f576009818154811061046157610461611e6a565b9060005260206000200160009054906101000a90046001600160a01b031691508183828151811061049457610494611e6a565b60209081029190910101516001600160a01b039091169052600a8054829081106104c0576104c0611e6a565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104f0576104f0611e6a565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600083828151811061052857610528611e6a565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061056857610568611e6a565b602090810291909101015160600152600101610445565b505090565b600054600290610100900460ff161580156105a6575060005460ff8083169116105b6105cb5760405162461bcd60e51b81526004016105c290611e80565b60405180910390fd5b6000805461ffff191660ff8316176101001790556105ea600f83610f66565b60005b600b548110156106435760076000600b838154811061060e5761060e611e6a565b60009182526020808320909101546001600160a01b0316835282019290925260400181205561063c81611ee4565b90506105ed565b50610650600b6000611b17565b6000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b606060006106d684848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061100a92505050565b90506106e181611086565b9150505b92915050565b6001600160a01b0381166000908152600560205260408120546106e5565b606061074783838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061108692505050565b9392505050565b6000805b828110156107b3576005600085858481811061077057610770611e6a565b90506020020160208101906107859190611c6e565b6001600160a01b031681526020810191909152604001600020546107a99083611efd565b9150600101610752565b5092915050565b600054610100900460ff16158080156107da5750600054600160ff909116105b806107f45750303b1580156107f4575060005460ff166001145b6108105760405162461bcd60e51b81526004016105c290611e80565b6000805460ff191660011790558015610833576000805461ff0019166101001790555b8315610843576108438585610ef1565b61084d8383611144565b50508015610895576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600060025460016002546003546001546108b69190611f10565b6108c09190611efd565b6108ca9190611f27565b6108d49190611f3a565b905090565b6108e1610e95565b6108ea816111da565b6103c48282610f66565b6000805b828110156107b3576006600085858481811061091657610916611e6a565b905060200201602081019061092b9190611c6e565b6001600160a01b0316815260208101919091526040016000205461094f9083611efd565b91506001016108f8565b600f61096481611213565b600061096f8461125f565b9050826009828154811061098557610985611e6a565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055868316808352600580835260408085208054968a1686528186209690965560088452808520439055918452908320839055905290557faf495cd00cf8595e5fc29a082a18b71cad844d97ab40237b7405693a910c50a2610a0c82610db6565b85604051610a1b929190611f5c565b60405180910390a150505050565b610a31610e95565b6000819003610a53576040516316ee9d3b60e11b815260040160405180910390fd5b60005b81811015610a9557610a8d838383818110610a7357610a73611e6a565b9050602002016020810190610a889190611c6e565b6112c7565b600101610a56565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a7828260405161068a929190611f82565b610acf610e95565b6000819003610af1576040516316ee9d3b60e11b815260040160405180910390fd5b60005b81811015610b3457610b2c838383818110610b1157610b11611e6a565b905060a00201803603810190610b279190612028565b6114f5565b600101610af4565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda828260405161068a9291906120af565b60006106e5610b748361170e565b6001600160a01b031660009081526005602052604090205490565b600080610b9a610e95565b610ba48484611144565b915091505b9250929050565b6060816001600160401b03811115610bca57610bca611e54565b604051908082528060200260200182016040528015610bf3578160200160208202803683370190505b50905060005b81518110156107b35760066000858584818110610c1857610c18611e6a565b9050602002016020810190610c2d9190611c6e565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610c6057610c60611e6a565b6020908102919091010152600101610bf9565b6000600354600154610c859190611f10565b600254610c929084611f10565b101592915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052905b600954811015610d2157610d0360098281548110610ce657610ce6611e6a565b6000918252602090912001546001600160a01b0385811691161490565b15610d115761074781610db6565b610d1a81611ee4565b9050610cc6565b5060405163e57fdbef60e01b815260040160405180910390fd5b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115610d7257610d72612140565b60ff1681526020810191909152604001600020546001600160a01b0316905080610db1578160405163409140df60e11b81526004016105c2919061216a565b919050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152600060098381548110610df657610df6611e6a565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610e4357610e43611e6a565b60009182526020808320909101546001600160a01b0390811684528382018390529490941680825260058552604080832054818501529082526008909452929092205460609092019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610eef576000356001600160e01b0319166001604051620f948f60ea1b81526004016105c2929190612178565b565b60005b81811015610f3457610f2c838383818110610f1157610f11611e6a565b905060a00201803603810190610f279190612028565b611794565b600101610ef4565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c828260405161068a9291906120af565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115610f9c57610f9c612140565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115610fdd57610fdd612140565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6060611016600f610d3b565b6001600160a01b031663b261596f836040518263ffffffff1660e01b815260040161104191906121a6565b600060405180830381865afa15801561105e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106e591908101906121f2565b606081516001600160401b038111156110a1576110a1611e54565b6040519080825280602002602001820160405280156110ca578160200160208202803683370190505b50905060005b815181101561113e576111118382815181106110ee576110ee611e6a565b60200260200101516001600160a01b031660009081526005602052604090205490565b82828151811061112357611123611e6a565b602090810291909101015261113781611ee4565b90506110d0565b50919050565b60008082841115611176576040516387f6f09560e01b81526001600160e01b03196000351660048201526024016105c2565b50506001805460028054858455908490556004805493840190556040805183815260208101839052929391928592879290917f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b806001600160a01b03163b60000361121057604051630bfc64a360e21b81526001600160a01b03821660048201526024016105c2565b50565b61121c81610d3b565b6001600160a01b0316336001600160a01b031614611210576000356001600160e01b03191681336040516320e0f98d60e21b81526004016105c2939291906122a3565b600954600090815b818110156112c0576112a26009828154811061128557611285611e6a565b6000918252602090912001546001600160a01b0386811691161490565b156112ae579392505050565b806112b881611ee4565b915050611267565b5050919050565b6001600160a01b0381166000908152600560205260408120549081900361130c576040516349f748eb60e01b81526001600160a01b03831660048201526024016105c2565b60006113178361125f565b9050816003600082825461132b9190611f27565b90915550506001600160a01b038316600090815260086020908152604080832083905560059091528120556009805490611366600183611f27565b8154811061137657611376611e6a565b600091825260209091200154600980546001600160a01b0390921691849081106113a2576113a2611e6a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060098054806113e1576113e16122da565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a848154811061142057611420611e6a565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a611452600183611f27565b8154811061146257611462611e6a565b600091825260209091200154600a80546001600160a01b03909216918490811061148e5761148e611e6a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a8054806114cd576114cd6122da565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b6114fe81611945565b80516001600160a01b0316600090815260056020526040812054908190036115475781516040516349f748eb60e01b81526001600160a01b0390911660048201526024016105c2565b60095460005b818110156117085761158a6009828154811061156b5761156b611e6a565b60009182526020909120015485516001600160a01b0390811691161490565b156117005782600360008282546115a19190611f27565b90915550506060840151600380546000906115bd908490611efd565b9250508190555083602001516001600160a01b0316600a82815481106115e5576115e5611e6a565b6000918252602090912001546001600160a01b0316146116c0576020808501516001600160a01b03166000908152600690915260409020541561163b576040516346da180960e01b815260040160405180910390fd5b60066000600a838154811061165257611652611e6a565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a80548390811061169157611691611e6a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945593519484015190911681526006909252902055565b60010161154d565b50505050565b600061171a600f610d3b565b6040516303d1982560e61b81526001600160a01b038481166004830152919091169063f466094090602401600060405180830381865afa158015611762573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261178a9190810190612374565b6020015192915050565b6080810151156117b75760405163129c2ce160e31b815260040160405180910390fd5b6117c081611945565b80516001600160a01b03166000908152600560205260409020541561180657805160405163ada9a35360e01b81526001600160a01b0390911660048201526024016105c2565b6020808201516001600160a01b031660009081526006909152604090205415611853576020810151604051637f5e2f5960e11b81526001600160a01b0390911660048201526024016105c2565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a8054978801815588527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890960180549095169588169590951790935581519351861685526006835280852093909355855190941683526008905281204390559051600380549192909161193d908490611efd565b909155505050565b806060015160000361197857604051637f11b8a360e11b81526001600160e01b03196000351660048201526024016105c2565b60408051600380825260808201909252600091602082016060803683370190505090508160000151816000815181106119b3576119b3611e6a565b60200260200101906001600160a01b031690816001600160a01b0316815250508160200151816001815181106119eb576119eb611e6a565b60200260200101906001600160a01b031690816001600160a01b031681525050816040015181600281518110611a2357611a23611e6a565b60200260200101906001600160a01b031690816001600160a01b031681525050611a4c81611a78565b156103c457604051630d697db160e11b81526001600160e01b03196000351660048201526024016105c2565b60008151600003611a8b57506000919050565b60005b6001835103811015611b0e57600181015b8351811015611b0557838181518110611aba57611aba611e6a565b60200260200101516001600160a01b0316848381518110611add57611add611e6a565b60200260200101516001600160a01b031603611afd575060019392505050565b600101611a9f565b50600101611a8e565b50600092915050565b508054600082559060005260206000209081019061121091905b80821115611b455760008155600101611b31565b5090565b60008083601f840112611b5b57600080fd5b5081356001600160401b03811115611b7257600080fd5b60208301915083602060a083028501011115610ba957600080fd5b60008060208385031215611ba057600080fd5b82356001600160401b03811115611bb657600080fd5b611bc285828601611b49565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611c4d57611c3a838551611bce565b9284019260a09290920191600101611c27565b50909695505050505050565b6001600160a01b038116811461121057600080fd5b600060208284031215611c8057600080fd5b813561074781611c59565b60008083601f840112611c9d57600080fd5b5081356001600160401b03811115611cb457600080fd5b6020830191508360208260051b8501011115610ba957600080fd5b60008060208385031215611ce257600080fd5b82356001600160401b03811115611cf857600080fd5b611bc285828601611c8b565b6020808252825182820181905260009190848201906040850190845b81811015611c4d57835183529284019291840191600101611d20565b60008060008060608587031215611d5257600080fd5b84356001600160401b03811115611d6857600080fd5b611d7487828801611b49565b90989097506020870135966040013595509350505050565b803560108110610db157600080fd5b60008060408385031215611dae57600080fd5b611db783611d8c565b91506020830135611dc781611c59565b809150509250929050565b60008060408385031215611de557600080fd5b8235611db781611c59565b60008060408385031215611e0357600080fd5b50508035926020909101359150565b600060208284031215611e2457600080fd5b5035919050565b60a081016106e58284611bce565b600060208284031215611e4b57600080fd5b61074782611d8c565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600060018201611ef657611ef6611ece565b5060010190565b808201808211156106e5576106e5611ece565b80820281158282048414176106e5576106e5611ece565b818103818111156106e5576106e5611ece565b600082611f5757634e487b7160e01b600052601260045260246000fd5b500490565b60c08101611f6a8285611bce565b6001600160a01b039290921660a09190910152919050565b60208082528181018390526000908460408401835b86811015611fc5578235611faa81611c59565b6001600160a01b031682529183019190830190600101611f97565b509695505050505050565b60405160c081016001600160401b0381118282101715611ff257611ff2611e54565b60405290565b604051601f8201601f191681016001600160401b038111828210171561202057612020611e54565b604052919050565b600060a0828403121561203a57600080fd5b60405160a081018181106001600160401b038211171561205c5761205c611e54565b604052823561206a81611c59565b8152602083013561207a81611c59565b6020820152604083013561208d81611c59565b6040820152606083810135908201526080928301359281019290925250919050565b6020808252818101839052600090604080840186845b878110156121335781356120d881611c59565b6001600160a01b03908116845282860135906120f382611c59565b90811684870152828501359061210882611c59565b1683850152606082810135908401526080808301359084015260a092830192909101906001016120c5565b5090979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6010811061216657612166612140565b9052565b602081016106e58284612156565b6001600160e01b03198316815260408101600b831061219957612199612140565b8260208301529392505050565b6020808252825182820181905260009190848201906040850190845b81811015611c4d5783516001600160a01b0316835292840192918401916001016121c2565b8051610db181611c59565b6000602080838503121561220557600080fd5b82516001600160401b038082111561221c57600080fd5b818501915085601f83011261223057600080fd5b81518181111561224257612242611e54565b8060051b9150612253848301611ff8565b818152918301840191848101908884111561226d57600080fd5b938501935b83851015612297578451925061228783611c59565b8282529385019390850190612272565b98975050505050505050565b6001600160e01b031984168152606081016122c16020830185612156565b6001600160a01b03929092166040919091015292915050565b634e487b7160e01b600052603160045260246000fd5b600082601f83011261230157600080fd5b81516001600160401b0381111561231a5761231a611e54565b602061232e601f8301601f19168201611ff8565b828152858284870101111561234257600080fd5b60005b83811015612360578581018301518282018401528201612345565b506000928101909101919091529392505050565b60006020828403121561238657600080fd5b81516001600160401b038082111561239d57600080fd5b9083019060c082860312156123b157600080fd5b6123b9611fd0565b82516123c481611c59565b815260208301516123d481611c59565b602082015260408301516123e781611c59565b60408201526123f8606084016121e7565b6060820152612409608084016121e7565b608082015260a08301518281111561242057600080fd5b61242c878286016122f0565b60a0830152509594505050505056fea26469706673582212206d2b21c3330e8dd570a3e1f28604df1654a7715ea24a32adbd252de98c97f87564736f6c63430008130033", "devdoc": { "errors": { - "ErrBridgeVoterIsAlreadyAdded(address)": [ - { - "details": "Error indicating that a bridge voter has already been added.", - "params": { - "voter": "The address of the bridge voter that is already added." - } - } - ], "ErrConsensusAddressIsAlreadyAdded(address)": [ { "details": "Error indicating that a consensus address is already added.", @@ -857,6 +995,11 @@ } } ], + "ErrContractTypeNotFound(uint8)": [ + { + "details": "Error of invalid role." + } + ], "ErrDuplicated(bytes4)": [ { "details": "Error thrown when a duplicated element is detected in an array.", @@ -917,8 +1060,46 @@ "msgSig": "The function signature (bytes4) that the caller is unauthorized to perform." } } + ], + "ErrUnexpectedInternalCall(bytes4,uint8,address)": [ + { + "details": "Error indicating that the caller is unauthorized to perform a specific function.", + "params": { + "actual": "The actual address that called to the function.", + "expectedContractType": "The contract type required to perform the function.", + "msgSig": "The function signature (bytes4)." + } + } + ], + "ErrZeroCodeContract(address)": [ + { + "details": "Error of set to non-contract." + } ] }, + "events": { + "ConsensusAddressOfTrustedOrgChanged((address,address,address,uint256,uint256),address)": { + "details": "Emitted when the consensus address of a trusted organization is changed." + }, + "ContractUpdated(uint8,address)": { + "details": "Emitted when a contract is updated." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "ThresholdUpdated(uint256,uint256,uint256,uint256,uint256)": { + "details": "Emitted when the threshold is updated" + }, + "TrustedOrganizationsAdded((address,address,address,uint256,uint256)[])": { + "details": "Emitted when the trusted organization is added." + }, + "TrustedOrganizationsRemoved(address[])": { + "details": "Emitted when the trusted organization is removed." + }, + "TrustedOrganizationsUpdated((address,address,address,uint256,uint256)[])": { + "details": "Emitted when the trusted organization is updated." + } + }, "kind": "dev", "methods": { "addTrustedOrganizations((address,address,address,uint256,uint256)[])": { @@ -927,24 +1108,36 @@ "checkThreshold(uint256)": { "details": "Checks whether the `_voteWeight` passes the threshold." }, - "countTrustedOrganizations()": { + "countTrustedOrganization()": { "details": "Returns the number of trusted organizations." }, + "execChangeConsensusAddressForTrustedOrg(address,address)": { + "details": "Fallback function of `Profile-requestChangeConsensusAddress`. Requirements: - The caller must be the Profile contract. Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed." + }, "getAllTrustedOrganizations()": { "details": "Returns all of the trusted organizations." }, - "getBridgeVoterWeight(address)": { - "details": "Returns the weight of a bridge voter." - }, - "getBridgeVoterWeights(address[])": { - "details": "Returns the weights of a list of bridge voter addresses." - }, "getConsensusWeight(address)": { "details": "Returns the weight of a consensus." }, + "getConsensusWeightById(address)": { + "details": "Returns the weight of a consensus." + }, "getConsensusWeights(address[])": { "details": "Returns the weights of a list of consensus addresses." }, + "getConsensusWeightsById(address[])": { + "details": "Returns the weights of a list of consensus addresses." + }, + "getContract(uint8)": { + "details": "Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.", + "params": { + "contractType": "The role of the contract to retrieve." + }, + "returns": { + "contract_": "The address of the contract with the specified role." + } + }, "getGovernorWeight(address)": { "details": "Returns the weight of a governor." }, @@ -969,22 +1162,26 @@ "removeTrustedOrganizations(address[])": { "details": "Removes a list of addresses from the trusted organization. Requirements: - The method caller is admin. Emits the event `TrustedOrganizationRemoved` once an organization is removed.", "params": { - "_consensusAddrs": "The list of consensus addresses linked to corresponding trusted organization that to be removed." + "consensusAddrs": "The list of consensus addresses linked to corresponding trusted organization that to be removed." + } + }, + "setContract(uint8,address)": { + "details": "Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.", + "params": { + "addr": "The address of the contract to set.", + "contractType": "The role of the contract to set." } }, "setThreshold(uint256,uint256)": { "details": "Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event." }, - "sumBridgeVoterWeights(address[])": { - "details": "Returns total weights of the bridge voter list." - }, - "sumConsensusWeights(address[])": { + "sumConsensusWeight(address[])": { "details": "Returns total weights of the consensus list." }, - "sumGovernorWeights(address[])": { + "sumGovernorWeight(address[])": { "details": "Returns total weights of the governor list." }, - "totalWeights()": { + "totalWeight()": { "details": "Returns total weights." }, "updateTrustedOrganizations((address,address,address,uint256,uint256)[])": { @@ -992,15 +1189,15 @@ } }, "stateVariables": { - "_addedBlock": { - "details": "Mapping from consensus address => added block" - }, - "_bridgeVoterList": { + "__deprecatedBridgeVoterList": { "details": "Bridge voters array" }, - "_bridgeVoterWeight": { + "__deprecatedBridgeVoterWeight": { "details": "Mapping from bridge voter address => weight" }, + "_addedBlock": { + "details": "Mapping from consensus address => added block" + }, "_consensusList": { "details": "Consensus array" }, @@ -1024,7 +1221,7 @@ "storageLayout": { "storage": [ { - "astId": 1373, + "astId": 581, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_initialized", "offset": 0, @@ -1032,7 +1229,7 @@ "type": "t_uint8" }, { - "astId": 1376, + "astId": 584, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_initializing", "offset": 1, @@ -1040,7 +1237,7 @@ "type": "t_bool" }, { - "astId": 22307, + "astId": 5764, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_num", "offset": 0, @@ -1048,7 +1245,7 @@ "type": "t_uint256" }, { - "astId": 22309, + "astId": 5766, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_denom", "offset": 0, @@ -1056,7 +1253,7 @@ "type": "t_uint256" }, { - "astId": 22311, + "astId": 5768, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_totalWeight", "offset": 0, @@ -1064,7 +1261,7 @@ "type": "t_uint256" }, { - "astId": 22313, + "astId": 5770, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_nonce", "offset": 0, @@ -1072,15 +1269,15 @@ "type": "t_uint256" }, { - "astId": 22318, + "astId": 5776, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_consensusWeight", "offset": 0, "slot": "5", - "type": "t_mapping(t_address,t_uint256)" + "type": "t_mapping(t_userDefinedValueType(TConsensus)10745,t_uint256)" }, { - "astId": 22323, + "astId": 5781, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_governorWeight", "offset": 0, @@ -1088,31 +1285,31 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 22328, + "astId": 5786, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", - "label": "_bridgeVoterWeight", + "label": "__deprecatedBridgeVoterWeight", "offset": 0, "slot": "7", "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 22333, + "astId": 5792, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_addedBlock", "offset": 0, "slot": "8", - "type": "t_mapping(t_address,t_uint256)" + "type": "t_mapping(t_userDefinedValueType(TConsensus)10745,t_uint256)" }, { - "astId": 22337, + "astId": 5797, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_consensusList", "offset": 0, "slot": "9", - "type": "t_array(t_address)dyn_storage" + "type": "t_array(t_userDefinedValueType(TConsensus)10745)dyn_storage" }, { - "astId": 22341, + "astId": 5801, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_governorList", "offset": 0, @@ -1120,9 +1317,9 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 22345, + "astId": 5805, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", - "label": "_bridgeVoterList", + "label": "__deprecatedBridgeVoterList", "offset": 0, "slot": "11", "type": "t_array(t_address)dyn_storage" @@ -1140,6 +1337,12 @@ "label": "address[]", "numberOfBytes": "32" }, + "t_array(t_userDefinedValueType(TConsensus)10745)dyn_storage": { + "base": "t_userDefinedValueType(TConsensus)10745", + "encoding": "dynamic_array", + "label": "TConsensus[]", + "numberOfBytes": "32" + }, "t_bool": { "encoding": "inplace", "label": "bool", @@ -1152,6 +1355,13 @@ "numberOfBytes": "32", "value": "t_uint256" }, + "t_mapping(t_userDefinedValueType(TConsensus)10745,t_uint256)": { + "encoding": "mapping", + "key": "t_userDefinedValueType(TConsensus)10745", + "label": "mapping(TConsensus => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, "t_uint256": { "encoding": "inplace", "label": "uint256", @@ -1161,6 +1371,11 @@ "encoding": "inplace", "label": "uint8", "numberOfBytes": "1" + }, + "t_userDefinedValueType(TConsensus)10745": { + "encoding": "inplace", + "label": "TConsensus", + "numberOfBytes": "20" } } } diff --git a/deployments/ronin-testnet/RoninValidatorSetLogic.json b/deployments/ronin-testnet/RoninValidatorSetLogic.json index 1a23c02f7..9f0ebc7b7 100644 --- a/deployments/ronin-testnet/RoninValidatorSetLogic.json +++ b/deployments/ronin-testnet/RoninValidatorSetLogic.json @@ -1,5 +1,5 @@ { - "address": "0x6FE9CF3C8f1de99b1E368e941104d51561dF145d", + "address": "0xae55883e4155A2c216C4cBa9a84aC5910a17313b", "abi": [ { "inputs": [], @@ -77,7 +77,7 @@ "inputs": [ { "internalType": "address", - "name": "_candidateAdminAddr", + "name": "candidateAdminAddr", "type": "address" } ], @@ -136,6 +136,28 @@ "name": "ErrInvalidMinEffectiveDaysOnwards", "type": "error" }, + { + "inputs": [ + { + "internalType": "address", + "name": "cid", + "type": "address" + } + ], + "name": "ErrLockedFundMightBeRecycled", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "cid", + "type": "address" + } + ], + "name": "ErrLockedFundReleaseInfoNotFound", + "type": "error" + }, { "inputs": [], "name": "ErrNonExistentCandidate", @@ -414,7 +436,7 @@ { "indexed": true, "internalType": "address", - "name": "consensusAddr", + "name": "cid", "type": "address" }, { @@ -433,7 +455,7 @@ { "indexed": true, "internalType": "address", - "name": "consensusAddr", + "name": "cid", "type": "address" }, { @@ -906,7 +928,7 @@ { "indexed": true, "internalType": "address", - "name": "consensusAddr", + "name": "cid", "type": "address" }, { @@ -968,7 +990,7 @@ { "indexed": true, "internalType": "address", - "name": "validator", + "name": "cid", "type": "address" }, { @@ -1039,8 +1061,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_addr", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1058,13 +1080,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_addr", + "internalType": "TConsensus", + "name": "addr", "type": "address" }, { "internalType": "uint256", - "name": "_blockNum", + "name": "blockNum", "type": "uint256" } ], @@ -1082,8 +1104,8 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_addrList", + "internalType": "TConsensus[]", + "name": "consensusList", "type": "address[]" } ], @@ -1091,7 +1113,7 @@ "outputs": [ { "internalType": "bool[]", - "name": "_result", + "name": "", "type": "bool[]" } ], @@ -1101,8 +1123,27 @@ { "inputs": [ { - "internalType": "address", - "name": "_blockProducer", + "internalType": "address[]", + "name": "candidateIds", + "type": "address[]" + } + ], + "name": "checkManyJailedById", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1110,7 +1151,7 @@ "outputs": [ { "internalType": "bool", - "name": "_result", + "name": "", "type": "bool" } ], @@ -1120,13 +1161,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_blockProducer", + "internalType": "TConsensus", + "name": "consensus", "type": "address" }, { "internalType": "uint256", - "name": "_period", + "name": "period", "type": "uint256" } ], @@ -1134,7 +1175,7 @@ "outputs": [ { "internalType": "bool", - "name": "_result", + "name": "", "type": "bool" } ], @@ -1235,22 +1276,22 @@ "inputs": [ { "internalType": "address", - "name": "_candidateAdmin", + "name": "candidateAdmin", "type": "address" }, { "internalType": "address", - "name": "_consensusAddr", + "name": "cid", "type": "address" }, { "internalType": "address payable", - "name": "_treasuryAddr", + "name": "treasuryAddr", "type": "address" }, { "internalType": "uint256", - "name": "_commissionRate", + "name": "commissionRate", "type": "uint256" } ], @@ -1263,7 +1304,7 @@ "inputs": [ { "internalType": "address", - "name": "validatorAddr", + "name": "validatorId", "type": "address" }, { @@ -1281,16 +1322,34 @@ "inputs": [ { "internalType": "address", - "name": "_consensusAddr", + "name": "cid", "type": "address" }, { - "internalType": "uint256", - "name": "_secLeftToRevoke", - "type": "uint256" + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "execChangeAdminAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "cid", + "type": "address" + }, + { + "internalType": "TConsensus", + "name": "newConsensusAddr", + "type": "address" } ], - "name": "execEmergencyExit", + "name": "execChangeConsensusAddress", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1299,12 +1358,30 @@ "inputs": [ { "internalType": "address", - "name": "_consensusAddr", + "name": "cid", "type": "address" }, { "internalType": "address payable", - "name": "_recipient", + "name": "newTreasury", + "type": "address" + } + ], + "name": "execChangeTreasuryAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "cid", + "type": "address" + }, + { + "internalType": "address payable", + "name": "recipient", "type": "address" } ], @@ -1317,12 +1394,30 @@ "inputs": [ { "internalType": "address", - "name": "_consensusAddr", + "name": "cid", + "type": "address" + }, + { + "internalType": "uint256", + "name": "secLeftToRevoke", + "type": "uint256" + } + ], + "name": "execRequestEmergencyExit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "cid", "type": "address" }, { "internalType": "uint256", - "name": "_secsLeft", + "name": "secsLeft", "type": "uint256" } ], @@ -1335,17 +1430,17 @@ "inputs": [ { "internalType": "address", - "name": "_consensusAddr", + "name": "cid", "type": "address" }, { "internalType": "uint256", - "name": "_effectiveDaysOnwards", + "name": "effectiveDaysOnwards", "type": "uint256" }, { "internalType": "uint256", - "name": "_commissionRate", + "name": "commissionRate", "type": "uint256" } ], @@ -1358,7 +1453,7 @@ "inputs": [ { "internalType": "address", - "name": "validatorAddr", + "name": "validatorId", "type": "address" }, { @@ -1388,7 +1483,7 @@ "outputs": [ { "internalType": "address[]", - "name": "_result", + "name": "result", "type": "address[]" } ], @@ -1398,8 +1493,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_candidate", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1409,22 +1504,22 @@ "components": [ { "internalType": "address", - "name": "admin", + "name": "__shadowedAdmin", "type": "address" }, { - "internalType": "address", - "name": "consensusAddr", + "internalType": "TConsensus", + "name": "__shadowedConsensus", "type": "address" }, { "internalType": "address payable", - "name": "treasuryAddr", + "name": "__shadowedTreasury", "type": "address" }, { "internalType": "address", - "name": "______deprecatedbridgeOperatorAddr", + "name": "____deprecatedBridgeOperatorAddr", "type": "address" }, { @@ -1459,22 +1554,22 @@ "components": [ { "internalType": "address", - "name": "admin", + "name": "__shadowedAdmin", "type": "address" }, { - "internalType": "address", - "name": "consensusAddr", + "internalType": "TConsensus", + "name": "__shadowedConsensus", "type": "address" }, { "internalType": "address payable", - "name": "treasuryAddr", + "name": "__shadowedTreasury", "type": "address" }, { "internalType": "address", - "name": "______deprecatedbridgeOperatorAddr", + "name": "____deprecatedBridgeOperatorAddr", "type": "address" }, { @@ -1494,7 +1589,7 @@ } ], "internalType": "struct ICandidateManager.ValidatorCandidate[]", - "name": "_list", + "name": "list", "type": "tuple[]" } ], @@ -1504,8 +1599,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_candidate", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1554,8 +1649,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1585,8 +1680,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_addr", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1614,8 +1709,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_addr", + "internalType": "TConsensus", + "name": "consensus", "type": "address" }, { @@ -1677,7 +1772,7 @@ "outputs": [ { "internalType": "address[]", - "name": "_validatorList", + "name": "validatorList_", "type": "address[]" } ], @@ -1776,7 +1871,20 @@ "inputs": [ { "internalType": "address", - "name": "_addr", + "name": "profileContract", + "type": "address" + } + ], + "name": "initializeV4", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -1794,13 +1902,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_candidate", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "address", - "name": "_admin", + "name": "admin", "type": "address" } ], @@ -1831,8 +1939,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_addr", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -1960,7 +2068,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_emergencyExitLockedAmount", + "name": "amount", "type": "uint256" } ], @@ -1973,7 +2081,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_emergencyExpiryDuration", + "name": "duration", "type": "uint256" } ], @@ -2047,7 +2155,7 @@ "outputs": [ { "internalType": "uint256", - "name": "_total", + "name": "total", "type": "uint256" } ], @@ -2116,39 +2224,39 @@ "type": "receive" } ], - "transactionHash": "0x945d4a927e8f85943750621ec5cee55c12b5994c743e754e9c5d300591bc7d71", + "transactionHash": "0x93fe52124812b4ac63df8b5909c6ef418af3a7abc832c6a8b2a46726338a9b58", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x6FE9CF3C8f1de99b1E368e941104d51561dF145d", + "contractAddress": "0xae55883e4155A2c216C4cBa9a84aC5910a17313b", "transactionIndex": 0, - "gasUsed": "4337840", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3145771c63567d9fcec9419993eeed6edb8259bc6ef7665c82f7ea86686c5977", - "transactionHash": "0x945d4a927e8f85943750621ec5cee55c12b5994c743e754e9c5d300591bc7d71", + "gasUsed": "4637533", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000", + "blockHash": "0xc975688babc2f0a3ae5aca96845f093357b4a8216b62759da557a746a6968622", + "transactionHash": "0x93fe52124812b4ac63df8b5909c6ef418af3a7abc832c6a8b2a46726338a9b58", "logs": [ { "transactionIndex": 0, - "blockNumber": 20128237, - "transactionHash": "0x945d4a927e8f85943750621ec5cee55c12b5994c743e754e9c5d300591bc7d71", - "address": "0x6FE9CF3C8f1de99b1E368e941104d51561dF145d", + "blockNumber": 21941094, + "transactionHash": "0x93fe52124812b4ac63df8b5909c6ef418af3a7abc832c6a8b2a46726338a9b58", + "address": "0xae55883e4155A2c216C4cBa9a84aC5910a17313b", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0x3145771c63567d9fcec9419993eeed6edb8259bc6ef7665c82f7ea86686c5977" + "blockHash": "0xc975688babc2f0a3ae5aca96845f093357b4a8216b62759da557a746a6968622" } ], - "blockNumber": 20128237, - "cumulativeGasUsed": "4337840", + "blockNumber": 21941094, + "cumulativeGasUsed": "4637533", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 12, - "solcInputHash": "620e7fce96c816676611b10f2eff3c99", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedEmergencyExit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedRevokingCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedUpdatingCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyWrappedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAtEndOfEpochOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeCoinbase\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ErrCannotBailout\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExceedsMaxNumberOfCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdminAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentCandidateAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasuryAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentTreasury\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sendAmount\",\"type\":\"uint256\"}],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaxPrioritizedValidatorNumber\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMinEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTrustedOrgCannotRenounce\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnauthorizedReceiveRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonExistentRecyclingInfo\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"BlockProducerSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum ICoinbaseExecution.BlockRewardDeprecatedType\",\"name\":\"deprecatedType\",\"type\":\"uint8\"}],\"name\":\"BlockRewardDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submittedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bonusAmount\",\"type\":\"uint256\"}],\"name\":\"BlockRewardSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"CandidateGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"}],\"name\":\"CandidateRevokingTimestampUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"name\":\"CandidateTopupDeadlineUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"CandidatesRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdateScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycleFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleasingFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExpiryDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FastFinalityRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"FastFinalityRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxPrioritizedValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorCandidateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numOfDays\",\"type\":\"uint256\"}],\"name\":\"MinEffectiveDaysOnwardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"StakingRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailedUntil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deductedStakingAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"blockProducerRewardDeprecated\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"bridgeOperatorRewardDeprecated\",\"type\":\"bool\"}],\"name\":\"ValidatorPunished\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"ValidatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"ValidatorUnjailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"periodNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"periodEnding\",\"type\":\"bool\"}],\"name\":\"WrappedUpEpoch\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"checkJailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"checkJailedAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"}],\"name\":\"checkManyJailed\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"}],\"name\":\"checkMiningRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkMiningRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriodStartAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExitLockedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochEndingAt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"execBailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secLeftToRevoke\",\"type\":\"uint256\"}],\"name\":\"execEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_recipient\",\"type\":\"address\"}],\"name\":\"execReleaseLockedFundForEmergencyExitRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secsLeft\",\"type\":\"uint256\"}],\"name\":\"execRequestRenounceCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execRequestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newJailedUntil\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"cannotBailout\",\"type\":\"bool\"}],\"name\":\"execSlash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockProducers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"______deprecatedbridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCandidateInfos\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"______deprecatedbridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCommissionChangeSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.CommissionSchedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getEmergencyExitInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"recyclingAt\",\"type\":\"uint256\"}],\"internalType\":\"struct ICommonInfo.EmergencyExitInfo\",\"name\":\"_info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getJailedTimeLeft\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"getJailedTimeLeftAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastUpdatedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorCandidates\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorList\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__slashIndicatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingVestingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorCandidate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxPrioritizedValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__minEffectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__numberOfBlocksInEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256[2]\",\"name\":\"__emergencyExitConfigs\",\"type\":\"uint256[2]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"fastFinalityTrackingContract\",\"type\":\"address\"}],\"name\":\"initializeV3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isBlockProducer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"isCandidateAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPeriodEnding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidatorCandidate\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPrioritizedValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumPrioritizedValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorCandidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minEffectiveDaysOnward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfBlocksInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompilePickValidatorSetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileSortValidatorsAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExitLockedAmount\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExitLockedAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExpiryDuration\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxPrioritizedValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_max\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numOfDays\",\"type\":\"uint256\"}],\"name\":\"setMinEffectiveDaysOnwards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"submitBlockReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBlockProducer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDeprecatedReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"tryGetPeriodOfEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_filled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_periodNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrapUpEpoch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyRequestedEmergencyExit()\":[{\"details\":\"Error of already requested emergency exit before.\"}],\"ErrAlreadyRequestedRevokingCandidate()\":[{\"details\":\"Error of already requested revoking candidate before.\"}],\"ErrAlreadyRequestedUpdatingCommissionRate()\":[{\"details\":\"Error of commission change schedule exists.\"}],\"ErrAlreadyWrappedEpoch()\":[{\"details\":\"Error of query for already wrapped up epoch\"}],\"ErrAtEndOfEpochOnly()\":[{\"details\":\"Error of only allowed at the end of epoch\"}],\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeCoinbase()\":[{\"details\":\"Error of method caller must be coinbase\"}],\"ErrCannotBailout(address)\":[{\"details\":\"Error of cannot bailout due to high tier slash.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrExceedsMaxNumberOfCandidate()\":[{\"details\":\"Error of exceeding maximum number of candidates.\"}],\"ErrExistentCandidate()\":[{\"details\":\"Error of querying for already existent candidate.\"}],\"ErrExistentCandidateAdmin(address)\":[{\"details\":\"Error of candidate admin already exists.\"}],\"ErrExistentTreasury(address)\":[{\"details\":\"Error of treasury already exists.\"}],\"ErrInsufficientBalance(bytes4,uint256,uint256)\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of invalid commission rate.\"}],\"ErrInvalidEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid effective days onwards.\"}],\"ErrInvalidMaxPrioritizedValidatorNumber()\":[{\"details\":\"Error thrown when an invalid maximum prioritized validator number is provided.\"}],\"ErrInvalidMinEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid min effective days onwards.\"}],\"ErrNonExistentCandidate()\":[{\"details\":\"Error of querying for non-existent candidate.\"}],\"ErrRecipientRevert(bytes4)\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrTrustedOrgCannotRenounce()\":[{\"details\":\"Error of trusted org cannot renounce.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnauthorizedReceiveRON()\":[{\"details\":\"Error thrown when receives RON from neither staking vesting contract nor staking contract\"}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}],\"NonExistentRecyclingInfo()\":[{\"details\":\"Error thrown when queries for a non existent info.\"}]},\"kind\":\"dev\",\"methods\":{\"checkJailed(address)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\"},\"checkJailedAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\"},\"checkManyJailed(address[])\":{\"details\":\"Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\"},\"checkMiningRewardDeprecated(address)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during the current period.\"},\"checkMiningRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during a specific period.\"},\"currentPeriod()\":{\"details\":\"Returns the period index from the current block.\"},\"currentPeriodStartAtBlock()\":{\"details\":\"Returns the block number that the current period starts at.\"},\"emergencyExitLockedAmount()\":{\"details\":\"Returns the amount of RON to lock from a consensus address.\"},\"emergencyExpiryDuration()\":{\"details\":\"Returns the duration that an emergency request is expired and the fund will be recycled.\"},\"epochEndingAt(uint256)\":{\"details\":\"Returns whether the epoch ending is at the block number `_block`.\"},\"epochOf(uint256)\":{\"details\":\"Returns the epoch index from the block number.\"},\"execApplyValidatorCandidate(address,address,address,uint256)\":{\"details\":\"Grants a validator candidate. Requirements: - The method caller is staking contract. Emits the event `CandidateGranted`.\"},\"execBailOut(address,uint256)\":{\"details\":\"Finalize the bailout request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorUnjailed`.\"},\"execEmergencyExit(address,uint256)\":{\"details\":\"Fallback function of `IStaking-requestEmergencyExit`. Requirements: - The method caller is staking contract.\"},\"execReleaseLockedFundForEmergencyExitRequest(address,address)\":{\"details\":\"Unlocks fund for emergency exit request. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked. Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\"},\"execRequestRenounceCandidate(address,uint256)\":{\"details\":\"Requests to revoke a validator candidate in next `_secsLeft` seconds. Requirements: - The method caller is staking contract. Emits the event `CandidateRevokingTimestampUpdated`.\"},\"execRequestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Fallback function of `CandidateStaking-requestUpdateCommissionRate`. Requirements: - The method caller is the staking contract. - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdateScheduled`.\"},\"execSlash(address,uint256,uint256,bool)\":{\"details\":\"Finalize the slash request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorPunished`.\"},\"getBlockProducers()\":{\"details\":\"Returns the current block producer list.\"},\"getCandidateInfo(address)\":{\"details\":\"Returns the info of a candidate.\"},\"getCandidateInfos()\":{\"details\":\"Returns all candidate info.\"},\"getCommissionChangeSchedule(address)\":{\"details\":\"Returns the schedule of changing commission rate of a candidate address.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getEmergencyExitInfo(address)\":{\"details\":\"Returns the emergency exit request.\"},\"getJailedTimeLeft(address)\":{\"details\":\"Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\"},\"getJailedTimeLeftAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\"},\"getLastUpdatedBlock()\":{\"details\":\"Returns the block that validator set was updated.\"},\"getValidatorCandidates()\":{\"details\":\"Returns the validator candidate.\"},\"getValidators()\":{\"details\":\"Returns the current validator list.\"},\"initialize(address,address,address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256[2])\":{\"details\":\"Initializes the contract storage.\"},\"isBlockProducer(address)\":{\"details\":\"Returns whether the address is block producer or not.\"},\"isCandidateAdmin(address,address)\":{\"details\":\"Returns whether the address is the candidate admin.\"},\"isPeriodEnding()\":{\"details\":\"Returns whether the period ending at the current block number.\"},\"isValidatorCandidate(address)\":{\"details\":\"Returns whether the address is a validator (candidate).\"},\"maxPrioritizedValidatorNumber()\":{\"details\":\"Returns the number of reserved slots for prioritized validators.\"},\"maxValidatorCandidate()\":{\"details\":\"Returns the maximum number of validator candidate.\"},\"maxValidatorNumber()\":{\"details\":\"Returns the maximum number of validators in the epoch.\"},\"minEffectiveDaysOnward()\":{\"details\":\"Returns the minimum number of days to the effective date of commission rate change.\"},\"numberOfBlocksInEpoch()\":{\"details\":\"Returns the number of blocks in a epoch.\"},\"precompilePickValidatorSetAddress()\":{\"details\":\"Gets the address of the precompile of picking validator set\"},\"precompileSortValidatorsAddress()\":{\"details\":\"Gets the address of the precompile of sorting validators\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setEmergencyExitLockedAmount(uint256)\":{\"details\":\"Sets the amount of RON to lock from a consensus address. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedAmountUpdated`.\"},\"setEmergencyExpiryDuration(uint256)\":{\"details\":\"Sets the duration that an emergency request is expired and the fund will be recycled. Requirements: - The method caller is admin. Emits the event `EmergencyExpiryDurationUpdated`.\"},\"setMaxPrioritizedValidatorNumber(uint256)\":{\"details\":\"Updates the number of reserved slots for prioritized validators Requirements: - The method caller is admin Emits the event `MaxPrioritizedValidatorNumberUpdated`\"},\"setMaxValidatorCandidate(uint256)\":{\"details\":\"Sets the maximum number of validator candidate. Requirements: - The method caller is admin. Emits the `MaxValidatorCandidateUpdated` event.\"},\"setMaxValidatorNumber(uint256)\":{\"details\":\"Updates the max validator number Requirements: - The method caller is admin Emits the event `MaxValidatorNumberUpdated`\"},\"setMinEffectiveDaysOnwards(uint256)\":{\"details\":\"Sets the minimum number of days to the effective date of commision rate change. Requirements: - The method caller is admin. Emits the `MinEffectiveDaysOnwardsUpdated` event.\"},\"submitBlockReward()\":{\"details\":\"Submits reward of the current block. Requirements: - The method caller is coinbase. Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer. Emits the event `BlockRewardSubmitted` for the valid call.\"},\"totalBlockProducer()\":{\"details\":\"Returns total numbers of the block producers.\"},\"totalDeprecatedReward()\":{\"details\":\"Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\"},\"tryGetPeriodOfEpoch(uint256)\":{\"details\":\"Tries to get the period index from the epoch number.\"},\"wrapUpEpoch()\":{\"details\":\"Wraps up the current epoch. Requirements: - The method must be called when the current epoch is ending. - The epoch is not wrapped yet. - The method caller is coinbase. Emits the event `MiningRewardDistributed` when some validator has reward distributed. Emits the event `StakingRewardDistributed` when some staking pool has reward distributed. Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up. Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending. Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated. Emits the event `WrappedUpEpoch`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/validator/RoninValidatorSet.sol\":\"RoninValidatorSet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://383fb7b8181016ac5ccf07bc9cdb7c1b5045ea36e2cc4df52bcbf20396fc7688\",\"dweb:/ipfs/QmYJ7Cg4WmE3rR8KGQxjUCXFfTH6TcwZ2Z1f6tPrq7jHFr\"]},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://96b6d77a20bebd4eb06b801d3d020c7e82be13bd535cb0d0a6b7181c51dab5d5\",\"dweb:/ipfs/QmPUR9Cv9jNFdQX6PtBfaBW1ZCnKwiu65R2VD5kbdanDyn\"]},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://89c2a0f70157c13845be5cb49b078a6374fee3a78fa950052a3af26190255da8\",\"dweb:/ipfs/QmUcvMEQH1oMM2pUyMuDiBUKdvvnTz1NRB8bmPHrVq8725\"]},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8831721b6f4cc26534d190f9f1631c3f59c9ff38efdd911f85e0882b8e360472\",\"dweb:/ipfs/QmQZnLErZNStirSQ13ZNWQgvEYUtGE5tXYwn4QUPaVUfPN\"]},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ada1e030c0231db8d143b44ce92b4d1158eedb087880cad6d8cc7bd7ebe7b354\",\"dweb:/ipfs/QmWZ2NHZweRpz1U9GF6R1h65ri76dnX7fNxLBeM2t5N5Ce\"]},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a6c4477d480bac20d681ade0e712b77ad828acf530a1d5c0abc5fb78068a05a1\",\"dweb:/ipfs/QmdBqsK8CcUceTeWzhHwFDEvKMoHimwtV96Lbim7ZBtCb8\"]},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3313a8f9bb1f9476857c9050067b31982bf2140b83d84f3bc0cec1f62bbe947f\",\"dweb:/ipfs/Qma17Pk8NRe7aB4UD3jjVxk7nSFaov3eQyv86hcyqkwJRV\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35c47bece3c03caaa07fab37dd2bb3413bfbca20db7bd9895024390e0a469487\",\"dweb:/ipfs/QmPGWT2x3QHcKxqe6gRmAkdakhbaRgx3DLzcakHz5M4eXG\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://39e096c60a6eb1c6a257122d515496bd92d0c6a693a8f07acb6aa4b1263e95d4\",\"dweb:/ipfs/QmPs5trJBacCiSkezP6tpevapuRYWNY6mqSFzsMCJj7e6B\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/extensions/RONTransferHelper.sol\":{\"keccak256\":\"0xdece837caa8da00fe031b8139ada009330b8bef149af12b535913c021ab94d0e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11af5018dd76ccfca6c4cfb886019987d88830c02efcec999c02d3e6d907475a\",\"dweb:/ipfs/QmNyEcRDvrCENivjdmw3TxMFDBcQNvEUzHorra7HkERLWf\"]},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://370c93bc1e962fcf8eab41d217d901716769f05c51a2cb25aae12abc84e871da\",\"dweb:/ipfs/QmQYL5QrJmXCdi5UN9K7imt1iPm9ydZQm6ifShpt451afd\"]},\"contracts/extensions/collections/HasContracts.sol\":{\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b8903232a7a609b250a1ff2e9522a2366979652145af74637f9c0089916e3da3\",\"dweb:/ipfs/QmVoxZamJEhjYhr9RKVSAKGzakgqmFLfZXhZcDGor7DZe5\"]},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2e220c59eb50b4e206d0a126f8cd2f7f2aa6865f56a0b4b091149e6928bf97b8\",\"dweb:/ipfs/QmRBk5hhn1w2MghZ8pRfaU1CvgRAZN7nZvxySSPDvkVuGp\"]},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://23a7906515d4648b243fb01f8053b1595e8c1c62fa9745b56ed296372da6ebdf\",\"dweb:/ipfs/QmdUjefqn52Hu7bjAKYJMRanPy7fdKqJAtnqSB2793Zhfm\"]},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e97f64c7f3522d605c5e8d6d96d568e0b8cb6b2f21cc288d508cbe43b831f5d9\",\"dweb:/ipfs/QmT9hBanREurnngznkfTAhHu4qDQu3F3hPXTzKgKjSWz7r\"]},\"contracts/interfaces/IFastFinalityTracking.sol\":{\"keccak256\":\"0xdc397642692af9710314e971f8de772d50d6bc304db9e5babd9ffcfb9d2f4434\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f43513532d979a1c4ff09c5b7b5b0b85ce19317e06d36a5b0215591f7d1f821\",\"dweb:/ipfs/QmQKKnarmdrYuoMAiA5aR1PJFCXnMrqgMm77oQU6mSVQVw\"]},\"contracts/interfaces/IMaintenance.sol\":{\"keccak256\":\"0xe30d31be54b9f9044c6a5d1393f04f9093d619a705d00276359853a086a91e8a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c2a0a4d97e3f10107822b10b758d85e1cbc311a940efcd7164c9c17e2e740cfc\",\"dweb:/ipfs/QmQdmGBJrt8ZmyivKGArrZmkaKPXg6HxWdxTiMpXGSpPev\"]},\"contracts/interfaces/IQuorum.sol\":{\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a8c81134e4632e1240aead39fd5393b376a4be53668caf2a390f511f3c6d422d\",\"dweb:/ipfs/QmWPaQPP1WkpdPjLhK7wFXsih8HWs6kRQqjX5zGLu6McGH\"]},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"keccak256\":\"0x4ee85b5dc2b33068bc7cbe168ae26328a6459f98c558aba5d9e5a1d6aead0da8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2a3f3608d19c73d5b60a22317fa0594778aad515a6d9c5dc5b7bad8f5ac1f4f9\",\"dweb:/ipfs/QmYTPxJJGG9oycJDupSRv6YQaS8k3GuA46LmVZ3tStTpg2\"]},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"keccak256\":\"0x2eaef3332e209474b24574aeded61091e82a145fcbcf479577535c0cd210e1e5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5f65e26ad439a457865e4312e547bba57111b7b7b13ca6547b42647c7ae21e29\",\"dweb:/ipfs/Qme293o5nFv77wvHvgmRtxSkjFHhFWQhDDD3FQTqAtkgd3\"]},\"contracts/interfaces/IStakingVesting.sol\":{\"keccak256\":\"0xdf4e372179731e859e564988eba09fda97810aeda1fec2b84c8abdaa6e1a5912\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://469644e6ce6d573dadb2462235033be7b656a15363f3249fe03d4bd4dec75fe4\",\"dweb:/ipfs/Qmau5A3ALkEtcYQM8rT9uRHQgsAgmTGfcj8uq596zr7NmH\"]},\"contracts/interfaces/collections/IHasContracts.sol\":{\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://03390ff29b496e244faf4eab55565712f0aea5fecdcb915e3c5866ef29d5686d\",\"dweb:/ipfs/QmdGpXn3VSxfNvjFBxfho7rc41JTq5m6bonrfmpzShhRVs\"]},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f158da03631d0e3c4558a18fc50e7f2416172983cfbb14a158dd4fc7c83c7053\",\"dweb:/ipfs/QmX8Vq2sKEAckrMEN5W5LaUzE7ppdaR7scv8amyV1YEXGG\"]},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"keccak256\":\"0x2e09934977e0701a28b7f776f0bd4eefdfd8d6b68134822440b2c756b6b7d1e4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e6dad2674e816cc50055f86b36321aa00c786e0f729961a812486ad86990ca98\",\"dweb:/ipfs/QmTZLuEScB3rRjDN7VVpp3LUhRbQyKyfXwvMMwQehxjGcj\"]},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"keccak256\":\"0x26021ddf339495816692ea9f8545b4054d0ffb9c5ad11049cac4f3718a0bbc2d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://78be72af4c66b1156e34285cebbe996c9e12a1dddc7064ba19dc31c9ca29f04a\",\"dweb:/ipfs/QmQc6Qziq8FK22pHezjNK6anUpdRtLyTnUfbiYdo7KBFDT\"]},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"keccak256\":\"0x3ea38604baf3bc5a12dd1a243eec2052de9ee2cb171222a2e5b0e5202d301471\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://efe7768c54473cdd7ea25abf571302059266a7aeff5a29bada77ac1364b0af0c\",\"dweb:/ipfs/QmfXxeWbvybKEb13wBBJgmYT1N9p7txEGnZPPKNwP1AhHL\"]},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"keccak256\":\"0x89751cbf99adf7dbd165fbbba5d6b62b5c47f8486322a7abb27d6d6aef345fae\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4d3d95b75ae204e2d7734590f9ae2adfec28e786c981a990157888ca9bc0a9b8\",\"dweb:/ipfs/QmSeRfhkrHiN1CNFQWZbVLvfPFw4jJQg8sm6uK1PLMcsvg\"]},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"keccak256\":\"0xb1adb41d0b1c8a362b7e669d9975754adbd4ed0f8de912e8455fa70eedd80d35\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c08e156297b5a18128eac2dbbf47131d7122f8a67e733bdd5c1bd297a3e7ec37\",\"dweb:/ipfs/QmVh6cLdB1g1uRJb7C7SVfhWYarSFnWp6qG6maADYrpTaC\"]},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7c457aec7776026962e2a9e606f6b4bb76de6c4407ff5ca0197348c3a991612e\",\"dweb:/ipfs/QmPGBqNCqkUFvcktSryxS99Apzqq6MZF7S28hVrockzanS\"]},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"keccak256\":\"0x458a7ae130a59b59b7f095fe3d4db8f779e0614041e5615f0afd36c543ac2046\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://947dcfcf74803babe38e80b37d234796cda3831a2f19936e98a0954c3936ee0e\",\"dweb:/ipfs/QmQW8ux3awTt8BNH6NnWtPNSBvWTA36wR35bTj1Eymx1D6\"]},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"keccak256\":\"0x90517268a0e31147d97772c9ae518caa5eb8c03efe3b369e3c6d5166422f5962\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cb491a0f017e3426a4c96344e65a1e3f26603759758159c8a75b731029a574d9\",\"dweb:/ipfs/QmTQ6jhx6pzzPdubogP5ktSyrhg5PspbCVaQaeHS4AJDg7\"]},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"keccak256\":\"0x9bc6ba6d13f00d9928c0add35ee6406906e16ed86207d373460930c0a75e5938\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://36091a688331967fbfff2890250653dc15906bf0f7bad1fe4019fb7db6c8a44f\",\"dweb:/ipfs/Qme2NLnJHrwa9pWA2aJevECkpgoN83EJFMofcJEhL24DN9\"]},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"keccak256\":\"0x6dd71bf0c17a65da0dee49b98e4b038c1dd0e74f5473d03570421ceebd5b7084\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c4b494d452bdfd70169edbc8fe348ccde87b626fa3eda23af15cf9b4c2287f51\",\"dweb:/ipfs/QmZ1EiHHUWE1ATTSoYs2iKQLw5YTV7zpQ9zBU6SNFUTAFP\"]},\"contracts/interfaces/staking/IRewardPool.sol\":{\"keccak256\":\"0x52349fecb897b3b8288d8732923551382822c0c5fb8db9c6b094d080a16a2129\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://67c0c9c2a736e1ba3bf329edef9d7d675dc86a5efe569fe49f9611896acd0667\",\"dweb:/ipfs/Qmc31DL6bovfqbdRb4a3Cqg1Gge8mC82Q43uh2HmS7YGvT\"]},\"contracts/interfaces/staking/IStaking.sol\":{\"keccak256\":\"0xd302d4a78203e277fb95a89de7ae32a3102129d3fbd64fc75f92d18be0443408\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed162378c575055c0dff266b578780d3799613cf7912c0adb7428e35f70231f\",\"dweb:/ipfs/QmbnSRJwU3jee9zcvW12cYRuGpqThtx9zHzpGPQdsp6sNy\"]},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"keccak256\":\"0x97dae7e2ed43c21c48200581501bfa065c7836299306ba2e7f39896c3a22ef2d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1f26f12846961c93a302c912ef9534948e75d1712e9861361d6e4869067f74e3\",\"dweb:/ipfs/QmaQEiTdfFT9CbQEhMyvrEtPgiQUqdY2hZjAS3LUaVoGns\"]},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e6c058176001fdf5c3568e3bef95dbd0616f29136f6488457bac313b49cf8307\",\"dweb:/ipfs/QmYCxycKBcX815zGkXPDBC3t2CgqJwZNHcvtKA9ssc4fMq\"]},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://06091b25304096f52e46fa2f5c693e5dcf30697cb4f25e6eac075a7daea2f2cd\",\"dweb:/ipfs/QmQxNvAdqydyWCjQt3gfXXB8a5dAiLZgCdiJQCtM7Ah19b\"]},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e858204fc0e1f733b3b8482326a52fb150eb6c657881b7f2a7721d52826f7e4f\",\"dweb:/ipfs/QmboahnNNTeXjcELXsWZUq93wyvQQRMbimm27xDta85wEc\"]},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"keccak256\":\"0xac0b772f2fca9dafd7cc6742f91b442f9f545bf9472185b8d817fe045b680193\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://eac6d51b093831c768d7ef2b17a01333f4aca4c419a593c8b2690db132a06f4a\",\"dweb:/ipfs/QmYZEfUKfmbREoTukK2sic686yABpFmcQTn3x75kjtVj58\"]},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"keccak256\":\"0x3fdfa86da33b889e5153075ffc028d6b0c607480a96b532fbbbc48ac7bbf27c9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8c586009b6c57b4e0daf60123bf4b133a91a42a1d803c332ba0bdaecab871f18\",\"dweb:/ipfs/QmUT8bLX8MfVjLBs1pXEYXFob5YtAq9tEGBz3KV1WKac4B\"]},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"keccak256\":\"0x2b1846b05ca1d636299fb929c1bd7b392b236f5e3f7aa3e7eea2c6d57b8836fb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db41b9c12cde1d32f060db3b81eeee93a512cf0188aadfa9e262d9cc15714ef8\",\"dweb:/ipfs/QmfJkTv1kpfbHtz2hQiWhBZN1r725YAnZMHo71gmgQ4J43\"]},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a0c87e2e9c661730fdecd3cacc54a630ac2dfd35218dcbe41b70bb15d16aea2\",\"dweb:/ipfs/QmcLD62ZZ6YVSECvx7515PVXymbP8SRwayZsy6r4NAiPLJ\"]},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"keccak256\":\"0x6823181ac93ea3320e6ebfb456624afda59ac2acb480de5c774783983c8f4749\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a7ac5190b26cd4d6984da11578842b7b5c5230f5c7acd89ac6194df149f033ef\",\"dweb:/ipfs/QmURqWRZpt5QCJ9dj2EtJToY2Pz7KvTktdfWoTbWhNcGcP\"]},\"contracts/libraries/AddressArrayUtils.sol\":{\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://3a413f290b8e81540bc6feb739bcfbacf56419b2e657bbce5be43826569b4406\",\"dweb:/ipfs/QmWRjGLBXs7WK92oPm51QpjxMYGuMTBx85Pv7QcGbUZE72\"]},\"contracts/libraries/EnumFlags.sol\":{\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://1b05f2717fd40454d68d411ab7bbbf5e3bb8ea6d7f27d335b1338362305904a2\",\"dweb:/ipfs/QmaiGASjWNVyfFzguu5xoKFRcLqGg67DHSd5422b5k6rbb\"]},\"contracts/libraries/Math.sol\":{\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://b4af5bb4d7c57d10844b31211dc52762f69c33f99fe90bf8bd4086b0f7ece4da\",\"dweb:/ipfs/Qma1Gtmp2Y5YMxAXS7XpUQHkc4auz95W6CevSLmD5CFrrB\"]},\"contracts/precompile-usages/PCUPickValidatorSet.sol\":{\"keccak256\":\"0xcb57a021897a773d11be9d98a195e0653f2124b7e95e84c4832b57d9d36d67e1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://62cfabee3f0ad5ab8ba6b5f318ff33e68a3e532649a958b51fac6ae559ca95c0\",\"dweb:/ipfs/QmPJkxM87o2LGsqSRgTQnnaZJtZRXeRu7ZbGzwNXggMCsr\"]},\"contracts/precompile-usages/PCUSortValidators.sol\":{\"keccak256\":\"0xf2f21d25f9d1b77e591542440c839d98125ae3c41c73de7c42f8c46d95eac717\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://52b9340ff9f29ef0bcf0552142fe1df4036bdea579bf0d023bd3e65d0f706233\",\"dweb:/ipfs/Qmbv3QcysrYQiZiGC9A9Hj6EPRPu52fWFHDhmyX5nfUoqn\"]},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d7c9e940ba3e89d832b615239ba9e4af44471b3701bd1f480924a7e2c434f63\",\"dweb:/ipfs/QmPtxtdPgTzyw7WpzpLBCX7anYbq5q7zwarz1PzVAFX4zz\"]},\"contracts/ronin/validator/CandidateManager.sol\":{\"keccak256\":\"0x8cb589408125c80089fc496eb8531eedc20743417f528789629c6dacda6a43fc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2d03cc377843c808989b4cab9e47374cdf00806f17b7f141c5c63797acc177f\",\"dweb:/ipfs/QmNy5GJRZ2AgQwRJGfEcVoFiakXGm2YPgbpVVyD8L2jC1M\"]},\"contracts/ronin/validator/CoinbaseExecution.sol\":{\"keccak256\":\"0x6f7b96ef8c9b63c124436fe432f2641a604a392f2ad04126e0229137c24e3bf0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cc8691ea71818453580c5eab9ef11046cabe97e482c33d9a8c0f7451260b65a8\",\"dweb:/ipfs/QmPqyRgZGXzQrsrc7voW6oKsTovj5D3obrDVFhZZevo539\"]},\"contracts/ronin/validator/EmergencyExit.sol\":{\"keccak256\":\"0x7b57a4e3afd9099caa0498ec60fc6cf660512784ca0f864ff44fa1aac6cd26c2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da721099dc33a82d6af75154c4f26ca8ca8e6786fe6321d8a58f02c12f0603b9\",\"dweb:/ipfs/QmbqcxVGHyBDkwLR8JjfrB4htcSgdV6FMw89E28QUwMEuA\"]},\"contracts/ronin/validator/RoninValidatorSet.sol\":{\"keccak256\":\"0x6475249b3d44c233408e9f0091d146e934a13dbbea276112a21e808d2040a821\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://223b7adf55546fdf9dc515b64d1da33ebf00da041cf5921c958e424fc4772908\",\"dweb:/ipfs/QmdfeVWg7dm6QsFSggSMMue1PoXtQqiuyWBMCr642orQfR\"]},\"contracts/ronin/validator/SlashingExecution.sol\":{\"keccak256\":\"0x7be4b1597eeecd1acf643862289debadf5f84d68650ae39164d46bcaf9fa7c91\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e449beda857caedc3dab011ff931be7b3a87096bc52fb59f903e8e915a1d4e2e\",\"dweb:/ipfs/QmPMAtdnY2iUPuRwNVeVUybqKY7NAor1PuFidvAa57hBZe\"]},\"contracts/ronin/validator/storage-fragments/CommonStorage.sol\":{\"keccak256\":\"0x917af4e54f9c93ec26ccdbfd28428f08450eec01e9af1b01e11536c12ba8fa8d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bae595f4b27ab2decefbe955ea9bd190b30043c2fdc23a658202e3502eeb71d5\",\"dweb:/ipfs/QmPT3nUHvyvDoGJKUbGkkUbieAPkkdAsUW1omEp6dcCur7\"]},\"contracts/ronin/validator/storage-fragments/JailingStorage.sol\":{\"keccak256\":\"0xdef0c07a95baaff5c23b5cacf7747f50a76a150875ae118f8553fe3ae0d15498\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4c64a137711f1aa3504d9c9dac1cf0be859bad338a56fc581b164aee29adce69\",\"dweb:/ipfs/Qmd135rnBhmZjzEiNXym12zRnN6JGKkckgsucUWE7usF8d\"]},\"contracts/ronin/validator/storage-fragments/TimingStorage.sol\":{\"keccak256\":\"0xc545f119b8b8978d793b62f2495dc2d49c3f416791459b9833bdc65f4dae8e7f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dd26180c3dcd0765e292dd187e686c006ce2b41404898a24886b504d16f7234d\",\"dweb:/ipfs/QmV8dbzzqH7y7D8Hxshpanirb2GZaq9evLoWEurrvqQGrE\"]},\"contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol\":{\"keccak256\":\"0x502092b4bbe2b76543bcc576cb0fb815626dc06afbaaf26a59c6fc0cfbabeb4f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://df9209f98da0e97e0a97133b6a5522a3cdf711104cffbb5c8865b0daa9ead482\",\"dweb:/ipfs/QmRf2fsvDEXAJ2iuzZjURv7KtsbVBy3S8nJZaayR6zQWdu\"]},\"contracts/utils/CommonErrors.sol\":{\"keccak256\":\"0x22942c8fea2d1ca863ac1f9c1662d714b8ac0856684e36f8aaf19508648c1053\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d7e47ff198edb68a65d65938c67f860c041a4b7f64cff5b101a333869096044b\",\"dweb:/ipfs/QmTFwEY7jPiUSKc3GvYDY7qHqXJzUYCmSjoVrcgFhi8gZz\"]},\"contracts/utils/ContractType.sol\":{\"keccak256\":\"0x57e684dc2640b237ea5eaa29234a3b640b18ceb5d16c74d0c3f13fa0c28e533a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3b5164fc9abea62e27e923dc89e055bfe308bcee43e588bc292629a991f47959\",\"dweb:/ipfs/QmX6Zs4PR8jnDw9XsznmijmivAwcuMXvWpYsavgMSSdDwV\"]},\"contracts/utils/DeprecatedSlots.sol\":{\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://66205963116e22bb24d9f2e0c1a38a27c4c0c3cf50693bc5f3177068cba37612\",\"dweb:/ipfs/Qmb1hZg6Df4zLeDMPMH4WZVpyLFe7A4TTBEtR6HHddSohC\"]},\"contracts/utils/IdentityGuard.sol\":{\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5e4cedc10e50bfaacdc732eab78768b5e0abbc8336eeaffa15de2a7be90de504\",\"dweb:/ipfs/QmR17AgM71NkH5ZeLpmaRMzPyXAKyhafoK2TZUnLw2z3Mv\"]},\"contracts/utils/RoleAccess.sol\":{\"keccak256\":\"0xa98cec38c640c4e37f475debbcd366226f1188c3f5ea6e29de768bd33e021873\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ecf0bc5d9b1017db9adc4b28684ab6d796d43a7530cb346e43f5d3a36df03f44\",\"dweb:/ipfs/QmV82ANfHy8RYghXuLCZ4Enfqbnvswq4Qc8ZNY2nSRTXRW\"]}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614d0580620000f46000396000f3fe6080604052600436106102955760003560e01c806303827884146102ac57806304d971ab146102d557806306040618146103055780630f43a6771461031a57806311662dc2146103305780631196ab661461036d57806315b5ebde1461038d578063217f35c2146103ad57806323c65eb0146103c257806328bde1e1146103e25780632924de711461040f578063297a8fca1461042f5780632d784a98146104445780632f78204c146104715780633101cfcb1461049157806331a8aef5146104b1578063367ec12b146104d15780633b3159b6146104f1578063468c96ae1461050e57806349096d26146105455780634d8df063146105675780634de2b735146105875780634ee4d72b146105b45780634f2a693f146105c957806352091f17146105e95780635248184a146105f15780635cd8a76b14610613578063605239a114610628578063612c8d981461063d57806365244ece146106525780636558954f146106725780636611f84314610689578063690b7536146106a95780636aa1c2ef146106be57806372e46810146106d35780637593ff71146106db578063823a7b9c146106fb578063865e6fd31461071b578063873a5a701461073b57806387c891bd1461075b5780638d559c381461077057806396585fc214610784578063a0c3f2d2146107a4578063a3d545f5146107c4578063a66c0f77146107e4578063a7c2f119146107f9578063afc69d7314610819578063b7ab4db51461082e578063ba77b06c14610843578063c3c8b5d614610858578063c94aaa0214610878578063d09f1ab414610898578063dd716ad3146108ad578063de981f1b146108cd578063e5125a1d146108ed578063edb194bb1461090d578063eeb629a81461096f578063f883afaf14610984576102a4565b366102a4576102a26109a4565b005b6102a26109a4565b3480156102b857600080fd5b506102c26104b081565b6040519081526020015b60405180910390f35b3480156102e157600080fd5b506102f56102f03660046141c9565b610a0d565b60405190151581526020016102cc565b34801561031157600080fd5b506102c2610a34565b34801561032657600080fd5b506102c260aa5481565b34801561033c57600080fd5b5061035061034b366004614202565b610a44565b6040805193151584526020840192909252908201526060016102cc565b34801561037957600080fd5b506102a261038836600461422e565b610ac7565b34801561039957600080fd5b506102a26103a8366004614202565b610adb565b3480156103b957600080fd5b506102f5610bdc565b3480156103ce57600080fd5b506102f56103dd366004614202565b610bf1565b3480156103ee57600080fd5b506104026103fd366004614247565b610c04565b6040516102cc91906142b8565b34801561041b57600080fd5b506102f561042a366004614247565b610ca7565b34801561043b57600080fd5b506004546102c2565b34801561045057600080fd5b5061046461045f366004614247565b610cb3565b6040516102cc91906142c6565b34801561047d57600080fd5b506102a261048c3660046142eb565b610d15565b34801561049d57600080fd5b506102a26104ac366004614247565b610f30565b3480156104bd57600080fd5b506102f56104cc366004614202565b610fc0565b3480156104dd57600080fd5b506102a26104ec366004614346565b610fcc565b3480156104fd57600080fd5b5060685b6040516102cc919061440c565b34801561051a57600080fd5b5061052e61052936600461422e565b6110ff565b6040805192151583526020830191909152016102cc565b34801561055157600080fd5b5061055a61113d565b6040516102cc9190614464565b34801561057357600080fd5b506102a261058236600461422e565b61121c565b34801561059357600080fd5b506105a76105a2366004614477565b61122d565b6040516102cc91906144eb565b3480156105c057600080fd5b5060e4546102c2565b3480156105d557600080fd5b506102a26105e436600461422e565b6112de565b6102a26112ef565b3480156105fd57600080fd5b506106066116ba565b6040516102cc9190614531565b34801561061f57600080fd5b506102a26117df565b34801561063457600080fd5b506072546102c2565b34801561064957600080fd5b506076546102c2565b34801561065e57600080fd5b506102f561066d366004614247565b611918565b34801561067e57600080fd5b506102c26201518081565b34801561069557600080fd5b506102a26106a436600461422e565b611952565b3480156106b557600080fd5b5060e5546102c2565b3480156106ca57600080fd5b506001546102c2565b6102a2611963565b3480156106e757600080fd5b506102f56106f636600461422e565b611bb1565b34801561070757600080fd5b506102a261071636600461422e565b611bd5565b34801561072757600080fd5b506102a2610736366004614582565b611be6565b34801561074757600080fd5b506102f5610756366004614247565b611c05565b34801561076757600080fd5b506002546102c2565b34801561077c57600080fd5b506066610501565b34801561079057600080fd5b5061035061079f366004614247565b611c1c565b3480156107b057600080fd5b506102f56107bf366004614247565b611c38565b3480156107d057600080fd5b506102c26107df36600461422e565b611c55565b3480156107f057600080fd5b5060e6546102c2565b34801561080557600080fd5b506102a2610814366004614202565b611c60565b34801561082557600080fd5b506102c2611ea3565b34801561083a57600080fd5b5061055a611ee6565b34801561084f57600080fd5b5061055a611f8c565b34801561086457600080fd5b506102a26108733660046141c9565b611fee565b34801561088457600080fd5b506102a261089336600461422e565b612245565b3480156108a457600080fd5b5060a9546102c2565b3480156108b957600080fd5b506102a26108c8366004614202565b612256565b3480156108d957600080fd5b506105016108e836600461459e565b6122dc565b3480156108f957600080fd5b506102a26109083660046145b9565b612339565b34801561091957600080fd5b50610464610928366004614247565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b34801561097b57600080fd5b5060ad546102c2565b34801561099057600080fd5b506102a261099f3660046145ee565b612447565b6109ae60076122dc565b6001600160a01b0316336001600160a01b0316141580156109ea57506109d460096122dc565b6001600160a01b0316336001600160a01b031614155b15610a0b5760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610a3f60035490565b905090565b6001600160a01b0382166000908152603a60205260408120548190819084811015610a7a57600080600093509350935050610ac0565b60019350610a888582614655565b610a93906001614668565b9250610a9e85611c55565b610aa782611c55565b610ab19190614655565b610abc906001614668565b9150505b9250925092565b610acf612647565b610ad881612690565b50565b6006610ae6816126e7565b6001600160a01b0383166000908152603c60205260409020544311610b2957826040516353e0424d60e01b8152600401610b20919061440c565b60405180910390fd5b6001600160a01b038316600081815260386020908152604080832086845282528083208054600160ff199182168117909255948452603783528184208785529092529091208054909216909155610b809043614655565b6001600160a01b0384166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e90610bcf9085815260200190565b60405180910390a2505050565b6000610a3f610bea42612733565b6003541090565b6000610bfd8383612742565b9392505050565b610c0c614178565b610c1582611c38565b610c325760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610a2e8243610bf1565b604080518082018252600080825260209182018190526001600160a01b038416815260e882528281208351808501909452805484526001015491830182905203610d10576040516370fdd4f160e11b815260040160405180910390fd5b919050565b6006610d20816126e7565b6000610d2a610a34565b6001600160a01b03871660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e090915291902054919250610d7891614668565b60e46000828254610d899190614668565b90915550506001600160a01b038616600090815260e06020908152604080832083905560e18252808320839055603a909152902054610dc9908690612762565b6001600160a01b0387166000908152603a60205260409020558315610e7f576000610df460096122dc565b6001600160a01b0316632715805e88876040518363ffffffff1660e01b8152600401610e2192919061467b565b6020604051808303816000875af1158015610e40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e649190614694565b90508060e46000828254610e789190614668565b9091555050505b8215610ec3576001600160a01b0386166000908152603c6020526040902054610ea9908690612762565b6001600160a01b0387166000908152603c60205260409020555b6001600160a01b0386166000818152603a6020908152604080832054815190815291820188905260019082015260608101919091528291907f54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68a9060800160405180910390a3505050505050565b600054600390610100900460ff16158015610f52575060005460ff8083169116105b610f6e5760405162461bcd60e51b8152600401610b20906146ad565b6000805461ffff191660ff831617610100179055610f8d600e83612779565b6000805461ff001916905560405160ff82168152600080516020614cb08339815191529060200160405180910390a15050565b6000610bfd8383612804565b600054610100900460ff1615808015610fec5750600054600160ff909116105b806110065750303b158015611006575060005460ff166001145b6110225760405162461bcd60e51b8152600401610b20906146ad565b6000805460ff191660011790558015611045576000805461ff0019166101001790555b61105060068e612779565b61105b60098d612779565b61106660078c612779565b61107160058b612779565b61107c600a8a612779565b6110858761282f565b61108e86612864565b61109785612899565b6110a084612690565b6110aa82356128f1565b6110b76020830135612926565b600183905580156110f0576000805461ff001916905560405160018152600080516020614cb08339815191529060200160405180910390a15b50505050505050505050505050565b60008061110b43611c55565b83111580611126575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b606060aa546001600160401b0381111561115957611159614711565b604051908082528060200260200182016040528015611182578160200160208202803683370190505b5090506000805b825181101561121657600081815260ab60205260409020546111b3906001600160a01b0316611918565b1561120e57600081815260ab60205260409020546001600160a01b031683836111db81614727565b9450815181106111ed576111ed6146fb565b60200260200101906001600160a01b031690816001600160a01b0316815250505b600101611189565b50815290565b611224612647565b610ad881612926565b6060816001600160401b0381111561124757611247614711565b604051908082528060200260200182016040528015611270578160200160208202803683370190505b50905060005b828110156112d7576112ad848483818110611293576112936146fb565b90506020020160208101906112a89190614247565b61295b565b8282815181106112bf576112bf6146fb565b91151560209283029190910190910152600101611276565b5092915050565b6112e6612647565b610ad881612864565b6112f7612967565b600061130233611918565b801561131457506113123361295b565b155b801561132e575061132c33611327610a34565b612804565b155b905060008061133d60076122dc565b604051630634f5b960e01b81528415156004820152600060248201526001600160a01b039190911690630634f5b9906044016080604051808303816000875af115801561138e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b29190614740565b935050925050826113f7573460e460008282546113cf9190614668565b90915550506040513390600080516020614c9083398151915290610bcf903490600190614795565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b134846040516114329291906147b9565b60405180910390a26000611444610a34565b905060006114528434614668565b9050600061271061146385846147c7565b61146d91906147f4565b9050600061147b8284614655565b905060008260e260008282546114919190614668565b909155505033600090815260386020908152604080832088845290915290205460ff161561158a5760006114c560066122dc565b6001600160a01b031663c6391fa26040518163ffffffff1660e01b8152600401608060405180830381865afa158015611502573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115269190614808565b9350505050612710818461153a91906147c7565b61154491906147f4565b91508160e460008282546115589190614668565b90915550506040513390600080516020614c9083398151915290611580908590600290614795565b60405180910390a2505b6115948183614655565b91506000806115a360096122dc565b6001600160a01b0316634530d2026040518163ffffffff1660e01b81526004016040805180830381865afa1580156115df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611603919061483e565b33600090815260756020526040812060040154929450909250906116319061162b9084612987565b84612762565b9050600061271061164287846147c7565b61164c91906147f4565b33600090815260e06020526040812080549293508392909190611670908490614668565b90915550600090506116828288614655565b33600090815260e160205260408120805492935083929091906116a6908490614668565b909155505050505050505050505050505050565b6073546060906001600160401b038111156116d7576116d7614711565b60405190808252806020026020018201604052801561171057816020015b6116fd614178565b8152602001906001900390816116f55790505b50905060005b81518110156117db576075600060738381548110611736576117366146fb565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015282518390839081106117c8576117c86146fb565b6020908102919091010152600101611716565b5090565b600054600290610100900460ff16158015611801575060005460ff8083169116105b61181d5760405162461bcd60e51b8152600401610b20906146ad565b6000805461ffff191660ff831617610100179055607154611849906009906001600160a01b0316612779565b606f54611861906005906001600160a01b0316612779565b607054611879906006906001600160a01b0316612779565b606d54611891906007906001600160a01b0316612779565b60a8546118a990600a906001600160a01b0316612779565b607180546001600160a01b0319908116909155606f8054821690556070805482169055606d805482169055606e80548216905560a8805490911690556000805461ff001916905560405160ff82168152600080516020614cb0833981519152906020015b60405180910390a150565b6001600160a01b038116600090815260ac6020526040812054610a2e9060019060ff16600381111561194c5761194c61477f565b90612996565b61195a612647565b610ad8816128f1565b61196b612967565b61197443611bb1565b61199157604051636c74eecf60e01b815260040160405180910390fd5b61199a43611c55565b6119a5600254611c55565b106119c357604051632458f64160e01b815260040160405180910390fd5b4360025560006119d242612733565b905060006119e1826003541090565b905060006119ed611ee6565b9050606060006119fc43611c55565b90506000611a0b826001614668565b90506000611a17610a34565b9050611a2383866129c9565b8515611b4b57600080611a368388612b38565b91509150611a4683888484612d06565b611a4e612e10565b611a56612f64565b6000611a6260066122dc565b604051631da0214360e21b81529091506001600160a01b03821690637680850c90611a93908b908890600401614862565b600060405180830381600087803b158015611aad57600080fd5b505af1158015611ac1573d6000803e3d6000fd5b50505050611ace8a61308d565b8051919950975015611b39576040516303e1697b60e11b81526001600160a01b038216906307c2d2f690611b06908a90600401614464565b600060405180830381600087803b158015611b2057600080fd5b505af1158015611b34573d6000803e3d6000fd5b505050505b611b44436001614668565b6004555050505b611b5687838761321e565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce788604051611b8b911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b600060018054611bc19190614655565b600154611bce9084614884565b1492915050565b611bdd612647565b610ad88161282f565b611bee612647565b611bf78161349f565b611c018282612779565b5050565b600080611c10610a34565b9050610bfd8382612804565b6000806000611c2b8443610a44565b9250925092509193909250565b6001600160a01b0316600090815260746020526040902054151590565b6000610a2e826134cc565b6009611c6b816126e7565b6001600160a01b038316600090815260e860205260409020600181015415611ca65760405163057aab3160e31b815260040160405180910390fd5b6000611cb28442614668565b6001600160a01b0386166000908152607560205260409020909150611cd790826134e7565b6001600160a01b0385166000908152603b602052604080822083905560e554905163138ac02f60e11b81523391632715805e91611d18918a9160040161467b565b6020604051808303816000875af1158015611d37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5b9190614694565b90508015611e5857600060e65442611d739190614668565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038b1617905583865585018190559050611dd161356a565b6001600160a01b0388811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b158015611e3e57600080fd5b505af1158015611e52573d6000803e3d6000fd5b50505050505b856001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c482604051611e9391815260200190565b60405180910390a2505050505050565b6000805b60aa548110156117db57600081815260ab6020526040902054611ed2906001600160a01b0316611918565b15611ede576001909101905b600101611ea7565b606060aa546001600160401b03811115611f0257611f02614711565b604051908082528060200260200182016040528015611f2b578160200160208202803683370190505b50905060005b81518110156117db57600081815260ab602052604090205482516001600160a01b03909116908190849084908110611f6b57611f6b6146fb565b6001600160a01b039092166020928302919091019091015250600101611f31565b60606073805480602002602001604051908101604052809291908181526020018280548015611fe457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611fc6575b5050505050905090565b611ff6612647565b6001600160a01b038216600090815260e8602052604090206001015415611c015760e7548060005b8281101561206d57846001600160a01b031660e78281548110612043576120436146fb565b6000918252602090912001546001600160a01b0316036120655780915061206d565b60010161201e565b5081810361207b5750505050565b6001600160a01b038416600090815260e86020526040902054801561223e576001600160a01b038516600090815260e86020526040812081815560019081019190915583111561213d5760e76120d2600185614655565b815481106120e2576120e26146fb565b60009182526020909120015460e780546001600160a01b03909216918490811061210e5761210e6146fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e780548061214e5761214e614898565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff191660011790556121a084826104b0613598565b156121f957836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e4836040516121ea91815260200190565b60405180910390a35050505050565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a183476040516121ea9291906147b9565b5050505050565b61224d612647565b610ad881612899565b6009612261816126e7565b61226a836135f8565b156122885760405163030081e760e01b815260040160405180910390fd5b6001600160a01b03831660009081526075602052604090206005810154156122c35760405163fab9167360e01b815260040160405180910390fd5b6122d6816122d18542614668565b6134e7565b50505050565b60006122e6613678565b600083600f8111156122fa576122fa61477f565b60ff1681526020810191909152604001600020546001600160a01b0316905080610d10578160405163409140df60e11b8152600401610b2091906148c2565b6009612344816126e7565b6001600160a01b0384166000908152607760205260409020541561237b57604051632f32dcdd60e11b815260040160405180910390fd5b61271082111561239e57604051631b8454a360e21b815260040160405180910390fd5b6076548310156123c15760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03841660009081526077602052604081209062015180856123e982426147f4565b6123f39190614668565b6123fd91906147c7565b808355600183018590556040519091506001600160a01b038716907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f2190611e9390849088906147b9565b6009612452816126e7565b607354607254811061247757604051638616841b60e01b815260040160405180910390fd5b61248085611c38565b1561249e57604051638ad9cdf960e01b815260040160405180910390fd5b6127108311156124c157604051631b8454a360e21b815260040160405180910390fd5b60005b60735481101561257657600060756000607384815481106124e7576124e76146fb565b60009182526020808320909101546001600160a01b0390811684529083019390935260409091019020805490925081169089160361253a578760405163fc3d8c7560e01b8152600401610b20919061440c565b60028101546001600160a01b039081169087160361256d5785604051632d33a7e760e11b8152600401610b20919061440c565b506001016124c4565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b031990811687179091556075909352818420805484168d881690811782559181018054851687179055600281018054909416968b1696871790935560048301899055905191949093909290917f1ca451a9920472b99355a9cf74185bf017604a7849c113f020888ecec9db93669190a450505050505050565b61264f61356a565b6001600160a01b0316336001600160a01b031614610a0b576000356001600160e01b0319166001604051620f948f60ea1b8152600401610b209291906148d0565b60018110156126b2576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a252679060200161190d565b6126f0816122dc565b6001600160a01b0316336001600160a01b031614610ad8576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610b20939291906148f1565b6000610a2e62015180836147f4565b6001600160a01b03919091166000908152603a6020526040902054101590565b6000818310156127725781610bfd565b5090919050565b80612782613678565b600084600f8111156127965761279661477f565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f8111156127d7576127d761477f565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161190d565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161190d565b60a9548111156128bc576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161190d565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161190d565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161190d565b6000610a2e8243612742565b334114610a0b576040516309f358fd60e01b815260040160405180910390fd5b60008183106127725781610bfd565b60008160038111156129aa576129aa61477f565b8360038111156129bc576129bc61477f565b1660ff1615159392505050565b60006129d5600e6122dc565b6001600160a01b031663468d24be84846040518363ffffffff1660e01b8152600401612a02929190614928565b600060405180830381865afa158015612a1f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a47919081019061499c565b905060008251600154612a5a91906147c7565b60e25490915060009081805b8651811015612b095784868281518110612a8257612a826146fb565b602002602001015184612a9591906147c7565b612a9f91906147f4565b93508360e36000898481518110612ab857612ab86146fb565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254612aef9190614668565b90915550612aff90508483614668565b9150600101612a66565b50612b148183614655565b60e46000828254612b259190614668565b9091555050600060e25550505050505050565b6000606060008084516001600160401b03811115612b5857612b58614711565b604051908082528060200260200182016040528015612b81578160200160208202803683370190505b50925060005b8551811015612cfc57858181518110612ba257612ba26146fb565b6020908102919091018101516001600160a01b0380821660009081526075909352604090922060020154909450169150612bdb8361295b565b158015612bef5750612bed8388612804565b155b15612c6d576001600160a01b038316600090815260e16020526040902054612c179086614668565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110612c4857612c486146fb565b602002602001018181525050612c5e838361369c565b612c688383613764565b612cc4565b6001600160a01b038316600090815260e3602090815260408083205460e183528184205460e0909352922054612ca39190614668565b612cad9190614668565b60e46000828254612cbe9190614668565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e3909152812055600101612b87565b5050509250929050565b6000612d1260096122dc565b9050821561223e57612d24818461381f565b15612dcc5760405163566bce2360e11b81526001600160a01b0382169063acd79c4690612d5990879086908a90600401614a61565b600060405180830381600087803b158015612d7357600080fd5b505af1158015612d87573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051612dbe93929190614a97565b60405180910390a1506122d6565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051612e019493929190614acc565b60405180910390a15050505050565b60e754600080805b838310156122d65760e78381548110612e3357612e336146fb565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210612f5957805460e48054600090612e7b908490614668565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055612eaa85614b09565b9450841115612f215760e78481548110612ec657612ec66146fb565b60009182526020909120015460e780546001600160a01b039092169185908110612ef257612ef26146fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612f3257612f32614898565b600082815260209020810160001990810180546001600160a01b0319169055019055612e18565b600190920191612e18565b60e4548015610ad8576000612f7960076122dc565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591612fc69190614b20565b60006040518083038185875af1925050503d8060008114613003576040519150601f19603f3d011682016040523d82523d6000602084013e613008565b606091505b50509050801561304d57816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051610bcf91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051610bcf9291906147b9565b505050565b6060806130998361387b565b905060006130a760096122dc565b6001600160a01b03166391f8723f60736040518263ffffffff1660e01b81526004016130d39190614b4f565b600060405180830381865afa1580156130f0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613118919081019061499c565b90506000613126600a6122dc565b6001600160a01b031663520fce6260736040518263ffffffff1660e01b81526004016131529190614b4f565b600060405180830381865afa15801561316f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613197919081019061499c565b9050600061320660738054806020026020016040519081016040528092919081815260200182805480156131f457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116131d6575b5050505050848460a95460ad54613d65565b9095509050613216858288613e2f565b505050915091565b600061322a60056122dc565b6001600160a01b031663fdadda8183613244436001614668565b6040518363ffffffff1660e01b8152600401613261929190614862565b600060405180830381865afa15801561327e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526132a69190810190614b93565b905060005b82518110156134585760008382815181106132c8576132c86146fb565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906132fd83611918565b9050600061331584613310436001614668565b612742565b80613336575085858151811061332d5761332d6146fb565b60200260200101515b8061333e5750825b1590508115801561334c5750805b156133c7576001600160a01b038416600090815260ac602052604090205461338b9060019060ff1660038111156133855761338561477f565b90613f6f565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156133bd576133bd61477f565b0217905550613449565b8180156133d2575080155b15613449576001600160a01b038416600090815260ac60205260409020546134119060019060ff16600381111561340b5761340b61477f565b90613faa565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156134435761344361477f565b02179055505b846001019450505050506132ab565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261348461113d565b6040516134919190614464565b60405180910390a350505050565b806001600160a01b03163b600003610ad85780604051630bfc64a360e21b8152600401610b20919061440c565b6000600154826134dc91906147f4565b610a2e906001614668565b60018201546134fe906001600160a01b0316611c38565b61351b5760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e79060200160405180910390a25050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146135e8576040519150601f19603f3d011682016040523d82523d6000602084013e6135ed565b606091505b509095945050505050565b600080613605600a6122dc565b6001600160a01b03166341feed1c846040518263ffffffff1660e01b8152600401613630919061440c565b602060405180830381865afa15801561364d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136719190614694565b1192915050565b7fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb90565b6001600160a01b038216600090815260e060205260409020548015613088576136c882826104b0613598565b1561371f57816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec8360405161371291815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516137129291906147b9565b6001600160a01b038216600090815260e3602052604090205480156130885761379082826104b0613598565b156137da57816001600160a01b0316836001600160a01b03167f0c4d6a43fc8470dee97db74874b5685e412cc517d9bdecfde1623c5e835b18e48360405161371291815260200190565b816001600160a01b0316836001600160a01b03167f98697ee35f04a599a814432016fff3968c483d2d88dacb484926b9358f8e7cf983476040516137129291906147b9565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461386c576040519150601f19603f3d011682016040523d82523d6000602084013e613871565b606091505b5090949350505050565b6060600061388960096122dc565b90506000816001600160a01b031663af2454296040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ef9190614694565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139559190614694565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b81526004016139869190614b4f565b600060405180830381865afa1580156139a3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526139cb919081019061499c565b6073549091506000816001600160401b038111156139eb576139eb614711565b604051908082528060200260200182016040528015613a14578160200160208202803683370190505b50965060008060005b84831015613cb65760738381548110613a3857613a386146fb565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110613a8057613a806146fb565b60200260200101511015613adc5780613ad7576000613a9f8a42614668565b600684018190556040518181529091506001600160a01b03851690600080516020614c708339815191529060200160405180910390a2505b613b1d565b8015613b1d578160060160009055826001600160a01b0316600080516020614c708339815191526000604051613b1491815260200190565b60405180910390a25b60008260050154600014158015613b38575042836005015411155b80613b5b57506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015613b78575042846006015411155b90508180613b835750805b15613c155788613b9289614b09565b98508881518110613ba557613ba56146fb565b6020026020010151898781518110613bbf57613bbf6146fb565b602002602001018181525050848d8880600101995081518110613be457613be46146fb565b60200260200101906001600160a01b031690816001600160a01b031681525050613c0d85613fe6565b505050613a1d565b6001600160a01b0385166000908152607760205260409020548015801590613c3d5750428111155b15613ca6576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b505060019094019350613a1d9050565b5050508087528015613d5a577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051613cf19190614464565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90613d27908a908c90600401614862565b600060405180830381600087803b158015613d4157600080fd5b505af1158015613d55573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401613d89959493929190614c21565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b519293506001929091600091613dcc916147c7565b613dd7906040614668565b90506020840181888483895afa613ded57600093505b503d613df857600092505b60208701965082613e1c57604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa54811015613e8357600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055600101613e31565b5060005b82811015613ec357600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff19169055600101613e87565b5060005b82811015613f37576000848281518110613ee357613ee36146fb565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b031916909117905550600101613ec7565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051610bcf9190614464565b6000816003811115613f8357613f8361477f565b836003811115613f9557613f9561477f565b1760ff166003811115610bfd57610bfd61477f565b6000816003811115613fbe57613fbe61477f565b19836003811115613fd157613fd161477f565b1660ff166003811115610bfd57610bfd61477f565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054610ad891839190819003614023575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b0319908116825560018083018054831690556002830180548316905560038301805490921690915560048201859055600582018590556006909101849055607483528184208490556077909252822082815581018290556073805490916140ad91614655565b815481106140bd576140bd6146fb565b6000918252602090912001546001600160a01b03908116915083168114614140576001600160a01b0381166000908152607460205260409020829055607380548291908419908110614111576141116146fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b607380548061415157614151614898565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b0381168114610ad857600080fd5b600080604083850312156141dc57600080fd5b82356141e7816141b4565b915060208301356141f7816141b4565b809150509250929050565b6000806040838503121561421557600080fd5b8235614220816141b4565b946020939093013593505050565b60006020828403121561424057600080fd5b5035919050565b60006020828403121561425957600080fd5b8135610bfd816141b4565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610a2e8284614264565b815181526020808301519082015260408101610a2e565b8015158114610ad857600080fd5b6000806000806080858703121561430157600080fd5b843561430c816141b4565b93506020850135925060408501359150606085013561432a816142dd565b939692955090935050565b8060408101831015610a2e57600080fd5b6000806000806000806000806000806000806101a08d8f03121561436957600080fd5b8c35614374816141b4565b9b5060208d0135614384816141b4565b9a5060408d0135614394816141b4565b995060608d01356143a4816141b4565b985060808d01356143b4816141b4565b975060a08d01356143c4816141b4565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506143fa8e6101608f01614335565b90509295989b509295989b509295989b565b6001600160a01b0391909116815260200190565b600081518084526020808501945080840160005b838110156144595781516001600160a01b031687529582019590820190600101614434565b509495945050505050565b602081526000610bfd6020830184614420565b6000806020838503121561448a57600080fd5b82356001600160401b03808211156144a157600080fd5b818501915085601f8301126144b557600080fd5b8135818111156144c457600080fd5b8660208260051b85010111156144d957600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015614525578351151583529284019291840191600101614507565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561452557614560838551614264565b9284019260e0929092019160010161454d565b803560108110610d1057600080fd5b6000806040838503121561459557600080fd5b6141e783614573565b6000602082840312156145b057600080fd5b610bfd82614573565b6000806000606084860312156145ce57600080fd5b83356145d9816141b4565b95602085013595506040909401359392505050565b6000806000806080858703121561460457600080fd5b843561460f816141b4565b9350602085013561461f816141b4565b9250604085013561462f816141b4565b9396929550929360600135925050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610a2e57610a2e61463f565b80820180821115610a2e57610a2e61463f565b6001600160a01b03929092168252602082015260400190565b6000602082840312156146a657600080fd5b5051919050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6000600182016147395761473961463f565b5060010190565b6000806000806080858703121561475657600080fd5b8451614761816142dd565b60208601516040870151606090970151919890975090945092505050565b634e487b7160e01b600052602160045260246000fd5b82815260408101600383106147ac576147ac61477f565b8260208301529392505050565b918252602082015260400190565b8082028115828204841417610a2e57610a2e61463f565b634e487b7160e01b600052601260045260246000fd5b600082614803576148036147de565b500490565b6000806000806080858703121561481e57600080fd5b505082516020840151604085015160609095015191969095509092509050565b6000806040838503121561485157600080fd5b505080516020909101519092909150565b6040815260006148756040830185614420565b90508260208301529392505050565b600082614893576148936147de565b500690565b634e487b7160e01b600052603160045260246000fd5b601081106148be576148be61477f565b9052565b60208101610a2e82846148ae565b6001600160e01b03198316815260408101600983106147ac576147ac61477f565b6001600160e01b0319841681526060810161490f60208301856148ae565b6001600160a01b03929092166040919091015292915050565b8281526040602082015260006149416040830184614420565b949350505050565b604051601f8201601f191681016001600160401b038111828210171561497157614971614711565b604052919050565b60006001600160401b0382111561499257614992614711565b5060051b60200190565b600060208083850312156149af57600080fd5b82516001600160401b038111156149c557600080fd5b8301601f810185136149d657600080fd5b80516149e96149e482614979565b614949565b81815260059190911b82018301908381019087831115614a0857600080fd5b928401925b82841015614a2657835182529284019290840190614a0d565b979650505050505050565b600081518084526020808501945080840160005b8381101561445957815187529582019590820190600101614a45565b606081526000614a746060830186614420565b8281036020840152614a868186614a31565b915050826040830152949350505050565b838152606060208201526000614ab06060830185614420565b8281036040840152614ac28185614a31565b9695505050505050565b848152608060208201526000614ae56080830186614420565b8281036040840152614af78186614a31565b91505082606083015295945050505050565b600081614b1857614b1861463f565b506000190190565b6000825160005b81811015614b415760208186018101518583015201614b27565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156145255783546001600160a01b031683526001938401939285019201614b6e565b60006020808385031215614ba657600080fd5b82516001600160401b03811115614bbc57600080fd5b8301601f81018513614bcd57600080fd5b8051614bdb6149e482614979565b81815260059190911b82018301908381019087831115614bfa57600080fd5b928401925b82841015614a26578351614c12816142dd565b82529284019290840190614bff565b60a081526000614c3460a0830188614420565b8281036020840152614c468188614a31565b90508281036040840152614c5a8187614a31565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498a264697066735822122085778f06d7c1190376dc1277d04e956cdfa9889848f43b1a34bb67ba0ec4b4ea64736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106102955760003560e01c806303827884146102ac57806304d971ab146102d557806306040618146103055780630f43a6771461031a57806311662dc2146103305780631196ab661461036d57806315b5ebde1461038d578063217f35c2146103ad57806323c65eb0146103c257806328bde1e1146103e25780632924de711461040f578063297a8fca1461042f5780632d784a98146104445780632f78204c146104715780633101cfcb1461049157806331a8aef5146104b1578063367ec12b146104d15780633b3159b6146104f1578063468c96ae1461050e57806349096d26146105455780634d8df063146105675780634de2b735146105875780634ee4d72b146105b45780634f2a693f146105c957806352091f17146105e95780635248184a146105f15780635cd8a76b14610613578063605239a114610628578063612c8d981461063d57806365244ece146106525780636558954f146106725780636611f84314610689578063690b7536146106a95780636aa1c2ef146106be57806372e46810146106d35780637593ff71146106db578063823a7b9c146106fb578063865e6fd31461071b578063873a5a701461073b57806387c891bd1461075b5780638d559c381461077057806396585fc214610784578063a0c3f2d2146107a4578063a3d545f5146107c4578063a66c0f77146107e4578063a7c2f119146107f9578063afc69d7314610819578063b7ab4db51461082e578063ba77b06c14610843578063c3c8b5d614610858578063c94aaa0214610878578063d09f1ab414610898578063dd716ad3146108ad578063de981f1b146108cd578063e5125a1d146108ed578063edb194bb1461090d578063eeb629a81461096f578063f883afaf14610984576102a4565b366102a4576102a26109a4565b005b6102a26109a4565b3480156102b857600080fd5b506102c26104b081565b6040519081526020015b60405180910390f35b3480156102e157600080fd5b506102f56102f03660046141c9565b610a0d565b60405190151581526020016102cc565b34801561031157600080fd5b506102c2610a34565b34801561032657600080fd5b506102c260aa5481565b34801561033c57600080fd5b5061035061034b366004614202565b610a44565b6040805193151584526020840192909252908201526060016102cc565b34801561037957600080fd5b506102a261038836600461422e565b610ac7565b34801561039957600080fd5b506102a26103a8366004614202565b610adb565b3480156103b957600080fd5b506102f5610bdc565b3480156103ce57600080fd5b506102f56103dd366004614202565b610bf1565b3480156103ee57600080fd5b506104026103fd366004614247565b610c04565b6040516102cc91906142b8565b34801561041b57600080fd5b506102f561042a366004614247565b610ca7565b34801561043b57600080fd5b506004546102c2565b34801561045057600080fd5b5061046461045f366004614247565b610cb3565b6040516102cc91906142c6565b34801561047d57600080fd5b506102a261048c3660046142eb565b610d15565b34801561049d57600080fd5b506102a26104ac366004614247565b610f30565b3480156104bd57600080fd5b506102f56104cc366004614202565b610fc0565b3480156104dd57600080fd5b506102a26104ec366004614346565b610fcc565b3480156104fd57600080fd5b5060685b6040516102cc919061440c565b34801561051a57600080fd5b5061052e61052936600461422e565b6110ff565b6040805192151583526020830191909152016102cc565b34801561055157600080fd5b5061055a61113d565b6040516102cc9190614464565b34801561057357600080fd5b506102a261058236600461422e565b61121c565b34801561059357600080fd5b506105a76105a2366004614477565b61122d565b6040516102cc91906144eb565b3480156105c057600080fd5b5060e4546102c2565b3480156105d557600080fd5b506102a26105e436600461422e565b6112de565b6102a26112ef565b3480156105fd57600080fd5b506106066116ba565b6040516102cc9190614531565b34801561061f57600080fd5b506102a26117df565b34801561063457600080fd5b506072546102c2565b34801561064957600080fd5b506076546102c2565b34801561065e57600080fd5b506102f561066d366004614247565b611918565b34801561067e57600080fd5b506102c26201518081565b34801561069557600080fd5b506102a26106a436600461422e565b611952565b3480156106b557600080fd5b5060e5546102c2565b3480156106ca57600080fd5b506001546102c2565b6102a2611963565b3480156106e757600080fd5b506102f56106f636600461422e565b611bb1565b34801561070757600080fd5b506102a261071636600461422e565b611bd5565b34801561072757600080fd5b506102a2610736366004614582565b611be6565b34801561074757600080fd5b506102f5610756366004614247565b611c05565b34801561076757600080fd5b506002546102c2565b34801561077c57600080fd5b506066610501565b34801561079057600080fd5b5061035061079f366004614247565b611c1c565b3480156107b057600080fd5b506102f56107bf366004614247565b611c38565b3480156107d057600080fd5b506102c26107df36600461422e565b611c55565b3480156107f057600080fd5b5060e6546102c2565b34801561080557600080fd5b506102a2610814366004614202565b611c60565b34801561082557600080fd5b506102c2611ea3565b34801561083a57600080fd5b5061055a611ee6565b34801561084f57600080fd5b5061055a611f8c565b34801561086457600080fd5b506102a26108733660046141c9565b611fee565b34801561088457600080fd5b506102a261089336600461422e565b612245565b3480156108a457600080fd5b5060a9546102c2565b3480156108b957600080fd5b506102a26108c8366004614202565b612256565b3480156108d957600080fd5b506105016108e836600461459e565b6122dc565b3480156108f957600080fd5b506102a26109083660046145b9565b612339565b34801561091957600080fd5b50610464610928366004614247565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b34801561097b57600080fd5b5060ad546102c2565b34801561099057600080fd5b506102a261099f3660046145ee565b612447565b6109ae60076122dc565b6001600160a01b0316336001600160a01b0316141580156109ea57506109d460096122dc565b6001600160a01b0316336001600160a01b031614155b15610a0b5760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610a3f60035490565b905090565b6001600160a01b0382166000908152603a60205260408120548190819084811015610a7a57600080600093509350935050610ac0565b60019350610a888582614655565b610a93906001614668565b9250610a9e85611c55565b610aa782611c55565b610ab19190614655565b610abc906001614668565b9150505b9250925092565b610acf612647565b610ad881612690565b50565b6006610ae6816126e7565b6001600160a01b0383166000908152603c60205260409020544311610b2957826040516353e0424d60e01b8152600401610b20919061440c565b60405180910390fd5b6001600160a01b038316600081815260386020908152604080832086845282528083208054600160ff199182168117909255948452603783528184208785529092529091208054909216909155610b809043614655565b6001600160a01b0384166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e90610bcf9085815260200190565b60405180910390a2505050565b6000610a3f610bea42612733565b6003541090565b6000610bfd8383612742565b9392505050565b610c0c614178565b610c1582611c38565b610c325760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610a2e8243610bf1565b604080518082018252600080825260209182018190526001600160a01b038416815260e882528281208351808501909452805484526001015491830182905203610d10576040516370fdd4f160e11b815260040160405180910390fd5b919050565b6006610d20816126e7565b6000610d2a610a34565b6001600160a01b03871660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e090915291902054919250610d7891614668565b60e46000828254610d899190614668565b90915550506001600160a01b038616600090815260e06020908152604080832083905560e18252808320839055603a909152902054610dc9908690612762565b6001600160a01b0387166000908152603a60205260409020558315610e7f576000610df460096122dc565b6001600160a01b0316632715805e88876040518363ffffffff1660e01b8152600401610e2192919061467b565b6020604051808303816000875af1158015610e40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e649190614694565b90508060e46000828254610e789190614668565b9091555050505b8215610ec3576001600160a01b0386166000908152603c6020526040902054610ea9908690612762565b6001600160a01b0387166000908152603c60205260409020555b6001600160a01b0386166000818152603a6020908152604080832054815190815291820188905260019082015260608101919091528291907f54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68a9060800160405180910390a3505050505050565b600054600390610100900460ff16158015610f52575060005460ff8083169116105b610f6e5760405162461bcd60e51b8152600401610b20906146ad565b6000805461ffff191660ff831617610100179055610f8d600e83612779565b6000805461ff001916905560405160ff82168152600080516020614cb08339815191529060200160405180910390a15050565b6000610bfd8383612804565b600054610100900460ff1615808015610fec5750600054600160ff909116105b806110065750303b158015611006575060005460ff166001145b6110225760405162461bcd60e51b8152600401610b20906146ad565b6000805460ff191660011790558015611045576000805461ff0019166101001790555b61105060068e612779565b61105b60098d612779565b61106660078c612779565b61107160058b612779565b61107c600a8a612779565b6110858761282f565b61108e86612864565b61109785612899565b6110a084612690565b6110aa82356128f1565b6110b76020830135612926565b600183905580156110f0576000805461ff001916905560405160018152600080516020614cb08339815191529060200160405180910390a15b50505050505050505050505050565b60008061110b43611c55565b83111580611126575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b606060aa546001600160401b0381111561115957611159614711565b604051908082528060200260200182016040528015611182578160200160208202803683370190505b5090506000805b825181101561121657600081815260ab60205260409020546111b3906001600160a01b0316611918565b1561120e57600081815260ab60205260409020546001600160a01b031683836111db81614727565b9450815181106111ed576111ed6146fb565b60200260200101906001600160a01b031690816001600160a01b0316815250505b600101611189565b50815290565b611224612647565b610ad881612926565b6060816001600160401b0381111561124757611247614711565b604051908082528060200260200182016040528015611270578160200160208202803683370190505b50905060005b828110156112d7576112ad848483818110611293576112936146fb565b90506020020160208101906112a89190614247565b61295b565b8282815181106112bf576112bf6146fb565b91151560209283029190910190910152600101611276565b5092915050565b6112e6612647565b610ad881612864565b6112f7612967565b600061130233611918565b801561131457506113123361295b565b155b801561132e575061132c33611327610a34565b612804565b155b905060008061133d60076122dc565b604051630634f5b960e01b81528415156004820152600060248201526001600160a01b039190911690630634f5b9906044016080604051808303816000875af115801561138e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b29190614740565b935050925050826113f7573460e460008282546113cf9190614668565b90915550506040513390600080516020614c9083398151915290610bcf903490600190614795565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b134846040516114329291906147b9565b60405180910390a26000611444610a34565b905060006114528434614668565b9050600061271061146385846147c7565b61146d91906147f4565b9050600061147b8284614655565b905060008260e260008282546114919190614668565b909155505033600090815260386020908152604080832088845290915290205460ff161561158a5760006114c560066122dc565b6001600160a01b031663c6391fa26040518163ffffffff1660e01b8152600401608060405180830381865afa158015611502573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115269190614808565b9350505050612710818461153a91906147c7565b61154491906147f4565b91508160e460008282546115589190614668565b90915550506040513390600080516020614c9083398151915290611580908590600290614795565b60405180910390a2505b6115948183614655565b91506000806115a360096122dc565b6001600160a01b0316634530d2026040518163ffffffff1660e01b81526004016040805180830381865afa1580156115df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611603919061483e565b33600090815260756020526040812060040154929450909250906116319061162b9084612987565b84612762565b9050600061271061164287846147c7565b61164c91906147f4565b33600090815260e06020526040812080549293508392909190611670908490614668565b90915550600090506116828288614655565b33600090815260e160205260408120805492935083929091906116a6908490614668565b909155505050505050505050505050505050565b6073546060906001600160401b038111156116d7576116d7614711565b60405190808252806020026020018201604052801561171057816020015b6116fd614178565b8152602001906001900390816116f55790505b50905060005b81518110156117db576075600060738381548110611736576117366146fb565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015282518390839081106117c8576117c86146fb565b6020908102919091010152600101611716565b5090565b600054600290610100900460ff16158015611801575060005460ff8083169116105b61181d5760405162461bcd60e51b8152600401610b20906146ad565b6000805461ffff191660ff831617610100179055607154611849906009906001600160a01b0316612779565b606f54611861906005906001600160a01b0316612779565b607054611879906006906001600160a01b0316612779565b606d54611891906007906001600160a01b0316612779565b60a8546118a990600a906001600160a01b0316612779565b607180546001600160a01b0319908116909155606f8054821690556070805482169055606d805482169055606e80548216905560a8805490911690556000805461ff001916905560405160ff82168152600080516020614cb0833981519152906020015b60405180910390a150565b6001600160a01b038116600090815260ac6020526040812054610a2e9060019060ff16600381111561194c5761194c61477f565b90612996565b61195a612647565b610ad8816128f1565b61196b612967565b61197443611bb1565b61199157604051636c74eecf60e01b815260040160405180910390fd5b61199a43611c55565b6119a5600254611c55565b106119c357604051632458f64160e01b815260040160405180910390fd5b4360025560006119d242612733565b905060006119e1826003541090565b905060006119ed611ee6565b9050606060006119fc43611c55565b90506000611a0b826001614668565b90506000611a17610a34565b9050611a2383866129c9565b8515611b4b57600080611a368388612b38565b91509150611a4683888484612d06565b611a4e612e10565b611a56612f64565b6000611a6260066122dc565b604051631da0214360e21b81529091506001600160a01b03821690637680850c90611a93908b908890600401614862565b600060405180830381600087803b158015611aad57600080fd5b505af1158015611ac1573d6000803e3d6000fd5b50505050611ace8a61308d565b8051919950975015611b39576040516303e1697b60e11b81526001600160a01b038216906307c2d2f690611b06908a90600401614464565b600060405180830381600087803b158015611b2057600080fd5b505af1158015611b34573d6000803e3d6000fd5b505050505b611b44436001614668565b6004555050505b611b5687838761321e565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce788604051611b8b911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b600060018054611bc19190614655565b600154611bce9084614884565b1492915050565b611bdd612647565b610ad88161282f565b611bee612647565b611bf78161349f565b611c018282612779565b5050565b600080611c10610a34565b9050610bfd8382612804565b6000806000611c2b8443610a44565b9250925092509193909250565b6001600160a01b0316600090815260746020526040902054151590565b6000610a2e826134cc565b6009611c6b816126e7565b6001600160a01b038316600090815260e860205260409020600181015415611ca65760405163057aab3160e31b815260040160405180910390fd5b6000611cb28442614668565b6001600160a01b0386166000908152607560205260409020909150611cd790826134e7565b6001600160a01b0385166000908152603b602052604080822083905560e554905163138ac02f60e11b81523391632715805e91611d18918a9160040161467b565b6020604051808303816000875af1158015611d37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5b9190614694565b90508015611e5857600060e65442611d739190614668565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038b1617905583865585018190559050611dd161356a565b6001600160a01b0388811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b158015611e3e57600080fd5b505af1158015611e52573d6000803e3d6000fd5b50505050505b856001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c482604051611e9391815260200190565b60405180910390a2505050505050565b6000805b60aa548110156117db57600081815260ab6020526040902054611ed2906001600160a01b0316611918565b15611ede576001909101905b600101611ea7565b606060aa546001600160401b03811115611f0257611f02614711565b604051908082528060200260200182016040528015611f2b578160200160208202803683370190505b50905060005b81518110156117db57600081815260ab602052604090205482516001600160a01b03909116908190849084908110611f6b57611f6b6146fb565b6001600160a01b039092166020928302919091019091015250600101611f31565b60606073805480602002602001604051908101604052809291908181526020018280548015611fe457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611fc6575b5050505050905090565b611ff6612647565b6001600160a01b038216600090815260e8602052604090206001015415611c015760e7548060005b8281101561206d57846001600160a01b031660e78281548110612043576120436146fb565b6000918252602090912001546001600160a01b0316036120655780915061206d565b60010161201e565b5081810361207b5750505050565b6001600160a01b038416600090815260e86020526040902054801561223e576001600160a01b038516600090815260e86020526040812081815560019081019190915583111561213d5760e76120d2600185614655565b815481106120e2576120e26146fb565b60009182526020909120015460e780546001600160a01b03909216918490811061210e5761210e6146fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e780548061214e5761214e614898565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff191660011790556121a084826104b0613598565b156121f957836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e4836040516121ea91815260200190565b60405180910390a35050505050565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a183476040516121ea9291906147b9565b5050505050565b61224d612647565b610ad881612899565b6009612261816126e7565b61226a836135f8565b156122885760405163030081e760e01b815260040160405180910390fd5b6001600160a01b03831660009081526075602052604090206005810154156122c35760405163fab9167360e01b815260040160405180910390fd5b6122d6816122d18542614668565b6134e7565b50505050565b60006122e6613678565b600083600f8111156122fa576122fa61477f565b60ff1681526020810191909152604001600020546001600160a01b0316905080610d10578160405163409140df60e11b8152600401610b2091906148c2565b6009612344816126e7565b6001600160a01b0384166000908152607760205260409020541561237b57604051632f32dcdd60e11b815260040160405180910390fd5b61271082111561239e57604051631b8454a360e21b815260040160405180910390fd5b6076548310156123c15760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03841660009081526077602052604081209062015180856123e982426147f4565b6123f39190614668565b6123fd91906147c7565b808355600183018590556040519091506001600160a01b038716907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f2190611e9390849088906147b9565b6009612452816126e7565b607354607254811061247757604051638616841b60e01b815260040160405180910390fd5b61248085611c38565b1561249e57604051638ad9cdf960e01b815260040160405180910390fd5b6127108311156124c157604051631b8454a360e21b815260040160405180910390fd5b60005b60735481101561257657600060756000607384815481106124e7576124e76146fb565b60009182526020808320909101546001600160a01b0390811684529083019390935260409091019020805490925081169089160361253a578760405163fc3d8c7560e01b8152600401610b20919061440c565b60028101546001600160a01b039081169087160361256d5785604051632d33a7e760e11b8152600401610b20919061440c565b506001016124c4565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b031990811687179091556075909352818420805484168d881690811782559181018054851687179055600281018054909416968b1696871790935560048301899055905191949093909290917f1ca451a9920472b99355a9cf74185bf017604a7849c113f020888ecec9db93669190a450505050505050565b61264f61356a565b6001600160a01b0316336001600160a01b031614610a0b576000356001600160e01b0319166001604051620f948f60ea1b8152600401610b209291906148d0565b60018110156126b2576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a252679060200161190d565b6126f0816122dc565b6001600160a01b0316336001600160a01b031614610ad8576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610b20939291906148f1565b6000610a2e62015180836147f4565b6001600160a01b03919091166000908152603a6020526040902054101590565b6000818310156127725781610bfd565b5090919050565b80612782613678565b600084600f8111156127965761279661477f565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f8111156127d7576127d761477f565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161190d565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161190d565b60a9548111156128bc576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161190d565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161190d565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161190d565b6000610a2e8243612742565b334114610a0b576040516309f358fd60e01b815260040160405180910390fd5b60008183106127725781610bfd565b60008160038111156129aa576129aa61477f565b8360038111156129bc576129bc61477f565b1660ff1615159392505050565b60006129d5600e6122dc565b6001600160a01b031663468d24be84846040518363ffffffff1660e01b8152600401612a02929190614928565b600060405180830381865afa158015612a1f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a47919081019061499c565b905060008251600154612a5a91906147c7565b60e25490915060009081805b8651811015612b095784868281518110612a8257612a826146fb565b602002602001015184612a9591906147c7565b612a9f91906147f4565b93508360e36000898481518110612ab857612ab86146fb565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254612aef9190614668565b90915550612aff90508483614668565b9150600101612a66565b50612b148183614655565b60e46000828254612b259190614668565b9091555050600060e25550505050505050565b6000606060008084516001600160401b03811115612b5857612b58614711565b604051908082528060200260200182016040528015612b81578160200160208202803683370190505b50925060005b8551811015612cfc57858181518110612ba257612ba26146fb565b6020908102919091018101516001600160a01b0380821660009081526075909352604090922060020154909450169150612bdb8361295b565b158015612bef5750612bed8388612804565b155b15612c6d576001600160a01b038316600090815260e16020526040902054612c179086614668565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110612c4857612c486146fb565b602002602001018181525050612c5e838361369c565b612c688383613764565b612cc4565b6001600160a01b038316600090815260e3602090815260408083205460e183528184205460e0909352922054612ca39190614668565b612cad9190614668565b60e46000828254612cbe9190614668565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e3909152812055600101612b87565b5050509250929050565b6000612d1260096122dc565b9050821561223e57612d24818461381f565b15612dcc5760405163566bce2360e11b81526001600160a01b0382169063acd79c4690612d5990879086908a90600401614a61565b600060405180830381600087803b158015612d7357600080fd5b505af1158015612d87573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051612dbe93929190614a97565b60405180910390a1506122d6565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051612e019493929190614acc565b60405180910390a15050505050565b60e754600080805b838310156122d65760e78381548110612e3357612e336146fb565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210612f5957805460e48054600090612e7b908490614668565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055612eaa85614b09565b9450841115612f215760e78481548110612ec657612ec66146fb565b60009182526020909120015460e780546001600160a01b039092169185908110612ef257612ef26146fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612f3257612f32614898565b600082815260209020810160001990810180546001600160a01b0319169055019055612e18565b600190920191612e18565b60e4548015610ad8576000612f7960076122dc565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591612fc69190614b20565b60006040518083038185875af1925050503d8060008114613003576040519150601f19603f3d011682016040523d82523d6000602084013e613008565b606091505b50509050801561304d57816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051610bcf91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051610bcf9291906147b9565b505050565b6060806130998361387b565b905060006130a760096122dc565b6001600160a01b03166391f8723f60736040518263ffffffff1660e01b81526004016130d39190614b4f565b600060405180830381865afa1580156130f0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613118919081019061499c565b90506000613126600a6122dc565b6001600160a01b031663520fce6260736040518263ffffffff1660e01b81526004016131529190614b4f565b600060405180830381865afa15801561316f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613197919081019061499c565b9050600061320660738054806020026020016040519081016040528092919081815260200182805480156131f457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116131d6575b5050505050848460a95460ad54613d65565b9095509050613216858288613e2f565b505050915091565b600061322a60056122dc565b6001600160a01b031663fdadda8183613244436001614668565b6040518363ffffffff1660e01b8152600401613261929190614862565b600060405180830381865afa15801561327e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526132a69190810190614b93565b905060005b82518110156134585760008382815181106132c8576132c86146fb565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906132fd83611918565b9050600061331584613310436001614668565b612742565b80613336575085858151811061332d5761332d6146fb565b60200260200101515b8061333e5750825b1590508115801561334c5750805b156133c7576001600160a01b038416600090815260ac602052604090205461338b9060019060ff1660038111156133855761338561477f565b90613f6f565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156133bd576133bd61477f565b0217905550613449565b8180156133d2575080155b15613449576001600160a01b038416600090815260ac60205260409020546134119060019060ff16600381111561340b5761340b61477f565b90613faa565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156134435761344361477f565b02179055505b846001019450505050506132ab565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261348461113d565b6040516134919190614464565b60405180910390a350505050565b806001600160a01b03163b600003610ad85780604051630bfc64a360e21b8152600401610b20919061440c565b6000600154826134dc91906147f4565b610a2e906001614668565b60018201546134fe906001600160a01b0316611c38565b61351b5760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e79060200160405180910390a25050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146135e8576040519150601f19603f3d011682016040523d82523d6000602084013e6135ed565b606091505b509095945050505050565b600080613605600a6122dc565b6001600160a01b03166341feed1c846040518263ffffffff1660e01b8152600401613630919061440c565b602060405180830381865afa15801561364d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136719190614694565b1192915050565b7fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb90565b6001600160a01b038216600090815260e060205260409020548015613088576136c882826104b0613598565b1561371f57816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec8360405161371291815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516137129291906147b9565b6001600160a01b038216600090815260e3602052604090205480156130885761379082826104b0613598565b156137da57816001600160a01b0316836001600160a01b03167f0c4d6a43fc8470dee97db74874b5685e412cc517d9bdecfde1623c5e835b18e48360405161371291815260200190565b816001600160a01b0316836001600160a01b03167f98697ee35f04a599a814432016fff3968c483d2d88dacb484926b9358f8e7cf983476040516137129291906147b9565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461386c576040519150601f19603f3d011682016040523d82523d6000602084013e613871565b606091505b5090949350505050565b6060600061388960096122dc565b90506000816001600160a01b031663af2454296040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ef9190614694565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139559190614694565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b81526004016139869190614b4f565b600060405180830381865afa1580156139a3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526139cb919081019061499c565b6073549091506000816001600160401b038111156139eb576139eb614711565b604051908082528060200260200182016040528015613a14578160200160208202803683370190505b50965060008060005b84831015613cb65760738381548110613a3857613a386146fb565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110613a8057613a806146fb565b60200260200101511015613adc5780613ad7576000613a9f8a42614668565b600684018190556040518181529091506001600160a01b03851690600080516020614c708339815191529060200160405180910390a2505b613b1d565b8015613b1d578160060160009055826001600160a01b0316600080516020614c708339815191526000604051613b1491815260200190565b60405180910390a25b60008260050154600014158015613b38575042836005015411155b80613b5b57506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015613b78575042846006015411155b90508180613b835750805b15613c155788613b9289614b09565b98508881518110613ba557613ba56146fb565b6020026020010151898781518110613bbf57613bbf6146fb565b602002602001018181525050848d8880600101995081518110613be457613be46146fb565b60200260200101906001600160a01b031690816001600160a01b031681525050613c0d85613fe6565b505050613a1d565b6001600160a01b0385166000908152607760205260409020548015801590613c3d5750428111155b15613ca6576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b505060019094019350613a1d9050565b5050508087528015613d5a577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051613cf19190614464565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90613d27908a908c90600401614862565b600060405180830381600087803b158015613d4157600080fd5b505af1158015613d55573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401613d89959493929190614c21565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b519293506001929091600091613dcc916147c7565b613dd7906040614668565b90506020840181888483895afa613ded57600093505b503d613df857600092505b60208701965082613e1c57604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa54811015613e8357600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055600101613e31565b5060005b82811015613ec357600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff19169055600101613e87565b5060005b82811015613f37576000848281518110613ee357613ee36146fb565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b031916909117905550600101613ec7565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051610bcf9190614464565b6000816003811115613f8357613f8361477f565b836003811115613f9557613f9561477f565b1760ff166003811115610bfd57610bfd61477f565b6000816003811115613fbe57613fbe61477f565b19836003811115613fd157613fd161477f565b1660ff166003811115610bfd57610bfd61477f565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054610ad891839190819003614023575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b0319908116825560018083018054831690556002830180548316905560038301805490921690915560048201859055600582018590556006909101849055607483528184208490556077909252822082815581018290556073805490916140ad91614655565b815481106140bd576140bd6146fb565b6000918252602090912001546001600160a01b03908116915083168114614140576001600160a01b0381166000908152607460205260409020829055607380548291908419908110614111576141116146fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b607380548061415157614151614898565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b0381168114610ad857600080fd5b600080604083850312156141dc57600080fd5b82356141e7816141b4565b915060208301356141f7816141b4565b809150509250929050565b6000806040838503121561421557600080fd5b8235614220816141b4565b946020939093013593505050565b60006020828403121561424057600080fd5b5035919050565b60006020828403121561425957600080fd5b8135610bfd816141b4565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610a2e8284614264565b815181526020808301519082015260408101610a2e565b8015158114610ad857600080fd5b6000806000806080858703121561430157600080fd5b843561430c816141b4565b93506020850135925060408501359150606085013561432a816142dd565b939692955090935050565b8060408101831015610a2e57600080fd5b6000806000806000806000806000806000806101a08d8f03121561436957600080fd5b8c35614374816141b4565b9b5060208d0135614384816141b4565b9a5060408d0135614394816141b4565b995060608d01356143a4816141b4565b985060808d01356143b4816141b4565b975060a08d01356143c4816141b4565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506143fa8e6101608f01614335565b90509295989b509295989b509295989b565b6001600160a01b0391909116815260200190565b600081518084526020808501945080840160005b838110156144595781516001600160a01b031687529582019590820190600101614434565b509495945050505050565b602081526000610bfd6020830184614420565b6000806020838503121561448a57600080fd5b82356001600160401b03808211156144a157600080fd5b818501915085601f8301126144b557600080fd5b8135818111156144c457600080fd5b8660208260051b85010111156144d957600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015614525578351151583529284019291840191600101614507565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561452557614560838551614264565b9284019260e0929092019160010161454d565b803560108110610d1057600080fd5b6000806040838503121561459557600080fd5b6141e783614573565b6000602082840312156145b057600080fd5b610bfd82614573565b6000806000606084860312156145ce57600080fd5b83356145d9816141b4565b95602085013595506040909401359392505050565b6000806000806080858703121561460457600080fd5b843561460f816141b4565b9350602085013561461f816141b4565b9250604085013561462f816141b4565b9396929550929360600135925050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610a2e57610a2e61463f565b80820180821115610a2e57610a2e61463f565b6001600160a01b03929092168252602082015260400190565b6000602082840312156146a657600080fd5b5051919050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6000600182016147395761473961463f565b5060010190565b6000806000806080858703121561475657600080fd5b8451614761816142dd565b60208601516040870151606090970151919890975090945092505050565b634e487b7160e01b600052602160045260246000fd5b82815260408101600383106147ac576147ac61477f565b8260208301529392505050565b918252602082015260400190565b8082028115828204841417610a2e57610a2e61463f565b634e487b7160e01b600052601260045260246000fd5b600082614803576148036147de565b500490565b6000806000806080858703121561481e57600080fd5b505082516020840151604085015160609095015191969095509092509050565b6000806040838503121561485157600080fd5b505080516020909101519092909150565b6040815260006148756040830185614420565b90508260208301529392505050565b600082614893576148936147de565b500690565b634e487b7160e01b600052603160045260246000fd5b601081106148be576148be61477f565b9052565b60208101610a2e82846148ae565b6001600160e01b03198316815260408101600983106147ac576147ac61477f565b6001600160e01b0319841681526060810161490f60208301856148ae565b6001600160a01b03929092166040919091015292915050565b8281526040602082015260006149416040830184614420565b949350505050565b604051601f8201601f191681016001600160401b038111828210171561497157614971614711565b604052919050565b60006001600160401b0382111561499257614992614711565b5060051b60200190565b600060208083850312156149af57600080fd5b82516001600160401b038111156149c557600080fd5b8301601f810185136149d657600080fd5b80516149e96149e482614979565b614949565b81815260059190911b82018301908381019087831115614a0857600080fd5b928401925b82841015614a2657835182529284019290840190614a0d565b979650505050505050565b600081518084526020808501945080840160005b8381101561445957815187529582019590820190600101614a45565b606081526000614a746060830186614420565b8281036020840152614a868186614a31565b915050826040830152949350505050565b838152606060208201526000614ab06060830185614420565b8281036040840152614ac28185614a31565b9695505050505050565b848152608060208201526000614ae56080830186614420565b8281036040840152614af78186614a31565b91505082606083015295945050505050565b600081614b1857614b1861463f565b506000190190565b6000825160005b81811015614b415760208186018101518583015201614b27565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156145255783546001600160a01b031683526001938401939285019201614b6e565b60006020808385031215614ba657600080fd5b82516001600160401b03811115614bbc57600080fd5b8301601f81018513614bcd57600080fd5b8051614bdb6149e482614979565b81815260059190911b82018301908381019087831115614bfa57600080fd5b928401925b82841015614a26578351614c12816142dd565b82529284019290840190614bff565b60a081526000614c3460a0830188614420565b8281036020840152614c468188614a31565b90508281036040840152614c5a8187614a31565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498a264697066735822122085778f06d7c1190376dc1277d04e956cdfa9889848f43b1a34bb67ba0ec4b4ea64736f6c63430008110033" + "numDeployments": 13, + "solcInputHash": "0f25a5224eeb8772a3c38ebf9ab9bb4c", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedEmergencyExit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedRevokingCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedUpdatingCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyWrappedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAtEndOfEpochOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeCoinbase\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ErrCannotBailout\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExceedsMaxNumberOfCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"candidateAdminAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentCandidateAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasuryAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentTreasury\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sendAmount\",\"type\":\"uint256\"}],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaxPrioritizedValidatorNumber\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMinEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"}],\"name\":\"ErrLockedFundMightBeRecycled\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"}],\"name\":\"ErrLockedFundReleaseInfoNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTrustedOrgCannotRenounce\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnauthorizedReceiveRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonExistentRecyclingInfo\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"BlockProducerSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum ICoinbaseExecution.BlockRewardDeprecatedType\",\"name\":\"deprecatedType\",\"type\":\"uint8\"}],\"name\":\"BlockRewardDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submittedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bonusAmount\",\"type\":\"uint256\"}],\"name\":\"BlockRewardSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"CandidateGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"}],\"name\":\"CandidateRevokingTimestampUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"name\":\"CandidateTopupDeadlineUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"CandidatesRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdateScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycleFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleasingFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExpiryDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FastFinalityRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"FastFinalityRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxPrioritizedValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorCandidateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numOfDays\",\"type\":\"uint256\"}],\"name\":\"MinEffectiveDaysOnwardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"StakingRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailedUntil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deductedStakingAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"blockProducerRewardDeprecated\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"bridgeOperatorRewardDeprecated\",\"type\":\"bool\"}],\"name\":\"ValidatorPunished\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"ValidatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"ValidatorUnjailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"periodNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"periodEnding\",\"type\":\"bool\"}],\"name\":\"WrappedUpEpoch\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"checkJailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"blockNum\",\"type\":\"uint256\"}],\"name\":\"checkJailedAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusList\",\"type\":\"address[]\"}],\"name\":\"checkManyJailed\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"candidateIds\",\"type\":\"address[]\"}],\"name\":\"checkManyJailedById\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"checkMiningRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"checkMiningRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriodStartAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExitLockedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochEndingAt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorId\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"execBailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"execChangeAdminAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"newConsensusAddr\",\"type\":\"address\"}],\"name\":\"execChangeConsensusAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"execChangeTreasuryAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"execReleaseLockedFundForEmergencyExitRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"secLeftToRevoke\",\"type\":\"uint256\"}],\"name\":\"execRequestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"secsLeft\",\"type\":\"uint256\"}],\"name\":\"execRequestRenounceCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"cid\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"name\":\"execRequestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorId\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newJailedUntil\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"cannotBailout\",\"type\":\"bool\"}],\"name\":\"execSlash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockProducers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"getCandidateInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"__shadowedAdmin\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"__shadowedConsensus\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"__shadowedTreasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"____deprecatedBridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCandidateInfos\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"__shadowedAdmin\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"__shadowedConsensus\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"__shadowedTreasury\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"____deprecatedBridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate[]\",\"name\":\"list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"getCommissionChangeSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.CommissionSchedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"getEmergencyExitInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"recyclingAt\",\"type\":\"uint256\"}],\"internalType\":\"struct ICommonInfo.EmergencyExitInfo\",\"name\":\"_info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"getJailedTimeLeft\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"getJailedTimeLeftAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastUpdatedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorCandidates\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"validatorList_\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__slashIndicatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingVestingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorCandidate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxPrioritizedValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__minEffectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__numberOfBlocksInEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256[2]\",\"name\":\"__emergencyExitConfigs\",\"type\":\"uint256[2]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"fastFinalityTrackingContract\",\"type\":\"address\"}],\"name\":\"initializeV3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"profileContract\",\"type\":\"address\"}],\"name\":\"initializeV4\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"isBlockProducer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"isCandidateAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPeriodEnding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"isValidatorCandidate\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPrioritizedValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumPrioritizedValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorCandidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minEffectiveDaysOnward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfBlocksInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompilePickValidatorSetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileSortValidatorsAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExitLockedAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxPrioritizedValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_max\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numOfDays\",\"type\":\"uint256\"}],\"name\":\"setMinEffectiveDaysOnwards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"submitBlockReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBlockProducer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDeprecatedReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"tryGetPeriodOfEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_filled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_periodNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrapUpEpoch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyRequestedEmergencyExit()\":[{\"details\":\"Error of already requested emergency exit before.\"}],\"ErrAlreadyRequestedRevokingCandidate()\":[{\"details\":\"Error of already requested revoking candidate before.\"}],\"ErrAlreadyRequestedUpdatingCommissionRate()\":[{\"details\":\"Error of commission change schedule exists.\"}],\"ErrAlreadyWrappedEpoch()\":[{\"details\":\"Error of query for already wrapped up epoch\"}],\"ErrAtEndOfEpochOnly()\":[{\"details\":\"Error of only allowed at the end of epoch\"}],\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeCoinbase()\":[{\"details\":\"Error of method caller must be coinbase\"}],\"ErrCannotBailout(address)\":[{\"details\":\"Error of cannot bailout due to high tier slash.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrExceedsMaxNumberOfCandidate()\":[{\"details\":\"Error of exceeding maximum number of candidates.\"}],\"ErrExistentCandidate()\":[{\"details\":\"Error of querying for already existent candidate.\"}],\"ErrExistentCandidateAdmin(address)\":[{\"details\":\"Error of candidate admin already exists.\"}],\"ErrExistentTreasury(address)\":[{\"details\":\"Error of treasury already exists.\"}],\"ErrInsufficientBalance(bytes4,uint256,uint256)\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of invalid commission rate.\"}],\"ErrInvalidEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid effective days onwards.\"}],\"ErrInvalidMaxPrioritizedValidatorNumber()\":[{\"details\":\"Error thrown when an invalid maximum prioritized validator number is provided.\"}],\"ErrInvalidMinEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid min effective days onwards.\"}],\"ErrLockedFundMightBeRecycled(address)\":[{\"details\":\"Error thrown when the the locked fund of emergency exit might be recycled.\"}],\"ErrLockedFundReleaseInfoNotFound(address)\":[{\"details\":\"Error thrown when the info of releasing locked fund not exist.\"}],\"ErrNonExistentCandidate()\":[{\"details\":\"Error of querying for non-existent candidate.\"}],\"ErrRecipientRevert(bytes4)\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrTrustedOrgCannotRenounce()\":[{\"details\":\"Error of trusted org cannot renounce.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnauthorizedReceiveRON()\":[{\"details\":\"Error thrown when receives RON from neither staking vesting contract nor staking contract\"}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}],\"NonExistentRecyclingInfo()\":[{\"details\":\"Error thrown when queries for a non existent info.\"}]},\"events\":{\"BlockProducerSetUpdated(uint256,uint256,address[])\":{\"details\":\"Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\"},\"BlockRewardDeprecated(address,uint256,uint8)\":{\"details\":\"Emitted when the reward of the block producer is deprecated.\"},\"BlockRewardSubmitted(address,uint256,uint256)\":{\"details\":\"Emitted when the block reward is submitted.\"},\"BridgeOperatorRewardDistributed(address,address,address,uint256)\":{\"details\":\"Emitted when the bridge operator reward is distributed.\"},\"BridgeOperatorRewardDistributionFailed(address,address,address,uint256,uint256)\":{\"details\":\"Emitted when the contract fails when distributing the bridge operator reward.\"},\"BridgeOperatorSetUpdated(uint256,uint256,address[])\":{\"details\":\"Emitted when the bridge operator set is updated.\"},\"CandidateGranted(address,address,address)\":{\"details\":\"Emitted when the validator candidate is granted.\"},\"CandidateRevokingTimestampUpdated(address,uint256)\":{\"details\":\"Emitted when the revoking timestamp of a candidate is updated.\"},\"CandidateTopupDeadlineUpdated(address,uint256)\":{\"details\":\"Emitted when the topup deadline of a candidate is updated.\"},\"CandidatesRevoked(address[])\":{\"details\":\"Emitted when the validator candidate is revoked.\"},\"CommissionRateUpdateScheduled(address,uint256,uint256)\":{\"details\":\"Emitted when a schedule for updating commission rate is set.\"},\"CommissionRateUpdated(address,uint256)\":{\"details\":\"Emitted when the commission rate of a validator is updated.\"},\"ContractUpdated(uint8,address)\":{\"details\":\"Emitted when a contract is updated.\"},\"DeprecatedRewardRecycleFailed(address,uint256,uint256)\":{\"details\":\"Emitted when the deprecated reward withdrawal is failed\"},\"DeprecatedRewardRecycled(address,uint256)\":{\"details\":\"Emitted when the deprecated reward is withdrawn.\"},\"EmergencyExitLockedAmountUpdated(uint256)\":{\"details\":\"Emitted when the emergency exit locked amount is updated.\"},\"EmergencyExitLockedFundReleased(address,address,uint256)\":{\"details\":\"Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\"},\"EmergencyExitLockedFundReleasingFailed(address,address,uint256,uint256)\":{\"details\":\"Emitted when the fund that locked from an emergency exit request is failed to transferred back.\"},\"EmergencyExitRequested(address,uint256)\":{\"details\":\"Emitted when the fund is locked from an emergency exit request\"},\"EmergencyExpiryDurationUpdated(uint256)\":{\"details\":\"Emitted when the emergency expiry duration is updated.\"},\"FastFinalityRewardDistributed(address,address,uint256)\":{\"details\":\"Emitted when the fast finality reward is distributed.\"},\"FastFinalityRewardDistributionFailed(address,address,uint256,uint256)\":{\"details\":\"Emitted when the contract fails when distributing the fast finality reward.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"MaxPrioritizedValidatorNumberUpdated(uint256)\":{\"details\":\"Emitted when the number of reserved slots for prioritized validators is updated.\"},\"MaxValidatorCandidateUpdated(uint256)\":{\"details\":\"Emitted when the maximum number of validator candidates is updated.\"},\"MaxValidatorNumberUpdated(uint256)\":{\"details\":\"Emitted when the number of max validator is updated.\"},\"MinEffectiveDaysOnwardsUpdated(uint256)\":{\"details\":\"Emitted when the min offset to the effective date of commission rate change is updated.\"},\"MiningRewardDistributed(address,address,uint256)\":{\"details\":\"Emitted when the block producer reward is distributed.\"},\"MiningRewardDistributionFailed(address,address,uint256,uint256)\":{\"details\":\"Emitted when the contract fails when distributing the block producer reward.\"},\"StakingRewardDistributed(uint256,address[],uint256[])\":{\"details\":\"Emitted when the amount of RON reward is distributed to staking contract.\"},\"StakingRewardDistributionFailed(uint256,address[],uint256[],uint256)\":{\"details\":\"Emitted when the contracts fails when distributing the amount of RON to the staking contract.\"},\"ValidatorPunished(address,uint256,uint256,uint256,bool,bool)\":{\"details\":\"Emitted when the validator is punished.\"},\"ValidatorSetUpdated(uint256,address[])\":{\"details\":\"Emitted when the validator set is updated\"},\"ValidatorUnjailed(address,uint256)\":{\"details\":\"Emitted when the validator get out of jail by bailout.\"},\"WrappedUpEpoch(uint256,uint256,bool)\":{\"details\":\"Emitted when the epoch is wrapped up.\"}},\"kind\":\"dev\",\"methods\":{\"checkJailed(address)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\"},\"checkJailedAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\"},\"checkManyJailed(address[])\":{\"details\":\"Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\"},\"checkMiningRewardDeprecated(address)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during the current period.\"},\"checkMiningRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during a specific period.\"},\"currentPeriod()\":{\"details\":\"Returns the period index from the current block.\"},\"currentPeriodStartAtBlock()\":{\"details\":\"Returns the block number that the current period starts at.\"},\"emergencyExitLockedAmount()\":{\"details\":\"Returns the amount of RON to lock from a consensus address.\"},\"emergencyExpiryDuration()\":{\"details\":\"Returns the duration that an emergency request is expired and the fund will be recycled.\"},\"epochEndingAt(uint256)\":{\"details\":\"Returns whether the epoch ending is at the block number `_block`.\"},\"epochOf(uint256)\":{\"details\":\"Returns the epoch index from the block number.\"},\"execApplyValidatorCandidate(address,address,address,uint256)\":{\"details\":\"Grants a validator candidate. Requirements: - The method caller is staking contract. Emits the event `CandidateGranted`.\"},\"execBailOut(address,uint256)\":{\"details\":\"Finalize the bailout request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorUnjailed`.\"},\"execChangeAdminAddress(address,address)\":{\"details\":\"Fallback function of `Profile-requestChangeAdminAddress`. This updates the shadow storage slot of \\\"shadowedAdmin\\\" for candidate id `id` to `newAdmin`. Requirements: - The caller must be the Profile contract.\"},\"execChangeConsensusAddress(address,address)\":{\"details\":\"Fallback function of `Profile-requestChangeConsensusAddress`. This updates the shadow storage slot of \\\"shadowedConsensus\\\" for candidate id `id` to `newAdmin`. Requirements: - The caller must be the Profile contract.\"},\"execChangeTreasuryAddress(address,address)\":{\"details\":\"Fallback function of `Profile-requestChangeTreasuryAddress`. This updates the shadow storage slot of \\\"shadowedTreasury\\\" for candidate id `id` to `newAdmin`. Requirements: - The caller must be the Profile contract.\"},\"execReleaseLockedFundForEmergencyExitRequest(address,address)\":{\"details\":\"Unlocks fund for emergency exit request. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked. Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\"},\"execRequestEmergencyExit(address,uint256)\":{\"details\":\"Fallback function of `IStaking-requestEmergencyExit`. Requirements: - The method caller is staking contract.\"},\"execRequestRenounceCandidate(address,uint256)\":{\"details\":\"Requests to revoke a validator candidate in next `secsLeft` seconds. Requirements: - The method caller is staking contract. Emits the event `CandidateRevokingTimestampUpdated`.\"},\"execRequestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Fallback function of `CandidateStaking-requestUpdateCommissionRate`. Requirements: - The method caller is the staking contract. - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - The `rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdateScheduled`.\"},\"execSlash(address,uint256,uint256,bool)\":{\"details\":\"Finalize the slash request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorPunished`.\"},\"getBlockProducers()\":{\"details\":\"Returns the current block producer list.\"},\"getCandidateInfo(address)\":{\"details\":\"Returns the info of a candidate.\"},\"getCandidateInfos()\":{\"details\":\"Returns all candidate info.\"},\"getCommissionChangeSchedule(address)\":{\"details\":\"Returns the schedule of changing commission rate of a candidate address.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getEmergencyExitInfo(address)\":{\"details\":\"Returns the emergency exit request.\"},\"getJailedTimeLeft(address)\":{\"details\":\"Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\"},\"getJailedTimeLeftAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\"},\"getLastUpdatedBlock()\":{\"details\":\"Returns the block that validator set was updated.\"},\"getValidatorCandidates()\":{\"details\":\"Returns the validator candidate.\"},\"getValidators()\":{\"details\":\"Returns the current validator list.\"},\"initialize(address,address,address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256[2])\":{\"details\":\"Initializes the contract storage.\"},\"isBlockProducer(address)\":{\"details\":\"Returns whether the address is block producer or not.\"},\"isCandidateAdmin(address,address)\":{\"details\":\"Returns whether the address is the candidate admin.\"},\"isPeriodEnding()\":{\"details\":\"Returns whether the period ending at the current block number.\"},\"isValidatorCandidate(address)\":{\"details\":\"Returns whether the address is a validator (candidate).\"},\"maxPrioritizedValidatorNumber()\":{\"details\":\"Returns the number of reserved slots for prioritized validators.\"},\"maxValidatorCandidate()\":{\"details\":\"Returns the maximum number of validator candidate.\"},\"maxValidatorNumber()\":{\"details\":\"Returns the maximum number of validators in the epoch.\"},\"minEffectiveDaysOnward()\":{\"details\":\"Returns the minimum number of days to the effective date of commission rate change.\"},\"numberOfBlocksInEpoch()\":{\"details\":\"Returns the number of blocks in a epoch.\"},\"precompilePickValidatorSetAddress()\":{\"details\":\"Gets the address of the precompile of picking validator set\"},\"precompileSortValidatorsAddress()\":{\"details\":\"Gets the address of the precompile of sorting validators\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setEmergencyExitLockedAmount(uint256)\":{\"details\":\"Sets the amount of RON to lock from a consensus address. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedAmountUpdated`.\"},\"setEmergencyExpiryDuration(uint256)\":{\"details\":\"Sets the duration that an emergency request is expired and the fund will be recycled. Requirements: - The method caller is admin. Emits the event `EmergencyExpiryDurationUpdated`.\"},\"setMaxPrioritizedValidatorNumber(uint256)\":{\"details\":\"Updates the number of reserved slots for prioritized validators Requirements: - The method caller is admin Emits the event `MaxPrioritizedValidatorNumberUpdated`\"},\"setMaxValidatorCandidate(uint256)\":{\"details\":\"Sets the maximum number of validator candidate. Requirements: - The method caller is admin. Emits the `MaxValidatorCandidateUpdated` event.\"},\"setMaxValidatorNumber(uint256)\":{\"details\":\"Updates the max validator number Requirements: - The method caller is admin Emits the event `MaxValidatorNumberUpdated`\"},\"setMinEffectiveDaysOnwards(uint256)\":{\"details\":\"Sets the minimum number of days to the effective date of commision rate change. Requirements: - The method caller is admin. Emits the `MinEffectiveDaysOnwardsUpdated` event.\"},\"submitBlockReward()\":{\"details\":\"Submits reward of the current block. Requirements: - The method caller is coinbase. Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer. Emits the event `BlockRewardSubmitted` for the valid call.\"},\"totalBlockProducer()\":{\"details\":\"Returns total numbers of the block producers.\"},\"totalDeprecatedReward()\":{\"details\":\"Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\"},\"tryGetPeriodOfEpoch(uint256)\":{\"details\":\"Tries to get the period index from the epoch number.\"},\"wrapUpEpoch()\":{\"details\":\"Wraps up the current epoch. Requirements: - The method must be called when the current epoch is ending. - The epoch is not wrapped yet. - The method caller is coinbase. Emits the event `MiningRewardDistributed` when some validator has reward distributed. Emits the event `StakingRewardDistributed` when some staking pool has reward distributed. Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up. Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending. Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated. Emits the event `WrappedUpEpoch`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/validator/RoninValidatorSet.sol\":\"RoninValidatorSet\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\"},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://383fb7b8181016ac5ccf07bc9cdb7c1b5045ea36e2cc4df52bcbf20396fc7688\",\"dweb:/ipfs/QmYJ7Cg4WmE3rR8KGQxjUCXFfTH6TcwZ2Z1f6tPrq7jHFr\"]},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://96b6d77a20bebd4eb06b801d3d020c7e82be13bd535cb0d0a6b7181c51dab5d5\",\"dweb:/ipfs/QmPUR9Cv9jNFdQX6PtBfaBW1ZCnKwiu65R2VD5kbdanDyn\"]},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://89c2a0f70157c13845be5cb49b078a6374fee3a78fa950052a3af26190255da8\",\"dweb:/ipfs/QmUcvMEQH1oMM2pUyMuDiBUKdvvnTz1NRB8bmPHrVq8725\"]},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8831721b6f4cc26534d190f9f1631c3f59c9ff38efdd911f85e0882b8e360472\",\"dweb:/ipfs/QmQZnLErZNStirSQ13ZNWQgvEYUtGE5tXYwn4QUPaVUfPN\"]},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ada1e030c0231db8d143b44ce92b4d1158eedb087880cad6d8cc7bd7ebe7b354\",\"dweb:/ipfs/QmWZ2NHZweRpz1U9GF6R1h65ri76dnX7fNxLBeM2t5N5Ce\"]},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a6c4477d480bac20d681ade0e712b77ad828acf530a1d5c0abc5fb78068a05a1\",\"dweb:/ipfs/QmdBqsK8CcUceTeWzhHwFDEvKMoHimwtV96Lbim7ZBtCb8\"]},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3313a8f9bb1f9476857c9050067b31982bf2140b83d84f3bc0cec1f62bbe947f\",\"dweb:/ipfs/Qma17Pk8NRe7aB4UD3jjVxk7nSFaov3eQyv86hcyqkwJRV\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35c47bece3c03caaa07fab37dd2bb3413bfbca20db7bd9895024390e0a469487\",\"dweb:/ipfs/QmPGWT2x3QHcKxqe6gRmAkdakhbaRgx3DLzcakHz5M4eXG\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://39e096c60a6eb1c6a257122d515496bd92d0c6a693a8f07acb6aa4b1263e95d4\",\"dweb:/ipfs/QmPs5trJBacCiSkezP6tpevapuRYWNY6mqSFzsMCJj7e6B\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/extensions/RONTransferHelper.sol\":{\"keccak256\":\"0xdece837caa8da00fe031b8139ada009330b8bef149af12b535913c021ab94d0e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11af5018dd76ccfca6c4cfb886019987d88830c02efcec999c02d3e6d907475a\",\"dweb:/ipfs/QmNyEcRDvrCENivjdmw3TxMFDBcQNvEUzHorra7HkERLWf\"]},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://370c93bc1e962fcf8eab41d217d901716769f05c51a2cb25aae12abc84e871da\",\"dweb:/ipfs/QmQYL5QrJmXCdi5UN9K7imt1iPm9ydZQm6ifShpt451afd\"]},\"contracts/extensions/collections/HasContracts.sol\":{\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b8903232a7a609b250a1ff2e9522a2366979652145af74637f9c0089916e3da3\",\"dweb:/ipfs/QmVoxZamJEhjYhr9RKVSAKGzakgqmFLfZXhZcDGor7DZe5\"]},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2e220c59eb50b4e206d0a126f8cd2f7f2aa6865f56a0b4b091149e6928bf97b8\",\"dweb:/ipfs/QmRBk5hhn1w2MghZ8pRfaU1CvgRAZN7nZvxySSPDvkVuGp\"]},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://23a7906515d4648b243fb01f8053b1595e8c1c62fa9745b56ed296372da6ebdf\",\"dweb:/ipfs/QmdUjefqn52Hu7bjAKYJMRanPy7fdKqJAtnqSB2793Zhfm\"]},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e97f64c7f3522d605c5e8d6d96d568e0b8cb6b2f21cc288d508cbe43b831f5d9\",\"dweb:/ipfs/QmT9hBanREurnngznkfTAhHu4qDQu3F3hPXTzKgKjSWz7r\"]},\"contracts/interfaces/IFastFinalityTracking.sol\":{\"keccak256\":\"0xdc397642692af9710314e971f8de772d50d6bc304db9e5babd9ffcfb9d2f4434\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f43513532d979a1c4ff09c5b7b5b0b85ce19317e06d36a5b0215591f7d1f821\",\"dweb:/ipfs/QmQKKnarmdrYuoMAiA5aR1PJFCXnMrqgMm77oQU6mSVQVw\"]},\"contracts/interfaces/IMaintenance.sol\":{\"keccak256\":\"0xa0e68b1e94b0d7ea96578ad759e1116a3299059cf7d376b8e2556687d1ef63f0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://aad8ee9be4151d065a7c5036db8467a01922cd812239756d3d51ff29b78f9bfe\",\"dweb:/ipfs/QmTkyHz2PP8MxGtWHZV3WESymw4FH4uvLXmLNr5hQkifhS\"]},\"contracts/interfaces/IProfile.sol\":{\"keccak256\":\"0x14dfb3198bf21724f5315198e1b23564902821ef56730c7db49e3d1165a36d36\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bf0ca96491007281755f25cfb98f28273621e126a4e47a9e0874d276ae1b711f\",\"dweb:/ipfs/QmTUR5CH8wdTjMciqzzTMGtm4cM2ygyTFSk24B4wxrwteA\"]},\"contracts/interfaces/IQuorum.sol\":{\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a8c81134e4632e1240aead39fd5393b376a4be53668caf2a390f511f3c6d422d\",\"dweb:/ipfs/QmWPaQPP1WkpdPjLhK7wFXsih8HWs6kRQqjX5zGLu6McGH\"]},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"keccak256\":\"0x1dc70b2e42a8c5f537daacf328b1244a0a21b65be13d535ff239c60707b03923\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ca4e09edf7e0492a947a025e4d35709fe64d6dfbbea854044d5d71e2ef3ac47c\",\"dweb:/ipfs/QmP1v5bXH6w5NfBYcagC2RMYSzZH4gkdZ7mpmv5j8rvBd9\"]},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"keccak256\":\"0x0b2a44131128f965e20cbea424987817cb504502e5d83d6523ae45ffeb5e53fe\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ed2c16c826aaabe81998d8820c4ac77251692473fb3a3f9f483b18a9d0f9e19\",\"dweb:/ipfs/QmTBR8xprNkfPUhZtgXAj78cTvCfefXUzNeUubSJdhVtop\"]},\"contracts/interfaces/IStakingVesting.sol\":{\"keccak256\":\"0x4930321a5b4db60327df3f6f2dad22ae003446c40fbfd582e7173c8997b1f754\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8de00b8101b3407bca9e51768935275c976604d3c7e0a4c953d64e40b19e82f5\",\"dweb:/ipfs/QmTiGr6jNZ8LfLLihFBemHUbSUc38xTt4RY5spatp2bchv\"]},\"contracts/interfaces/collections/IHasContracts.sol\":{\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://03390ff29b496e244faf4eab55565712f0aea5fecdcb915e3c5866ef29d5686d\",\"dweb:/ipfs/QmdGpXn3VSxfNvjFBxfho7rc41JTq5m6bonrfmpzShhRVs\"]},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f158da03631d0e3c4558a18fc50e7f2416172983cfbb14a158dd4fc7c83c7053\",\"dweb:/ipfs/QmX8Vq2sKEAckrMEN5W5LaUzE7ppdaR7scv8amyV1YEXGG\"]},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"keccak256\":\"0x2e09934977e0701a28b7f776f0bd4eefdfd8d6b68134822440b2c756b6b7d1e4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e6dad2674e816cc50055f86b36321aa00c786e0f729961a812486ad86990ca98\",\"dweb:/ipfs/QmTZLuEScB3rRjDN7VVpp3LUhRbQyKyfXwvMMwQehxjGcj\"]},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"keccak256\":\"0x3cf62e68ac61811a4514be28eb75e37c12f977fb10d442e92be43605ae405a91\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a6b1cdd45eedd32784dbc8087be7782457fa635a69e123ed754319706210d5de\",\"dweb:/ipfs/QmXHtDRsg22qmKZHGKjqpkR7hk86YyB3MVPSadmLm3KiHS\"]},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"keccak256\":\"0xb9bcab2333ef220db67a51edc072afa9dae94e261177cfddb601da0c0be04bdd\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3a2fc68823ec8457c44910f3110f7f447a5c10653abb8113ba720dcf09cdb12f\",\"dweb:/ipfs/QmVELbxCWp42dyxTy9QCeqnTa4r8Th4jUzETpCgq1UPd2k\"]},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"keccak256\":\"0x2908d4111459fda33a8bedb4c66cbcbe9ae5ab2aa9c0ae2ca05e9ba9a93d9e5e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://aa0ac19c74d88bf6327b9cce592e23ad53ec9e77937429f219e2dd86f17834fb\",\"dweb:/ipfs/QmSjtcMckx7wbR5odykgx2YidZS6kWfvswiRdhsai6KEES\"]},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"keccak256\":\"0x1a30a9edd2eb5593e1da65210dcd712173b9702d6814f4fb31f800efb5f2098b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ad65a61ec24c14f7e174a9fea88b465f45a63e3eee055269a33c90c8d332f3fd\",\"dweb:/ipfs/Qma8dgtVknhusA7BKo6x2CeRRmTggGuUuov3cowyVaJb9N\"]},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"keccak256\":\"0xadaec16c22c590a42070d5e41fcc83c9fa89a4134528dd2159b5946ecbc64253\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://80a5a877f057772f3b1eed27e32f55e705540964da1328cde418df81919bf5e4\",\"dweb:/ipfs/QmQhJo2K6P1fTjePfc7oifpvqVKNh9soNetp638Bmc9VbY\"]},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"keccak256\":\"0x8880174d4be9ceeed98a1f1cda5e833ce2afe8ee8b0e5921088a796a9a9bc69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b03a41e44bf364b8f49857c2ba14b50490b7cfeb151a89115e85dc7933b3b840\",\"dweb:/ipfs/QmW2pgrzscsxiSbzbVXQnR5pSHf72D8WuhqcEhfqTPpYfn\"]},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"keccak256\":\"0xe8a650a7348d45b2614ece66083f140801e8375bb8b733addf02209073991ef3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e8145afcc8c57a3dc006f2bfc1a8854f60504ee13deeab26907c954b30b6c4af\",\"dweb:/ipfs/QmRP1jx96nPcQ6kDvHbTk29KV7wZQ8TiCswvqj67dSzbXx\"]},\"contracts/interfaces/staking/IRewardPool.sol\":{\"keccak256\":\"0x69626097d76dde60ce9fc73c6f8823ad7e8a5b6ff23ec3f20b9e1499f700d1b8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://36a6415fc600aad2bc0d0eb7b7c4bef82999183592ec0f256d698119405d011b\",\"dweb:/ipfs/QmX1s9xEXGUJ3xunUeXju8uNZ4xwUF7WZmzzQqCrX9a2NQ\"]},\"contracts/interfaces/staking/IStaking.sol\":{\"keccak256\":\"0xaa2491ed5276434d2a894ece749ad15835ff2791fa614d3cf3b58c0bdd418881\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dbe97557e9ac638a49a1a5b0548af8c43d0c1e4b2c7f49264ffab6d735202e23\",\"dweb:/ipfs/QmcqPw11muqvrMRrufnb7yyHemHmnhQKQiKGhVStnc2MvJ\"]},\"contracts/interfaces/staking/IStakingCallback.sol\":{\"keccak256\":\"0x64e1659e4fb15498be8956f696e72e4c7370cc7439ab5395c94f24e85b92e85b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://60f265a75f3ee5ee6c84c385954f7c8f1f6b0a00b0ffbbffcfcf7507333bb9d8\",\"dweb:/ipfs/QmXBEAHUp8uwDKmQVXxzKqmz1YSdp9LdUazL7McUWEHaeC\"]},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"keccak256\":\"0xd797160208b17456231633415848fffa0a5ba7e9ab7f81b241d1bd89c74c2c83\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ade59389c9bc021f93bd75a71229f52bfdcd1c7568544a6b81df83bc54c2d60e\",\"dweb:/ipfs/QmaG2qoxCofyzTj9AYChvDurKDER1arcRTvCXKffEUkGbN\"]},\"contracts/interfaces/validator/ICandidateManagerCallback.sol\":{\"keccak256\":\"0x0f241310c7f284374c26792fe73230a3b2cabc709d04f28a7b366292821f96dc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c4fbed28d3ad04d19a4d0cf09d854a805c538f0abf253a1b5a5c8d0124ac5afe\",\"dweb:/ipfs/QmQ7ZAJycWZbDCviwY1ofgjoMqYctuEBrAGPtS1Ac7oLL8\"]},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e6c058176001fdf5c3568e3bef95dbd0616f29136f6488457bac313b49cf8307\",\"dweb:/ipfs/QmYCxycKBcX815zGkXPDBC3t2CgqJwZNHcvtKA9ssc4fMq\"]},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"keccak256\":\"0x98caa14d1e6dc6a9ab6d09c864a32790014890f9e2ad7951b77ff5658e0f7c8b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d41b85fa77e4816bb0d2eeb68dfb67d6c8337231441708fc5eb9184e4c7b9c73\",\"dweb:/ipfs/QmQSHoEoVa7u8St13TX75jKFTbrAEqg2RJeAViNHdyBMvL\"]},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"keccak256\":\"0xf4f96a624e7c77bbce044c67e3f4b406e65871debc19e7bfab663c1fcfcbc7b0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0974304882b7e7b50de6784df2e3320c832f50d1b676ec5e7a2f9c143c8c30c2\",\"dweb:/ipfs/QmPsgH4StFT8ytxJca5FixhbctRe1xvQK3ihzS4QhMH37k\"]},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"keccak256\":\"0xbf540beae3c94d2b42e7bbb74f921086c23613fa4db43a5ca5310cb179b46d5e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9cbe104c4afa9d39f7d7ca182084bde84d6151afd7eda56ba8fffaca39f22f57\",\"dweb:/ipfs/QmXDoWrCFNtyg8FuZEyVwnsvgS9FeWLi8GuFDUgh9uxpa1\"]},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"keccak256\":\"0xb63c6a5edcc82cc04af534e8398eee9a805bb9cb179f3e00750e6ff92354bed9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e7772e5e6f714104c3d468d7987fb45cd342947d8f3467a1c4c8b4fd33c6ab93\",\"dweb:/ipfs/QmbJ5cQKJmf5mJxvnh73quvstNVCkrPHZmFTG8nK4Adhx6\"]},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"keccak256\":\"0x27afa712094804b997f55e8f8d320760e07d7260ab33aeb8fb61c39849f09bf3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://91ba3d3557b79929afe4f73a5c33240d058a8fb1f8421982ca37db1a824e3332\",\"dweb:/ipfs/QmQfnW2zEk5rrFhnFd2Lc2TW2ZtNyCX65BknEnrCBFmTV3\"]},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a0c87e2e9c661730fdecd3cacc54a630ac2dfd35218dcbe41b70bb15d16aea2\",\"dweb:/ipfs/QmcLD62ZZ6YVSECvx7515PVXymbP8SRwayZsy6r4NAiPLJ\"]},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"keccak256\":\"0x45ba68ae461f9c8ecde0fb3c7db78d6d9f44a4a6cc0f03e7b8edad0cced55643\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3fc41e8c5fb9d6f3e52942747d6e077575ff9a2dd72ffabb56f75c1460124c43\",\"dweb:/ipfs/QmPg8XG217B9SnUXbn1JoUhhn7pohfmp66CTHYvEuL9mtG\"]},\"contracts/libraries/AddressArrayUtils.sol\":{\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://3a413f290b8e81540bc6feb739bcfbacf56419b2e657bbce5be43826569b4406\",\"dweb:/ipfs/QmWRjGLBXs7WK92oPm51QpjxMYGuMTBx85Pv7QcGbUZE72\"]},\"contracts/libraries/EnumFlags.sol\":{\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://1b05f2717fd40454d68d411ab7bbbf5e3bb8ea6d7f27d335b1338362305904a2\",\"dweb:/ipfs/QmaiGASjWNVyfFzguu5xoKFRcLqGg67DHSd5422b5k6rbb\"]},\"contracts/libraries/Math.sol\":{\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://b4af5bb4d7c57d10844b31211dc52762f69c33f99fe90bf8bd4086b0f7ece4da\",\"dweb:/ipfs/Qma1Gtmp2Y5YMxAXS7XpUQHkc4auz95W6CevSLmD5CFrrB\"]},\"contracts/precompile-usages/PCUPickValidatorSet.sol\":{\"keccak256\":\"0xcb57a021897a773d11be9d98a195e0653f2124b7e95e84c4832b57d9d36d67e1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://62cfabee3f0ad5ab8ba6b5f318ff33e68a3e532649a958b51fac6ae559ca95c0\",\"dweb:/ipfs/QmPJkxM87o2LGsqSRgTQnnaZJtZRXeRu7ZbGzwNXggMCsr\"]},\"contracts/precompile-usages/PCUSortValidators.sol\":{\"keccak256\":\"0xf2f21d25f9d1b77e591542440c839d98125ae3c41c73de7c42f8c46d95eac717\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://52b9340ff9f29ef0bcf0552142fe1df4036bdea579bf0d023bd3e65d0f706233\",\"dweb:/ipfs/Qmbv3QcysrYQiZiGC9A9Hj6EPRPu52fWFHDhmyX5nfUoqn\"]},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d7c9e940ba3e89d832b615239ba9e4af44471b3701bd1f480924a7e2c434f63\",\"dweb:/ipfs/QmPtxtdPgTzyw7WpzpLBCX7anYbq5q7zwarz1PzVAFX4zz\"]},\"contracts/ronin/validator/CandidateManager.sol\":{\"keccak256\":\"0xbfb3664d1979195caa8068aa8cb0740ac8809117abccf6867fb7a6cf00a2e33d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://49b4a00391472204283c546adf46873a98e46d76e87586f2f2eee34c23a5b6b4\",\"dweb:/ipfs/QmXWmsrTzZmwP2pC613Hwm3WEsME7ntyBsHDMEz6aPUJfh\"]},\"contracts/ronin/validator/CandidateManagerCallback.sol\":{\"keccak256\":\"0x8ae35a97f2ed19bdbead9fc8b1cfb4c4355fa6e10aa05bc7cc6dfbde32056ae0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e4dd5c33d8b7f22d15c64173a12456e21fb26215fab6de814110f1efba49e556\",\"dweb:/ipfs/QmfK7N1gy1hdx1SNQw7bdRKykAAUR4yBQFLCiobTKQ72Ez\"]},\"contracts/ronin/validator/CoinbaseExecution.sol\":{\"keccak256\":\"0x893144385df92f6c116ad8450fc56b94207dc22b149ccb360830bb017e445c20\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a2b8b1251d15a218a0fb42af60b1f9c59c85c61dfbd828b95ac7e656d72afb0\",\"dweb:/ipfs/QmehDmAbhuhZyku5FkMPYrH9shggtFRrqgPDWSj6ZBGeQA\"]},\"contracts/ronin/validator/EmergencyExit.sol\":{\"keccak256\":\"0x5e12547ba805265cbe9318ee01c60d58d216735fed2167dc17883bb39dce3b2d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a001f5da023730cb42301bf95ebc7d1b492bfdf5649ef3bac26598399aa586db\",\"dweb:/ipfs/QmUArabPP9URzieNaVL3s5xm67U56Y3pMAoDe7vca5DiPF\"]},\"contracts/ronin/validator/RoninValidatorSet.sol\":{\"keccak256\":\"0xa50b69b036c56563c8e81c4be3475ea37983e5615caa60be4dad5ef1e4bd60b6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d8b5599e68fab2a910667fd21ea863c581a5f847d5295a2c42d1d3577d7c1856\",\"dweb:/ipfs/QmcVY7ywihpT3FEyrtumrnBReJNxTCeiSscpYHHoycdT18\"]},\"contracts/ronin/validator/SlashingExecution.sol\":{\"keccak256\":\"0x073b121de38d13b3604624ebcb86b62d39c2ea08720ecad74615fda14069242d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0e7ef9980ef0f5c855c0abc7e45f7979199f2be2ddbe93cb9eaba363adab51d\",\"dweb:/ipfs/QmRpWDxd6weLFNaGvb5Q143qe355ZHLNTJ4pbKgcdegFxw\"]},\"contracts/ronin/validator/storage-fragments/CommonStorage.sol\":{\"keccak256\":\"0x6e9dbce970dd4f6de450435e768f3baea6ea0f08b7414d5511e34be87525d43e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dbbc5047edbb4e72ff5035ddc4da0ba5b6fac117c53b4376529f8d924a12be6f\",\"dweb:/ipfs/QmdSVzSGCQbuZ9x5g7qFSTshC7jSvDbguVeLK31nPrvgVJ\"]},\"contracts/ronin/validator/storage-fragments/JailingStorage.sol\":{\"keccak256\":\"0xa6099c81511b974dc9b68ecd1bcc45d7b298bfec125aa84a6afcb468d247f400\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2b7a271a71b8469dd1777c56474e19b15d5c045e199b1286987535848df9dee2\",\"dweb:/ipfs/QmT1jQp5Pe6xhj4Qe4Byn9hieihsy59pG9BqNGZoaTqcqX\"]},\"contracts/ronin/validator/storage-fragments/TimingStorage.sol\":{\"keccak256\":\"0xc545f119b8b8978d793b62f2495dc2d49c3f416791459b9833bdc65f4dae8e7f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dd26180c3dcd0765e292dd187e686c006ce2b41404898a24886b504d16f7234d\",\"dweb:/ipfs/QmV8dbzzqH7y7D8Hxshpanirb2GZaq9evLoWEurrvqQGrE\"]},\"contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol\":{\"keccak256\":\"0x16a798f3697d608146aa807ada1b170350a44445b7c4918e7c15ab77ccd1955d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://aaf102849c637a6774da9f91fb965ff422b89bdb0a4608206100e7580292611e\",\"dweb:/ipfs/QmSXNXcDnbzNSEXCFEJh6DeeAjpJXw8eB77i7rKihVst1e\"]},\"contracts/udvts/Types.sol\":{\"keccak256\":\"0x3017524670c86eaf3930447e482b6f372ae091bb5f8eb89570924599fa626ed7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cdded5479fa6c2a2646fc33ea6bd3c36b9a7b132fc8ea9d6c8af2274c4d5fa68\",\"dweb:/ipfs/QmVZChGvAkFvipASeZw8mxmEQKvELds4uXjWiUs86MrjVm\"]},\"contracts/utils/CommonErrors.sol\":{\"keccak256\":\"0x7e228d0dbe377086fb2f7438b1e79b4e30b4eeb0225036b90a33effc5af06197\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2405dd9a3689efb60209c565964fb86e3af839df492893c6c01806f59659958\",\"dweb:/ipfs/QmaprfWfkxYxYof9JUBvhMHtomwCrsTaVpfaw96WckfNwm\"]},\"contracts/utils/ContractType.sol\":{\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://130e3f8353d9f34098fbf2867c3bf812a5184904d0113d55c5c820eb64f2547b\",\"dweb:/ipfs/QmeFSUbPi8fyG1W7kKegFRtCqALjQBXQyVvQ4sjpi6SWH3\"]},\"contracts/utils/DeprecatedSlots.sol\":{\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://66205963116e22bb24d9f2e0c1a38a27c4c0c3cf50693bc5f3177068cba37612\",\"dweb:/ipfs/Qmb1hZg6Df4zLeDMPMH4WZVpyLFe7A4TTBEtR6HHddSohC\"]},\"contracts/utils/IdentityGuard.sol\":{\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5e4cedc10e50bfaacdc732eab78768b5e0abbc8336eeaffa15de2a7be90de504\",\"dweb:/ipfs/QmR17AgM71NkH5ZeLpmaRMzPyXAKyhafoK2TZUnLw2z3Mv\"]},\"contracts/utils/RoleAccess.sol\":{\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://070d8254ea4d6fde54ae02e121bb84bdb63a3c5a8513d2d364ad5038f6a95493\",\"dweb:/ipfs/QmfXpp3t8XcGFXewoVRmoQMKJb9vPo95Kj4vsGfNBf7gSH\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61527180620000f46000396000f3fe6080604052600436106102dc5760003560e01c80636558954f116101825780636558954f146106d85780636611f843146106ef578063690b75361461070f5780636aa1c2ef1461072457806372e46810146107395780637593ff71146107415780637e1dc16f14610761578063823a7b9c14610781578063865e6fd3146107a1578063873a5a70146107c157806387c891bd146107e15780638d559c38146107f657806396585fc21461080a578063a0c3f2d21461082a578063a3d545f51461084a578063a66c0f771461086a578063afc69d731461087f578063b7ab4db514610894578063ba77b06c146108a9578063c3c8b5d6146108be578063c94aaa02146108de578063cdaa4e81146108fe578063d09f1ab41461091e578063d93fa30614610933578063dd716ad314610953578063de981f1b14610973578063e5125a1d14610993578063ea80d67d146109b3578063ecd850cc146109d3578063edb194bb146109f3578063eeb629a814610a13578063f883afaf14610a28576102eb565b806303827884146102f357806304d971ab1461031c578063060406181461034c5780630f43a67714610361578063110a83081461037657806311662dc2146103965780631196ab66146103d357806315b5ebde146103f3578063217f35c21461041357806323c65eb01461042857806328bde1e1146104485780632924de7114610475578063297a8fca146104955780632d784a98146104aa5780632f78204c146104d75780633101cfcb146104f757806331a8aef514610517578063367ec12b146105375780633b3159b614610557578063468c96ae1461057457806349096d26146105ab5780634d8df063146105cd5780634de2b735146105ed5780634ee4d72b1461061a5780634f2a693f1461062f57806352091f171461064f5780635248184a146106575780635cd8a76b14610679578063605239a11461068e578063612c8d98146106a357806365244ece146106b8576102eb565b366102eb576102e9610a48565b005b6102e9610a48565b3480156102ff57600080fd5b506103096104b081565b6040519081526020015b60405180910390f35b34801561032857600080fd5b5061033c610337366004614662565b610ab1565b6040519015158152602001610313565b34801561035857600080fd5b50610309610aeb565b34801561036d57600080fd5b5060aa54610309565b34801561038257600080fd5b506102e961039136600461469b565b610afb565b3480156103a257600080fd5b506103b66103b13660046146b8565b610b94565b604080519315158452602084019290925290820152606001610313565b3480156103df57600080fd5b506102e96103ee3660046146e4565b610bb9565b3480156103ff57600080fd5b506102e961040e3660046146b8565b610bcd565b34801561041f57600080fd5b5061033c610cc5565b34801561043457600080fd5b5061033c6104433660046146b8565b610cda565b34801561045457600080fd5b5061046861046336600461469b565b610cfa565b6040516103139190614751565b34801561048157600080fd5b5061033c61049036600461469b565b610dac565b3480156104a157600080fd5b50600454610309565b3480156104b657600080fd5b506104ca6104c536600461469b565b610dcb565b604051610313919061475f565b3480156104e357600080fd5b506102e96104f2366004614784565b610e46565b34801561050357600080fd5b506102e961051236600461469b565b611061565b34801561052357600080fd5b5061033c6105323660046146b8565b6110be565b34801561054357600080fd5b506102e96105523660046147df565b6110d2565b34801561056357600080fd5b5060685b60405161031391906148a5565b34801561058057600080fd5b5061059461058f3660046146e4565b611205565b604080519215158352602083019190915201610313565b3480156105b757600080fd5b506105c0611243565b60405161031391906148fd565b3480156105d957600080fd5b506102e96105e83660046146e4565b61130c565b3480156105f957600080fd5b5061060d61060836600461495b565b61131d565b604051610313919061499c565b34801561062657600080fd5b5060e454610309565b34801561063b57600080fd5b506102e961064a3660046146e4565b611363565b6102e9611374565b34801561066357600080fd5b5061066c611780565b60405161031391906149e2565b34801561068557600080fd5b506102e96118a5565b34801561069a57600080fd5b50607254610309565b3480156106af57600080fd5b50607654610309565b3480156106c457600080fd5b5061033c6106d336600461469b565b6119de565b3480156106e457600080fd5b506103096201518081565b3480156106fb57600080fd5b506102e961070a3660046146e4565b6119f1565b34801561071b57600080fd5b5060e554610309565b34801561073057600080fd5b50600154610309565b6102e9611a02565b34801561074d57600080fd5b5061033c61075c3660046146e4565b611c50565b34801561076d57600080fd5b5061060d61077c36600461495b565b611c74565b34801561078d57600080fd5b506102e961079c3660046146e4565b611cb2565b3480156107ad57600080fd5b506102e96107bc366004614a33565b611cc3565b3480156107cd57600080fd5b5061033c6107dc36600461469b565b611ce2565b3480156107ed57600080fd5b50600254610309565b34801561080257600080fd5b506066610567565b34801561081657600080fd5b506103b661082536600461469b565b611d01565b34801561083657600080fd5b5061033c61084536600461469b565b611d25565b34801561085657600080fd5b506103096108653660046146e4565b611d38565b34801561087657600080fd5b5060e654610309565b34801561088b57600080fd5b50610309611d43565b3480156108a057600080fd5b506105c0611d86565b3480156108b557600080fd5b506105c0611e32565b3480156108ca57600080fd5b506102e96108d9366004614662565b611e94565b3480156108ea57600080fd5b506102e96108f93660046146e4565b61211c565b34801561090a57600080fd5b506102e96109193660046146b8565b61212d565b34801561092a57600080fd5b5060a954610309565b34801561093f57600080fd5b506102e961094e366004614662565b612370565b34801561095f57600080fd5b506102e961096e3660046146b8565b6123ad565b34801561097f57600080fd5b5061056761098e366004614a4f565b612433565b34801561099f57600080fd5b506102e96109ae366004614a6a565b612490565b3480156109bf57600080fd5b506102e96109ce366004614662565b61259e565b3480156109df57600080fd5b506102e96109ee366004614662565b6125d8565b3480156109ff57600080fd5b506104ca610a0e36600461469b565b612615565b348015610a1f57600080fd5b5060ad54610309565b348015610a3457600080fd5b506102e9610a43366004614a9f565b61266f565b610a526007612433565b6001600160a01b0316336001600160a01b031614158015610a8e5750610a786009612433565b6001600160a01b0316336001600160a01b031614155b15610aaf5760405160016234baed60e01b0319815260040160405180910390fd5b565b6000610ae2610abf8461286d565b6001600160a01b0390811660009081526075602052604090205481169084161490565b90505b92915050565b6000610af660035490565b905090565b600054600490610100900460ff16158015610b1d575060005460ff8083169116105b610b425760405162461bcd60e51b8152600401610b3990614af0565b60405180910390fd5b6000805461ffff191660ff831617610100179055610b61600f836128e5565b6000805461ff001916905560405160ff821681526000805160206152458339815191529060200160405180910390a15050565b6000806000610bab610ba58661286d565b85612970565b9250925092505b9250925092565b610bc16129f2565b610bca81612a3b565b50565b6006610bd881612a92565b6001600160a01b0383166000908152603c60205260409020544311610c1257826040516353e0424d60e01b8152600401610b3991906148a5565b6001600160a01b038316600081815260386020908152604080832086845282528083208054600160ff199182168117909255948452603783528184208785529092529091208054909216909155610c699043614b54565b6001600160a01b0384166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e90610cb89085815260200190565b60405180910390a2505050565b6000610af6610cd342612ade565b6003541090565b600080610ce68461286d565b9050610cf28184612aed565b949350505050565b610d02614611565b6000610d0d8361286d565b9050610d1881612b0d565b610d355760405163a64b34ad60e01b815260040160405180910390fd5b6001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015292915050565b600080610db88361286d565b9050610dc48143612aed565b9392505050565b604080518082019091526000808252602082015260e86000610dec8461286d565b6001600160a01b03168152602080820192909252604090810160009081208251808401909352805483526001015492820183905290925003610e41576040516370fdd4f160e11b815260040160405180910390fd5b919050565b6006610e5181612a92565b6000610e5b610aeb565b6001600160a01b03871660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e090915291902054919250610ea991614b67565b60e46000828254610eba9190614b67565b90915550506001600160a01b038616600090815260e06020908152604080832083905560e18252808320839055603a909152902054610efa908690612b2a565b6001600160a01b0387166000908152603a60205260409020558315610fb0576000610f256009612433565b6001600160a01b0316632715805e88876040518363ffffffff1660e01b8152600401610f52929190614b7a565b6020604051808303816000875af1158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f959190614b93565b90508060e46000828254610fa99190614b67565b9091555050505b8215610ff4576001600160a01b0386166000908152603c6020526040902054610fda908690612b2a565b6001600160a01b0387166000908152603c60205260409020555b6001600160a01b0386166000818152603a6020908152604080832054815190815291820188905260019082015260608101919091528291907f54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68a9060800160405180910390a3505050505050565b600054600390610100900460ff16158015611083575060005460ff8083169116105b61109f5760405162461bcd60e51b8152600401610b3990614af0565b6000805461ffff191660ff831617610100179055610b61600e836128e5565b6000610ae26110cc8461286d565b83612b41565b600054610100900460ff16158080156110f25750600054600160ff909116105b8061110c5750303b15801561110c575060005460ff166001145b6111285760405162461bcd60e51b8152600401610b3990614af0565b6000805460ff19166001179055801561114b576000805461ff0019166101001790555b61115660068e6128e5565b61116160098d6128e5565b61116c60078c6128e5565b61117760058b6128e5565b611182600a8a6128e5565b61118b87612b6c565b61119486612ba1565b61119d85612bd6565b6111a684612a3b565b6111b08235612c2e565b6111bd6020830135612c63565b600183905580156111f6576000805461ff0019169055604051600181526000805160206152458339815191529060200160405180910390a15b50505050505050505050505050565b60008061121143611d38565b8311158061122c575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b606060aa546001600160401b0381111561125f5761125f614bc2565b604051908082528060200260200182016040528015611288578160200160208202803683370190505b5090506000805b825181101561130657600081815260ab60205260409020546001600160a01b03166112b981612c98565b156112fd578084846112ca81614bd8565b9550815181106112dc576112dc614bac565b60200260200101906001600160a01b031690816001600160a01b0316815250505b5060010161128f565b50815290565b6113146129f2565b610bca81612c63565b6060610ae261135e848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612cd292505050565b612d4e565b61136b6129f2565b610bca81612ba1565b61137c612df3565b60006113873361286d565b9050600061139482612c98565b80156113a657506113a482612e13565b155b80156113c057506113be826113b9610aeb565b612b41565b155b90506000806113cf6007612433565b604051630634f5b960e01b81528415156004820152600060248201526001600160a01b039190911690630634f5b9906044016080604051808303816000875af1158015611420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114449190614bf1565b935050925050826114a0573460e460008282546114619190614b67565b92505081905550836001600160a01b0316600080516020615225833981519152346001604051611492929190614c46565b60405180910390a250505050565b836001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b134846040516114db929190614c6a565b60405180910390a260006114ed610aeb565b905060006114fb8434614b67565b9050600061271061150c8584614c78565b6115169190614ca5565b905060006115248284614b54565b905060008260e2600082825461153a9190614b67565b909155505033600090815260386020908152604080832088845290915290205460ff161561163c57600061156e6006612433565b6001600160a01b031663c6391fa26040518163ffffffff1660e01b8152600401608060405180830381865afa1580156115ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115cf9190614cb9565b935050505061271081846115e39190614c78565b6115ed9190614ca5565b91508160e460008282546116019190614b67565b92505081905550896001600160a01b0316600080516020615225833981519152836002604051611632929190614c46565b60405180910390a2505b6116468183614b54565b91506000806116556009612433565b6001600160a01b0316634530d2026040518163ffffffff1660e01b81526004016040805180830381865afa158015611691573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b59190614cef565b6001600160a01b038d16600090815260756020526040812060040154929450909250906116ec906116e69084612e1f565b84612b2a565b905060006127106116fd8784614c78565b6117079190614ca5565b6001600160a01b038e16600090815260e06020526040812080549293508392909190611734908490614b67565b9091555061174490508187614b54565b6001600160a01b038e16600090815260e160205260408120805490919061176c908490614b67565b909155505050505050505050505050505050565b6073546060906001600160401b0381111561179d5761179d614bc2565b6040519080825280602002602001820160405280156117d657816020015b6117c3614611565b8152602001906001900390816117bb5790505b50905060005b81518110156118a15760756000607383815481106117fc576117fc614bac565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c0820152825183908390811061188e5761188e614bac565b60209081029190910101526001016117dc565b5090565b600054600290610100900460ff161580156118c7575060005460ff8083169116105b6118e35760405162461bcd60e51b8152600401610b3990614af0565b6000805461ffff191660ff83161761010017905560715461190f906009906001600160a01b03166128e5565b606f54611927906005906001600160a01b03166128e5565b60705461193f906006906001600160a01b03166128e5565b606d54611957906007906001600160a01b03166128e5565b60a85461196f90600a906001600160a01b03166128e5565b607180546001600160a01b0319908116909155606f8054821690556070805482169055606d805482169055606e80548216905560a8805490911690556000805461ff001916905560405160ff82168152600080516020615245833981519152906020015b60405180910390a150565b6000610ae56119ec8361286d565b612c98565b6119f96129f2565b610bca81612c2e565b611a0a612df3565b611a1343611c50565b611a3057604051636c74eecf60e01b815260040160405180910390fd5b611a3943611d38565b611a44600254611d38565b10611a6257604051632458f64160e01b815260040160405180910390fd5b436002556000611a7142612ade565b90506000611a80826003541090565b90506000611a8c611d86565b905060606000611a9b43611d38565b90506000611aaa826001614b67565b90506000611ab6610aeb565b9050611ac28386612e2e565b8515611bea57600080611ad58388612f9d565b91509150611ae58388848461316b565b611aed613275565b611af56133c9565b6000611b016006612433565b60405163185368db60e01b81529091506001600160a01b0382169063185368db90611b32908b908890600401614d13565b600060405180830381600087803b158015611b4c57600080fd5b505af1158015611b60573d6000803e3d6000fd5b50505050611b6d8a6134f2565b8051919950975015611bd8576040516303e1697b60e11b81526001600160a01b038216906307c2d2f690611ba5908a906004016148fd565b600060405180830381600087803b158015611bbf57600080fd5b505af1158015611bd3573d6000803e3d6000fd5b505050505b611be3436001614b67565b6004555050505b611bf5878387613683565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce788604051611c2a911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b600060018054611c609190614b54565b600154611c6d9084614d35565b1492915050565b6060610ae2838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612d4e92505050565b611cba6129f2565b610bca81612b6c565b611ccb6129f2565b611cd481613904565b611cde82826128e5565b5050565b600080611ced610aeb565b9050610dc4611cfb8461286d565b82612b41565b6000806000611d18611d128561286d565b43612970565b9250925092509193909250565b6000610ae5611d338361286d565b612b0d565b6000610ae582613931565b6000805b60aa548110156118a157600081815260ab6020526040902054611d72906001600160a01b0316612c98565b15611d7e576001909101905b600101611d47565b606060aa546001600160401b03811115611da257611da2614bc2565b604051908082528060200260200182016040528015611dcb578160200160208202803683370190505b5090506000805b8251811015611e2d57600081815260ab602052604090205483516001600160a01b0390911692508290849083908110611e0d57611e0d614bac565b6001600160a01b0390921660209283029190910190910152600101611dd2565b505090565b60606073805480602002602001604051908101604052809291908181526020018280548015611e8a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611e6c575b5050505050905090565b611e9c6129f2565b6001600160a01b038216600090815260e860205260408120600101549003611ed9578160405163e8e6d2dd60e01b8152600401610b3991906148a5565b60e7548060005b82811015611f2f57846001600160a01b031660e78281548110611f0557611f05614bac565b6000918252602090912001546001600160a01b031603611f2757809150611f2f565b600101611ee0565b50818103611f52578360405163b69ea42560e01b8152600401610b3991906148a5565b6001600160a01b038416600090815260e860205260409020548015612115576001600160a01b038516600090815260e8602052604081208181556001908101919091558311156120145760e7611fa9600185614b54565b81548110611fb957611fb9614bac565b60009182526020909120015460e780546001600160a01b039092169184908110611fe557611fe5614bac565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e780548061202557612025614d49565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff1916600117905561207784826104b061394c565b156120d057836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e4836040516120c191815260200190565b60405180910390a35050505050565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a183476040516120c1929190614c6a565b5050505050565b6121246129f2565b610bca81612bd6565b600961213881612a92565b6001600160a01b038316600090815260e8602052604090206001810154156121735760405163057aab3160e31b815260040160405180910390fd5b600061217f8442614b67565b6001600160a01b03861660009081526075602052604090209091506121a490826139ac565b6001600160a01b0385166000908152603b602052604080822083905560e554905163138ac02f60e11b81523391632715805e916121e5918a91600401614b7a565b6020604051808303816000875af1158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190614b93565b9050801561232557600060e654426122409190614b67565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038b161790558386558501819055905061229e613a30565b6001600160a01b0388811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b15801561230b57600080fd5b505af115801561231f573d6000803e3d6000fd5b50505050505b856001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161236091815260200190565b60405180910390a2505050505050565b600f61237b81612a92565b506001600160a01b03918216600090815260756020526040902060010180546001600160a01b03191691909216179055565b60096123b881612a92565b6123c183613a5e565b156123df5760405163030081e760e01b815260040160405180910390fd5b6001600160a01b038316600090815260756020526040902060058101541561241a5760405163fab9167360e01b815260040160405180910390fd5b61242d816124288542614b67565b6139ac565b50505050565b600061243d613ade565b600083600f81111561245157612451614c30565b60ff1681526020810191909152604001600020546001600160a01b0316905080610e41578160405163409140df60e11b8152600401610b399190614d73565b600961249b81612a92565b6001600160a01b038416600090815260776020526040902054156124d257604051632f32dcdd60e11b815260040160405180910390fd5b6127108211156124f557604051631b8454a360e21b815260040160405180910390fd5b6076548310156125185760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03841660009081526077602052604081209062015180856125408242614ca5565b61254a9190614b67565b6125549190614c78565b808355600183018590556040519091506001600160a01b038716907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906123609084908890614c6a565b600f6125a981612a92565b506001600160a01b03918216600090815260756020526040902080546001600160a01b03191691909216179055565b600f6125e381612a92565b506001600160a01b03918216600090815260756020526040902060020180546001600160a01b03191691909216179055565b6040805180820190915260008082526020820152607760006126368461286d565b6001600160a01b031681526020808201929092526040908101600020815180830190925280548252600101549181019190915292915050565b600961267a81612a92565b607354607254811061269f57604051638616841b60e01b815260040160405180910390fd5b6126a885612b0d565b156126c657604051638ad9cdf960e01b815260040160405180910390fd5b6127108311156126e957604051631b8454a360e21b815260040160405180910390fd5b60005b8181101561279c576000607560006073848154811061270d5761270d614bac565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603612760578760405163fc3d8c7560e01b8152600401610b3991906148a5565b60028101546001600160a01b03908116908716036127935785604051632d33a7e760e11b8152600401610b3991906148a5565b506001016126ec565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b031990811687179091556075909352818420805484168d881690811782559181018054851687179055600281018054909416968b1696871790935560048301899055905191949093909290917f1ca451a9920472b99355a9cf74185bf017604a7849c113f020888ecec9db93669190a450505050505050565b6000612879600f612433565b6001600160a01b03166350a9fc29836040518263ffffffff1660e01b81526004016128a491906148a5565b602060405180830381865afa1580156128c1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae59190614d81565b806128ee613ade565b600084600f81111561290257612902614c30565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f81111561294357612943614c30565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b0382166000908152603a602052604081205481908190848110156129a657600080600093509350935050610bb2565b600193506129b48582614b54565b6129bf906001614b67565b92506129ca85611d38565b6129d382611d38565b6129dd9190614b54565b6129e8906001614b67565b9150509250925092565b6129fa613a30565b6001600160a01b0316336001600160a01b031614610aaf576000356001600160e01b0319166001604051620f948f60ea1b8152600401610b39929190614d9e565b6001811015612a5d576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020016119d3565b612a9b81612433565b6001600160a01b0316336001600160a01b031614610bca576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610b3993929190614dbf565b6000610ae56201518083614ca5565b6001600160a01b03919091166000908152603a6020526040902054101590565b6001600160a01b0316600090815260746020526040902054151590565b600081831015612b3a5781610ae2565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b5906020016119d3565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab4906020016119d3565b60a954811115612bf9576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e906020016119d3565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a906020016119d3565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b906020016119d3565b6001600160a01b038116600090815260ac6020526040812054610ae59060019060ff166003811115612ccc57612ccc614c30565b90613b02565b6060612cde600f612433565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b8152600401612d099190614df6565b600060405180830381865afa158015612d26573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae59190810190614e8a565b606081516001600160401b03811115612d6957612d69614bc2565b604051908082528060200260200182016040528015612d92578160200160208202803683370190505b50905060005b8251811015612ded57612dc3838281518110612db657612db6614bac565b6020026020010151612e13565b828281518110612dd557612dd5614bac565b91151560209283029190910190910152600101612d98565b50919050565b334114610aaf576040516309f358fd60e01b815260040160405180910390fd5b6000610ae58243612aed565b6000818310612b3a5781610ae2565b6000612e3a600e612433565b6001600160a01b031663468d24be84846040518363ffffffff1660e01b8152600401612e67929190614f28565b600060405180830381865afa158015612e84573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612eac9190810190614f41565b905060008251600154612ebf9190614c78565b60e25490915060009081805b8651811015612f6e5784868281518110612ee757612ee7614bac565b602002602001015184612efa9190614c78565b612f049190614ca5565b93508360e36000898481518110612f1d57612f1d614bac565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254612f549190614b67565b90915550612f6490508483614b67565b9150600101612ecb565b50612f798183614b54565b60e46000828254612f8a9190614b67565b9091555050600060e25550505050505050565b6000606060008084516001600160401b03811115612fbd57612fbd614bc2565b604051908082528060200260200182016040528015612fe6578160200160208202803683370190505b50925060005b85518110156131615785818151811061300757613007614bac565b6020908102919091018101516001600160a01b038082166000908152607590935260409092206002015490945016915061304083612e13565b15801561305457506130528388612b41565b155b156130d2576001600160a01b038316600090815260e1602052604090205461307c9086614b67565b6001600160a01b038416600090815260e160205260409020548551919650908590839081106130ad576130ad614bac565b6020026020010181815250506130c38383613b35565b6130cd8383613bfd565b613129565b6001600160a01b038316600090815260e3602090815260408083205460e183528184205460e09093529220546131089190614b67565b6131129190614b67565b60e460008282546131239190614b67565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e3909152812055600101612fec565b5050509250929050565b60006131776009612433565b90508215612115576131898184613cb8565b156132315760405163566bce2360e11b81526001600160a01b0382169063acd79c46906131be90879086908a90600401614ff6565b600060405180830381600087803b1580156131d857600080fd5b505af11580156131ec573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d0878385846040516132239392919061502c565b60405180910390a15061242d565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f89838584476040516132669493929190615061565b60405180910390a15050505050565b60e754600080805b8383101561242d5760e7838154811061329857613298614bac565b60009182526020808320909101546001600160a01b031680835260e890915260409091206001810154919350915042106133be57805460e480546000906132e0908490614b67565b90915550506001600160a01b038216600090815260e86020526040812081815560010181905561330f8561509e565b94508411156133865760e7848154811061332b5761332b614bac565b60009182526020909120015460e780546001600160a01b03909216918590811061335757613357614bac565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e780548061339757613397614d49565b600082815260209020810160001990810180546001600160a01b031916905501905561327d565b60019092019161327d565b60e4548015610bca5760006133de6007612433565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b03841691859161342b91906150b5565b60006040518083038185875af1925050503d8060008114613468576040519150601f19603f3d011682016040523d82523d6000602084013e61346d565b606091505b5050905080156134b257816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051610cb891815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051610cb8929190614c6a565b505050565b6060806134fe83613d14565b9050600061350c6009612433565b6001600160a01b0316635a2ac07360736040518263ffffffff1660e01b815260040161353891906150e4565b600060405180830381865afa158015613555573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261357d9190810190614f41565b9050600061358b600a612433565b6001600160a01b0316632cccb53c60736040518263ffffffff1660e01b81526004016135b791906150e4565b600060405180830381865afa1580156135d4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526135fc9190810190614f41565b9050600061366b607380548060200260200160405190810160405280929190818152602001828054801561365957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161363b575b5050505050848460a95460ad546141fe565b909550905061367b8582886142c8565b505050915091565b600061368f6005612433565b6001600160a01b031663ac57bd76836136a9436001614b67565b6040518363ffffffff1660e01b81526004016136c6929190614d13565b600060405180830381865afa1580156136e3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261370b9190810190615128565b905060005b82518110156138bd57600083828151811061372d5761372d614bac565b6020908102919091018101516001600160a01b0381166000908152603b90925260408220549092504211159061376283612c98565b9050600061377a84613775436001614b67565b612aed565b8061379b575085858151811061379257613792614bac565b60200260200101515b806137a35750825b159050811580156137b15750805b1561382c576001600160a01b038416600090815260ac60205260409020546137f09060019060ff1660038111156137ea576137ea614c30565b90614408565b6001600160a01b038516600090815260ac60205260409020805460ff1916600183600381111561382257613822614c30565b02179055506138ae565b818015613837575080155b156138ae576001600160a01b038416600090815260ac60205260409020546138769060019060ff16600381111561387057613870614c30565b90614443565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156138a8576138a8614c30565b02179055505b84600101945050505050613710565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b826138e9611243565b6040516138f691906148fd565b60405180910390a350505050565b806001600160a01b03163b600003610bca5780604051630bfc64a360e21b8152600401610b3991906148a5565b6000600154826139419190614ca5565b610ae5906001614b67565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461399c576040519150601f19603f3d011682016040523d82523d6000602084013e6139a1565b606091505b509095945050505050565b60018201546000906139c6906001600160a01b031661286d565b90506139d181612b0d565b6139ee5760405163a64b34ad60e01b815260040160405180910390fd5b600583018290556040518281526001600160a01b038216907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001610cb8565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600080613a6b600a612433565b6001600160a01b031663b8cc3a50846040518263ffffffff1660e01b8152600401613a9691906148a5565b602060405180830381865afa158015613ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ad79190614b93565b1192915050565b7fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb90565b6000816003811115613b1657613b16614c30565b836003811115613b2857613b28614c30565b1660ff1615159392505050565b6001600160a01b038216600090815260e0602052604090205480156134ed57613b6182826104b061394c565b15613bb857816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec83604051613bab91815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e8347604051613bab929190614c6a565b6001600160a01b038216600090815260e3602052604090205480156134ed57613c2982826104b061394c565b15613c7357816001600160a01b0316836001600160a01b03167f0c4d6a43fc8470dee97db74874b5685e412cc517d9bdecfde1623c5e835b18e483604051613bab91815260200190565b816001600160a01b0316836001600160a01b03167f98697ee35f04a599a814432016fff3968c483d2d88dacb484926b9358f8e7cf98347604051613bab929190614c6a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613d05576040519150601f19603f3d011682016040523d82523d6000602084013e613d0a565b606091505b5090949350505050565b60606000613d226009612433565b90506000816001600160a01b031663af2454296040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d889190614b93565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dee9190614b93565b90506000836001600160a01b031663446850a160736040518263ffffffff1660e01b8152600401613e1f91906150e4565b600060405180830381865afa158015613e3c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e649190810190614f41565b6073549091506000816001600160401b03811115613e8457613e84614bc2565b604051908082528060200260200182016040528015613ead578160200160208202803683370190505b50965060008060005b8483101561414f5760738381548110613ed157613ed1614bac565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110613f1957613f19614bac565b60200260200101511015613f755780613f70576000613f388a42614b67565b600684018190556040518181529091506001600160a01b038516906000805160206152058339815191529060200160405180910390a2505b613fb6565b8015613fb6578160060160009055826001600160a01b03166000805160206152058339815191526000604051613fad91815260200190565b60405180910390a25b60008260050154600014158015613fd1575042836005015411155b80613ff457506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614011575042846006015411155b9050818061401c5750805b156140ae578861402b8961509e565b9850888151811061403e5761403e614bac565b602002602001015189878151811061405857614058614bac565b602002602001018181525050848d888060010199508151811061407d5761407d614bac565b60200260200101906001600160a01b031690816001600160a01b0316815250506140a68561447f565b505050613eb6565b6001600160a01b03851660009081526077602052604090205480158015906140d65750428111155b1561413f576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b505060019094019350613eb69050565b50505080875280156141f3577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c918760405161418a91906148fd565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d906141c0908a908c90600401614d13565b600060405180830381600087803b1580156141da57600080fd5b505af11580156141ee573d6000803e3d6000fd5b505050505b505050505050919050565b606060008060689050600088888888886040516024016142229594939291906151b6565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161426591614c78565b614270906040614b67565b90506020840181888483895afa61428657600093505b503d61429157600092505b602087019650826142b557604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa5481101561431c57600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b03191690556001016142ca565b5060005b8281101561435c57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff19169055600101614320565b5060005b828110156143d057600084828151811061437c5761437c614bac565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b031916909117905550600101614360565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051610cb891906148fd565b600081600381111561441c5761441c614c30565b83600381111561442e5761442e614c30565b1760ff166003811115610ae257610ae2614c30565b600081600381111561445757614457614c30565b1983600381111561446a5761446a614c30565b1660ff166003811115610ae257610ae2614c30565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054610bca918391908190036144bc575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161454691614b54565b8154811061455657614556614bac565b6000918252602090912001546001600160a01b039081169150831681146145d9576001600160a01b03811660009081526074602052604090208290556073805482919084199081106145aa576145aa614bac565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806145ea576145ea614d49565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b0381168114610bca57600080fd5b6000806040838503121561467557600080fd5b82356146808161464d565b915060208301356146908161464d565b809150509250929050565b6000602082840312156146ad57600080fd5b8135610dc48161464d565b600080604083850312156146cb57600080fd5b82356146d68161464d565b946020939093013593505050565b6000602082840312156146f657600080fd5b5035919050565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610ae582846146fd565b815181526020808301519082015260408101610ae5565b8015158114610bca57600080fd5b6000806000806080858703121561479a57600080fd5b84356147a58161464d565b9350602085013592506040850135915060608501356147c381614776565b939692955090935050565b8060408101831015610ae557600080fd5b6000806000806000806000806000806000806101a08d8f03121561480257600080fd5b8c3561480d8161464d565b9b5060208d013561481d8161464d565b9a5060408d013561482d8161464d565b995060608d013561483d8161464d565b985060808d013561484d8161464d565b975060a08d013561485d8161464d565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506148938e6101608f016147ce565b90509295989b509295989b509295989b565b6001600160a01b0391909116815260200190565b600081518084526020808501945080840160005b838110156148f25781516001600160a01b0316875295820195908201906001016148cd565b509495945050505050565b602081526000610ae260208301846148b9565b60008083601f84011261492257600080fd5b5081356001600160401b0381111561493957600080fd5b6020830191508360208260051b850101111561495457600080fd5b9250929050565b6000806020838503121561496e57600080fd5b82356001600160401b0381111561498457600080fd5b61499085828601614910565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156149d65783511515835292840192918401916001016149b8565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156149d657614a118385516146fd565b9284019260e092909201916001016149fe565b803560108110610e4157600080fd5b60008060408385031215614a4657600080fd5b61468083614a24565b600060208284031215614a6157600080fd5b610ae282614a24565b600080600060608486031215614a7f57600080fd5b8335614a8a8161464d565b95602085013595506040909401359392505050565b60008060008060808587031215614ab557600080fd5b8435614ac08161464d565b93506020850135614ad08161464d565b92506040850135614ae08161464d565b9396929550929360600135925050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610ae557610ae5614b3e565b80820180821115610ae557610ae5614b3e565b6001600160a01b03929092168252602082015260400190565b600060208284031215614ba557600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060018201614bea57614bea614b3e565b5060010190565b60008060008060808587031215614c0757600080fd5b8451614c1281614776565b60208601516040870151606090970151919890975090945092505050565b634e487b7160e01b600052602160045260246000fd5b8281526040810160038310614c5d57614c5d614c30565b8260208301529392505050565b918252602082015260400190565b8082028115828204841417610ae557610ae5614b3e565b634e487b7160e01b600052601260045260246000fd5b600082614cb457614cb4614c8f565b500490565b60008060008060808587031215614ccf57600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008060408385031215614d0257600080fd5b505080516020909101519092909150565b604081526000614d2660408301856148b9565b90508260208301529392505050565b600082614d4457614d44614c8f565b500690565b634e487b7160e01b600052603160045260246000fd5b60108110614d6f57614d6f614c30565b9052565b60208101610ae58284614d5f565b600060208284031215614d9357600080fd5b8151610dc48161464d565b6001600160e01b03198316815260408101600b8310614c5d57614c5d614c30565b6001600160e01b03198416815260608101614ddd6020830185614d5f565b6001600160a01b03929092166040919091015292915050565b6020808252825182820181905260009190848201906040850190845b818110156149d65783516001600160a01b031683529284019291840191600101614e12565b604051601f8201601f191681016001600160401b0381118282101715614e5f57614e5f614bc2565b604052919050565b60006001600160401b03821115614e8057614e80614bc2565b5060051b60200190565b60006020808385031215614e9d57600080fd5b82516001600160401b03811115614eb357600080fd5b8301601f81018513614ec457600080fd5b8051614ed7614ed282614e67565b614e37565b81815260059190911b82018301908381019087831115614ef657600080fd5b928401925b82841015614f1d578351614f0e8161464d565b82529284019290840190614efb565b979650505050505050565b828152604060208201526000610cf260408301846148b9565b60006020808385031215614f5457600080fd5b82516001600160401b03811115614f6a57600080fd5b8301601f81018513614f7b57600080fd5b8051614f89614ed282614e67565b81815260059190911b82018301908381019087831115614fa857600080fd5b928401925b82841015614f1d57835182529284019290840190614fad565b600081518084526020808501945080840160005b838110156148f257815187529582019590820190600101614fda565b60608152600061500960608301866148b9565b828103602084015261501b8186614fc6565b915050826040830152949350505050565b83815260606020820152600061504560608301856148b9565b82810360408401526150578185614fc6565b9695505050505050565b84815260806020820152600061507a60808301866148b9565b828103604084015261508c8186614fc6565b91505082606083015295945050505050565b6000816150ad576150ad614b3e565b506000190190565b6000825160005b818110156150d657602081860181015185830152016150bc565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156149d65783546001600160a01b031683526001938401939285019201615103565b6000602080838503121561513b57600080fd5b82516001600160401b0381111561515157600080fd5b8301601f8101851361516257600080fd5b8051615170614ed282614e67565b81815260059190911b8201830190838101908783111561518f57600080fd5b928401925b82841015614f1d5783516151a781614776565b82529284019290840190615194565b60a0815260006151c960a08301886148b9565b82810360208401526151db8188614fc6565b905082810360408401526151ef8187614fc6565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498a164736f6c6343000813000a", + "deployedBytecode": "0x6080604052600436106102dc5760003560e01c80636558954f116101825780636558954f146106d85780636611f843146106ef578063690b75361461070f5780636aa1c2ef1461072457806372e46810146107395780637593ff71146107415780637e1dc16f14610761578063823a7b9c14610781578063865e6fd3146107a1578063873a5a70146107c157806387c891bd146107e15780638d559c38146107f657806396585fc21461080a578063a0c3f2d21461082a578063a3d545f51461084a578063a66c0f771461086a578063afc69d731461087f578063b7ab4db514610894578063ba77b06c146108a9578063c3c8b5d6146108be578063c94aaa02146108de578063cdaa4e81146108fe578063d09f1ab41461091e578063d93fa30614610933578063dd716ad314610953578063de981f1b14610973578063e5125a1d14610993578063ea80d67d146109b3578063ecd850cc146109d3578063edb194bb146109f3578063eeb629a814610a13578063f883afaf14610a28576102eb565b806303827884146102f357806304d971ab1461031c578063060406181461034c5780630f43a67714610361578063110a83081461037657806311662dc2146103965780631196ab66146103d357806315b5ebde146103f3578063217f35c21461041357806323c65eb01461042857806328bde1e1146104485780632924de7114610475578063297a8fca146104955780632d784a98146104aa5780632f78204c146104d75780633101cfcb146104f757806331a8aef514610517578063367ec12b146105375780633b3159b614610557578063468c96ae1461057457806349096d26146105ab5780634d8df063146105cd5780634de2b735146105ed5780634ee4d72b1461061a5780634f2a693f1461062f57806352091f171461064f5780635248184a146106575780635cd8a76b14610679578063605239a11461068e578063612c8d98146106a357806365244ece146106b8576102eb565b366102eb576102e9610a48565b005b6102e9610a48565b3480156102ff57600080fd5b506103096104b081565b6040519081526020015b60405180910390f35b34801561032857600080fd5b5061033c610337366004614662565b610ab1565b6040519015158152602001610313565b34801561035857600080fd5b50610309610aeb565b34801561036d57600080fd5b5060aa54610309565b34801561038257600080fd5b506102e961039136600461469b565b610afb565b3480156103a257600080fd5b506103b66103b13660046146b8565b610b94565b604080519315158452602084019290925290820152606001610313565b3480156103df57600080fd5b506102e96103ee3660046146e4565b610bb9565b3480156103ff57600080fd5b506102e961040e3660046146b8565b610bcd565b34801561041f57600080fd5b5061033c610cc5565b34801561043457600080fd5b5061033c6104433660046146b8565b610cda565b34801561045457600080fd5b5061046861046336600461469b565b610cfa565b6040516103139190614751565b34801561048157600080fd5b5061033c61049036600461469b565b610dac565b3480156104a157600080fd5b50600454610309565b3480156104b657600080fd5b506104ca6104c536600461469b565b610dcb565b604051610313919061475f565b3480156104e357600080fd5b506102e96104f2366004614784565b610e46565b34801561050357600080fd5b506102e961051236600461469b565b611061565b34801561052357600080fd5b5061033c6105323660046146b8565b6110be565b34801561054357600080fd5b506102e96105523660046147df565b6110d2565b34801561056357600080fd5b5060685b60405161031391906148a5565b34801561058057600080fd5b5061059461058f3660046146e4565b611205565b604080519215158352602083019190915201610313565b3480156105b757600080fd5b506105c0611243565b60405161031391906148fd565b3480156105d957600080fd5b506102e96105e83660046146e4565b61130c565b3480156105f957600080fd5b5061060d61060836600461495b565b61131d565b604051610313919061499c565b34801561062657600080fd5b5060e454610309565b34801561063b57600080fd5b506102e961064a3660046146e4565b611363565b6102e9611374565b34801561066357600080fd5b5061066c611780565b60405161031391906149e2565b34801561068557600080fd5b506102e96118a5565b34801561069a57600080fd5b50607254610309565b3480156106af57600080fd5b50607654610309565b3480156106c457600080fd5b5061033c6106d336600461469b565b6119de565b3480156106e457600080fd5b506103096201518081565b3480156106fb57600080fd5b506102e961070a3660046146e4565b6119f1565b34801561071b57600080fd5b5060e554610309565b34801561073057600080fd5b50600154610309565b6102e9611a02565b34801561074d57600080fd5b5061033c61075c3660046146e4565b611c50565b34801561076d57600080fd5b5061060d61077c36600461495b565b611c74565b34801561078d57600080fd5b506102e961079c3660046146e4565b611cb2565b3480156107ad57600080fd5b506102e96107bc366004614a33565b611cc3565b3480156107cd57600080fd5b5061033c6107dc36600461469b565b611ce2565b3480156107ed57600080fd5b50600254610309565b34801561080257600080fd5b506066610567565b34801561081657600080fd5b506103b661082536600461469b565b611d01565b34801561083657600080fd5b5061033c61084536600461469b565b611d25565b34801561085657600080fd5b506103096108653660046146e4565b611d38565b34801561087657600080fd5b5060e654610309565b34801561088b57600080fd5b50610309611d43565b3480156108a057600080fd5b506105c0611d86565b3480156108b557600080fd5b506105c0611e32565b3480156108ca57600080fd5b506102e96108d9366004614662565b611e94565b3480156108ea57600080fd5b506102e96108f93660046146e4565b61211c565b34801561090a57600080fd5b506102e96109193660046146b8565b61212d565b34801561092a57600080fd5b5060a954610309565b34801561093f57600080fd5b506102e961094e366004614662565b612370565b34801561095f57600080fd5b506102e961096e3660046146b8565b6123ad565b34801561097f57600080fd5b5061056761098e366004614a4f565b612433565b34801561099f57600080fd5b506102e96109ae366004614a6a565b612490565b3480156109bf57600080fd5b506102e96109ce366004614662565b61259e565b3480156109df57600080fd5b506102e96109ee366004614662565b6125d8565b3480156109ff57600080fd5b506104ca610a0e36600461469b565b612615565b348015610a1f57600080fd5b5060ad54610309565b348015610a3457600080fd5b506102e9610a43366004614a9f565b61266f565b610a526007612433565b6001600160a01b0316336001600160a01b031614158015610a8e5750610a786009612433565b6001600160a01b0316336001600160a01b031614155b15610aaf5760405160016234baed60e01b0319815260040160405180910390fd5b565b6000610ae2610abf8461286d565b6001600160a01b0390811660009081526075602052604090205481169084161490565b90505b92915050565b6000610af660035490565b905090565b600054600490610100900460ff16158015610b1d575060005460ff8083169116105b610b425760405162461bcd60e51b8152600401610b3990614af0565b60405180910390fd5b6000805461ffff191660ff831617610100179055610b61600f836128e5565b6000805461ff001916905560405160ff821681526000805160206152458339815191529060200160405180910390a15050565b6000806000610bab610ba58661286d565b85612970565b9250925092505b9250925092565b610bc16129f2565b610bca81612a3b565b50565b6006610bd881612a92565b6001600160a01b0383166000908152603c60205260409020544311610c1257826040516353e0424d60e01b8152600401610b3991906148a5565b6001600160a01b038316600081815260386020908152604080832086845282528083208054600160ff199182168117909255948452603783528184208785529092529091208054909216909155610c699043614b54565b6001600160a01b0384166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e90610cb89085815260200190565b60405180910390a2505050565b6000610af6610cd342612ade565b6003541090565b600080610ce68461286d565b9050610cf28184612aed565b949350505050565b610d02614611565b6000610d0d8361286d565b9050610d1881612b0d565b610d355760405163a64b34ad60e01b815260040160405180910390fd5b6001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015292915050565b600080610db88361286d565b9050610dc48143612aed565b9392505050565b604080518082019091526000808252602082015260e86000610dec8461286d565b6001600160a01b03168152602080820192909252604090810160009081208251808401909352805483526001015492820183905290925003610e41576040516370fdd4f160e11b815260040160405180910390fd5b919050565b6006610e5181612a92565b6000610e5b610aeb565b6001600160a01b03871660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e090915291902054919250610ea991614b67565b60e46000828254610eba9190614b67565b90915550506001600160a01b038616600090815260e06020908152604080832083905560e18252808320839055603a909152902054610efa908690612b2a565b6001600160a01b0387166000908152603a60205260409020558315610fb0576000610f256009612433565b6001600160a01b0316632715805e88876040518363ffffffff1660e01b8152600401610f52929190614b7a565b6020604051808303816000875af1158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f959190614b93565b90508060e46000828254610fa99190614b67565b9091555050505b8215610ff4576001600160a01b0386166000908152603c6020526040902054610fda908690612b2a565b6001600160a01b0387166000908152603c60205260409020555b6001600160a01b0386166000818152603a6020908152604080832054815190815291820188905260019082015260608101919091528291907f54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68a9060800160405180910390a3505050505050565b600054600390610100900460ff16158015611083575060005460ff8083169116105b61109f5760405162461bcd60e51b8152600401610b3990614af0565b6000805461ffff191660ff831617610100179055610b61600e836128e5565b6000610ae26110cc8461286d565b83612b41565b600054610100900460ff16158080156110f25750600054600160ff909116105b8061110c5750303b15801561110c575060005460ff166001145b6111285760405162461bcd60e51b8152600401610b3990614af0565b6000805460ff19166001179055801561114b576000805461ff0019166101001790555b61115660068e6128e5565b61116160098d6128e5565b61116c60078c6128e5565b61117760058b6128e5565b611182600a8a6128e5565b61118b87612b6c565b61119486612ba1565b61119d85612bd6565b6111a684612a3b565b6111b08235612c2e565b6111bd6020830135612c63565b600183905580156111f6576000805461ff0019169055604051600181526000805160206152458339815191529060200160405180910390a15b50505050505050505050505050565b60008061121143611d38565b8311158061122c575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b606060aa546001600160401b0381111561125f5761125f614bc2565b604051908082528060200260200182016040528015611288578160200160208202803683370190505b5090506000805b825181101561130657600081815260ab60205260409020546001600160a01b03166112b981612c98565b156112fd578084846112ca81614bd8565b9550815181106112dc576112dc614bac565b60200260200101906001600160a01b031690816001600160a01b0316815250505b5060010161128f565b50815290565b6113146129f2565b610bca81612c63565b6060610ae261135e848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612cd292505050565b612d4e565b61136b6129f2565b610bca81612ba1565b61137c612df3565b60006113873361286d565b9050600061139482612c98565b80156113a657506113a482612e13565b155b80156113c057506113be826113b9610aeb565b612b41565b155b90506000806113cf6007612433565b604051630634f5b960e01b81528415156004820152600060248201526001600160a01b039190911690630634f5b9906044016080604051808303816000875af1158015611420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114449190614bf1565b935050925050826114a0573460e460008282546114619190614b67565b92505081905550836001600160a01b0316600080516020615225833981519152346001604051611492929190614c46565b60405180910390a250505050565b836001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b134846040516114db929190614c6a565b60405180910390a260006114ed610aeb565b905060006114fb8434614b67565b9050600061271061150c8584614c78565b6115169190614ca5565b905060006115248284614b54565b905060008260e2600082825461153a9190614b67565b909155505033600090815260386020908152604080832088845290915290205460ff161561163c57600061156e6006612433565b6001600160a01b031663c6391fa26040518163ffffffff1660e01b8152600401608060405180830381865afa1580156115ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115cf9190614cb9565b935050505061271081846115e39190614c78565b6115ed9190614ca5565b91508160e460008282546116019190614b67565b92505081905550896001600160a01b0316600080516020615225833981519152836002604051611632929190614c46565b60405180910390a2505b6116468183614b54565b91506000806116556009612433565b6001600160a01b0316634530d2026040518163ffffffff1660e01b81526004016040805180830381865afa158015611691573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b59190614cef565b6001600160a01b038d16600090815260756020526040812060040154929450909250906116ec906116e69084612e1f565b84612b2a565b905060006127106116fd8784614c78565b6117079190614ca5565b6001600160a01b038e16600090815260e06020526040812080549293508392909190611734908490614b67565b9091555061174490508187614b54565b6001600160a01b038e16600090815260e160205260408120805490919061176c908490614b67565b909155505050505050505050505050505050565b6073546060906001600160401b0381111561179d5761179d614bc2565b6040519080825280602002602001820160405280156117d657816020015b6117c3614611565b8152602001906001900390816117bb5790505b50905060005b81518110156118a15760756000607383815481106117fc576117fc614bac565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c0820152825183908390811061188e5761188e614bac565b60209081029190910101526001016117dc565b5090565b600054600290610100900460ff161580156118c7575060005460ff8083169116105b6118e35760405162461bcd60e51b8152600401610b3990614af0565b6000805461ffff191660ff83161761010017905560715461190f906009906001600160a01b03166128e5565b606f54611927906005906001600160a01b03166128e5565b60705461193f906006906001600160a01b03166128e5565b606d54611957906007906001600160a01b03166128e5565b60a85461196f90600a906001600160a01b03166128e5565b607180546001600160a01b0319908116909155606f8054821690556070805482169055606d805482169055606e80548216905560a8805490911690556000805461ff001916905560405160ff82168152600080516020615245833981519152906020015b60405180910390a150565b6000610ae56119ec8361286d565b612c98565b6119f96129f2565b610bca81612c2e565b611a0a612df3565b611a1343611c50565b611a3057604051636c74eecf60e01b815260040160405180910390fd5b611a3943611d38565b611a44600254611d38565b10611a6257604051632458f64160e01b815260040160405180910390fd5b436002556000611a7142612ade565b90506000611a80826003541090565b90506000611a8c611d86565b905060606000611a9b43611d38565b90506000611aaa826001614b67565b90506000611ab6610aeb565b9050611ac28386612e2e565b8515611bea57600080611ad58388612f9d565b91509150611ae58388848461316b565b611aed613275565b611af56133c9565b6000611b016006612433565b60405163185368db60e01b81529091506001600160a01b0382169063185368db90611b32908b908890600401614d13565b600060405180830381600087803b158015611b4c57600080fd5b505af1158015611b60573d6000803e3d6000fd5b50505050611b6d8a6134f2565b8051919950975015611bd8576040516303e1697b60e11b81526001600160a01b038216906307c2d2f690611ba5908a906004016148fd565b600060405180830381600087803b158015611bbf57600080fd5b505af1158015611bd3573d6000803e3d6000fd5b505050505b611be3436001614b67565b6004555050505b611bf5878387613683565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce788604051611c2a911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b600060018054611c609190614b54565b600154611c6d9084614d35565b1492915050565b6060610ae2838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612d4e92505050565b611cba6129f2565b610bca81612b6c565b611ccb6129f2565b611cd481613904565b611cde82826128e5565b5050565b600080611ced610aeb565b9050610dc4611cfb8461286d565b82612b41565b6000806000611d18611d128561286d565b43612970565b9250925092509193909250565b6000610ae5611d338361286d565b612b0d565b6000610ae582613931565b6000805b60aa548110156118a157600081815260ab6020526040902054611d72906001600160a01b0316612c98565b15611d7e576001909101905b600101611d47565b606060aa546001600160401b03811115611da257611da2614bc2565b604051908082528060200260200182016040528015611dcb578160200160208202803683370190505b5090506000805b8251811015611e2d57600081815260ab602052604090205483516001600160a01b0390911692508290849083908110611e0d57611e0d614bac565b6001600160a01b0390921660209283029190910190910152600101611dd2565b505090565b60606073805480602002602001604051908101604052809291908181526020018280548015611e8a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611e6c575b5050505050905090565b611e9c6129f2565b6001600160a01b038216600090815260e860205260408120600101549003611ed9578160405163e8e6d2dd60e01b8152600401610b3991906148a5565b60e7548060005b82811015611f2f57846001600160a01b031660e78281548110611f0557611f05614bac565b6000918252602090912001546001600160a01b031603611f2757809150611f2f565b600101611ee0565b50818103611f52578360405163b69ea42560e01b8152600401610b3991906148a5565b6001600160a01b038416600090815260e860205260409020548015612115576001600160a01b038516600090815260e8602052604081208181556001908101919091558311156120145760e7611fa9600185614b54565b81548110611fb957611fb9614bac565b60009182526020909120015460e780546001600160a01b039092169184908110611fe557611fe5614bac565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e780548061202557612025614d49565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff1916600117905561207784826104b061394c565b156120d057836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e4836040516120c191815260200190565b60405180910390a35050505050565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a183476040516120c1929190614c6a565b5050505050565b6121246129f2565b610bca81612bd6565b600961213881612a92565b6001600160a01b038316600090815260e8602052604090206001810154156121735760405163057aab3160e31b815260040160405180910390fd5b600061217f8442614b67565b6001600160a01b03861660009081526075602052604090209091506121a490826139ac565b6001600160a01b0385166000908152603b602052604080822083905560e554905163138ac02f60e11b81523391632715805e916121e5918a91600401614b7a565b6020604051808303816000875af1158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190614b93565b9050801561232557600060e654426122409190614b67565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038b161790558386558501819055905061229e613a30565b6001600160a01b0388811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b15801561230b57600080fd5b505af115801561231f573d6000803e3d6000fd5b50505050505b856001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161236091815260200190565b60405180910390a2505050505050565b600f61237b81612a92565b506001600160a01b03918216600090815260756020526040902060010180546001600160a01b03191691909216179055565b60096123b881612a92565b6123c183613a5e565b156123df5760405163030081e760e01b815260040160405180910390fd5b6001600160a01b038316600090815260756020526040902060058101541561241a5760405163fab9167360e01b815260040160405180910390fd5b61242d816124288542614b67565b6139ac565b50505050565b600061243d613ade565b600083600f81111561245157612451614c30565b60ff1681526020810191909152604001600020546001600160a01b0316905080610e41578160405163409140df60e11b8152600401610b399190614d73565b600961249b81612a92565b6001600160a01b038416600090815260776020526040902054156124d257604051632f32dcdd60e11b815260040160405180910390fd5b6127108211156124f557604051631b8454a360e21b815260040160405180910390fd5b6076548310156125185760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03841660009081526077602052604081209062015180856125408242614ca5565b61254a9190614b67565b6125549190614c78565b808355600183018590556040519091506001600160a01b038716907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906123609084908890614c6a565b600f6125a981612a92565b506001600160a01b03918216600090815260756020526040902080546001600160a01b03191691909216179055565b600f6125e381612a92565b506001600160a01b03918216600090815260756020526040902060020180546001600160a01b03191691909216179055565b6040805180820190915260008082526020820152607760006126368461286d565b6001600160a01b031681526020808201929092526040908101600020815180830190925280548252600101549181019190915292915050565b600961267a81612a92565b607354607254811061269f57604051638616841b60e01b815260040160405180910390fd5b6126a885612b0d565b156126c657604051638ad9cdf960e01b815260040160405180910390fd5b6127108311156126e957604051631b8454a360e21b815260040160405180910390fd5b60005b8181101561279c576000607560006073848154811061270d5761270d614bac565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603612760578760405163fc3d8c7560e01b8152600401610b3991906148a5565b60028101546001600160a01b03908116908716036127935785604051632d33a7e760e11b8152600401610b3991906148a5565b506001016126ec565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b031990811687179091556075909352818420805484168d881690811782559181018054851687179055600281018054909416968b1696871790935560048301899055905191949093909290917f1ca451a9920472b99355a9cf74185bf017604a7849c113f020888ecec9db93669190a450505050505050565b6000612879600f612433565b6001600160a01b03166350a9fc29836040518263ffffffff1660e01b81526004016128a491906148a5565b602060405180830381865afa1580156128c1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae59190614d81565b806128ee613ade565b600084600f81111561290257612902614c30565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f81111561294357612943614c30565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b0382166000908152603a602052604081205481908190848110156129a657600080600093509350935050610bb2565b600193506129b48582614b54565b6129bf906001614b67565b92506129ca85611d38565b6129d382611d38565b6129dd9190614b54565b6129e8906001614b67565b9150509250925092565b6129fa613a30565b6001600160a01b0316336001600160a01b031614610aaf576000356001600160e01b0319166001604051620f948f60ea1b8152600401610b39929190614d9e565b6001811015612a5d576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020016119d3565b612a9b81612433565b6001600160a01b0316336001600160a01b031614610bca576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610b3993929190614dbf565b6000610ae56201518083614ca5565b6001600160a01b03919091166000908152603a6020526040902054101590565b6001600160a01b0316600090815260746020526040902054151590565b600081831015612b3a5781610ae2565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b5906020016119d3565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab4906020016119d3565b60a954811115612bf9576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e906020016119d3565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a906020016119d3565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b906020016119d3565b6001600160a01b038116600090815260ac6020526040812054610ae59060019060ff166003811115612ccc57612ccc614c30565b90613b02565b6060612cde600f612433565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b8152600401612d099190614df6565b600060405180830381865afa158015612d26573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae59190810190614e8a565b606081516001600160401b03811115612d6957612d69614bc2565b604051908082528060200260200182016040528015612d92578160200160208202803683370190505b50905060005b8251811015612ded57612dc3838281518110612db657612db6614bac565b6020026020010151612e13565b828281518110612dd557612dd5614bac565b91151560209283029190910190910152600101612d98565b50919050565b334114610aaf576040516309f358fd60e01b815260040160405180910390fd5b6000610ae58243612aed565b6000818310612b3a5781610ae2565b6000612e3a600e612433565b6001600160a01b031663468d24be84846040518363ffffffff1660e01b8152600401612e67929190614f28565b600060405180830381865afa158015612e84573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612eac9190810190614f41565b905060008251600154612ebf9190614c78565b60e25490915060009081805b8651811015612f6e5784868281518110612ee757612ee7614bac565b602002602001015184612efa9190614c78565b612f049190614ca5565b93508360e36000898481518110612f1d57612f1d614bac565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254612f549190614b67565b90915550612f6490508483614b67565b9150600101612ecb565b50612f798183614b54565b60e46000828254612f8a9190614b67565b9091555050600060e25550505050505050565b6000606060008084516001600160401b03811115612fbd57612fbd614bc2565b604051908082528060200260200182016040528015612fe6578160200160208202803683370190505b50925060005b85518110156131615785818151811061300757613007614bac565b6020908102919091018101516001600160a01b038082166000908152607590935260409092206002015490945016915061304083612e13565b15801561305457506130528388612b41565b155b156130d2576001600160a01b038316600090815260e1602052604090205461307c9086614b67565b6001600160a01b038416600090815260e160205260409020548551919650908590839081106130ad576130ad614bac565b6020026020010181815250506130c38383613b35565b6130cd8383613bfd565b613129565b6001600160a01b038316600090815260e3602090815260408083205460e183528184205460e09093529220546131089190614b67565b6131129190614b67565b60e460008282546131239190614b67565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e3909152812055600101612fec565b5050509250929050565b60006131776009612433565b90508215612115576131898184613cb8565b156132315760405163566bce2360e11b81526001600160a01b0382169063acd79c46906131be90879086908a90600401614ff6565b600060405180830381600087803b1580156131d857600080fd5b505af11580156131ec573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d0878385846040516132239392919061502c565b60405180910390a15061242d565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f89838584476040516132669493929190615061565b60405180910390a15050505050565b60e754600080805b8383101561242d5760e7838154811061329857613298614bac565b60009182526020808320909101546001600160a01b031680835260e890915260409091206001810154919350915042106133be57805460e480546000906132e0908490614b67565b90915550506001600160a01b038216600090815260e86020526040812081815560010181905561330f8561509e565b94508411156133865760e7848154811061332b5761332b614bac565b60009182526020909120015460e780546001600160a01b03909216918590811061335757613357614bac565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e780548061339757613397614d49565b600082815260209020810160001990810180546001600160a01b031916905501905561327d565b60019092019161327d565b60e4548015610bca5760006133de6007612433565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b03841691859161342b91906150b5565b60006040518083038185875af1925050503d8060008114613468576040519150601f19603f3d011682016040523d82523d6000602084013e61346d565b606091505b5050905080156134b257816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051610cb891815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051610cb8929190614c6a565b505050565b6060806134fe83613d14565b9050600061350c6009612433565b6001600160a01b0316635a2ac07360736040518263ffffffff1660e01b815260040161353891906150e4565b600060405180830381865afa158015613555573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261357d9190810190614f41565b9050600061358b600a612433565b6001600160a01b0316632cccb53c60736040518263ffffffff1660e01b81526004016135b791906150e4565b600060405180830381865afa1580156135d4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526135fc9190810190614f41565b9050600061366b607380548060200260200160405190810160405280929190818152602001828054801561365957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161363b575b5050505050848460a95460ad546141fe565b909550905061367b8582886142c8565b505050915091565b600061368f6005612433565b6001600160a01b031663ac57bd76836136a9436001614b67565b6040518363ffffffff1660e01b81526004016136c6929190614d13565b600060405180830381865afa1580156136e3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261370b9190810190615128565b905060005b82518110156138bd57600083828151811061372d5761372d614bac565b6020908102919091018101516001600160a01b0381166000908152603b90925260408220549092504211159061376283612c98565b9050600061377a84613775436001614b67565b612aed565b8061379b575085858151811061379257613792614bac565b60200260200101515b806137a35750825b159050811580156137b15750805b1561382c576001600160a01b038416600090815260ac60205260409020546137f09060019060ff1660038111156137ea576137ea614c30565b90614408565b6001600160a01b038516600090815260ac60205260409020805460ff1916600183600381111561382257613822614c30565b02179055506138ae565b818015613837575080155b156138ae576001600160a01b038416600090815260ac60205260409020546138769060019060ff16600381111561387057613870614c30565b90614443565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156138a8576138a8614c30565b02179055505b84600101945050505050613710565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b826138e9611243565b6040516138f691906148fd565b60405180910390a350505050565b806001600160a01b03163b600003610bca5780604051630bfc64a360e21b8152600401610b3991906148a5565b6000600154826139419190614ca5565b610ae5906001614b67565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461399c576040519150601f19603f3d011682016040523d82523d6000602084013e6139a1565b606091505b509095945050505050565b60018201546000906139c6906001600160a01b031661286d565b90506139d181612b0d565b6139ee5760405163a64b34ad60e01b815260040160405180910390fd5b600583018290556040518281526001600160a01b038216907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001610cb8565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600080613a6b600a612433565b6001600160a01b031663b8cc3a50846040518263ffffffff1660e01b8152600401613a9691906148a5565b602060405180830381865afa158015613ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ad79190614b93565b1192915050565b7fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb90565b6000816003811115613b1657613b16614c30565b836003811115613b2857613b28614c30565b1660ff1615159392505050565b6001600160a01b038216600090815260e0602052604090205480156134ed57613b6182826104b061394c565b15613bb857816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec83604051613bab91815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e8347604051613bab929190614c6a565b6001600160a01b038216600090815260e3602052604090205480156134ed57613c2982826104b061394c565b15613c7357816001600160a01b0316836001600160a01b03167f0c4d6a43fc8470dee97db74874b5685e412cc517d9bdecfde1623c5e835b18e483604051613bab91815260200190565b816001600160a01b0316836001600160a01b03167f98697ee35f04a599a814432016fff3968c483d2d88dacb484926b9358f8e7cf98347604051613bab929190614c6a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613d05576040519150601f19603f3d011682016040523d82523d6000602084013e613d0a565b606091505b5090949350505050565b60606000613d226009612433565b90506000816001600160a01b031663af2454296040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d889190614b93565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dee9190614b93565b90506000836001600160a01b031663446850a160736040518263ffffffff1660e01b8152600401613e1f91906150e4565b600060405180830381865afa158015613e3c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e649190810190614f41565b6073549091506000816001600160401b03811115613e8457613e84614bc2565b604051908082528060200260200182016040528015613ead578160200160208202803683370190505b50965060008060005b8483101561414f5760738381548110613ed157613ed1614bac565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110613f1957613f19614bac565b60200260200101511015613f755780613f70576000613f388a42614b67565b600684018190556040518181529091506001600160a01b038516906000805160206152058339815191529060200160405180910390a2505b613fb6565b8015613fb6578160060160009055826001600160a01b03166000805160206152058339815191526000604051613fad91815260200190565b60405180910390a25b60008260050154600014158015613fd1575042836005015411155b80613ff457506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614011575042846006015411155b9050818061401c5750805b156140ae578861402b8961509e565b9850888151811061403e5761403e614bac565b602002602001015189878151811061405857614058614bac565b602002602001018181525050848d888060010199508151811061407d5761407d614bac565b60200260200101906001600160a01b031690816001600160a01b0316815250506140a68561447f565b505050613eb6565b6001600160a01b03851660009081526077602052604090205480158015906140d65750428111155b1561413f576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b505060019094019350613eb69050565b50505080875280156141f3577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c918760405161418a91906148fd565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d906141c0908a908c90600401614d13565b600060405180830381600087803b1580156141da57600080fd5b505af11580156141ee573d6000803e3d6000fd5b505050505b505050505050919050565b606060008060689050600088888888886040516024016142229594939291906151b6565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161426591614c78565b614270906040614b67565b90506020840181888483895afa61428657600093505b503d61429157600092505b602087019650826142b557604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa5481101561431c57600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b03191690556001016142ca565b5060005b8281101561435c57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff19169055600101614320565b5060005b828110156143d057600084828151811061437c5761437c614bac565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b031916909117905550600101614360565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051610cb891906148fd565b600081600381111561441c5761441c614c30565b83600381111561442e5761442e614c30565b1760ff166003811115610ae257610ae2614c30565b600081600381111561445757614457614c30565b1983600381111561446a5761446a614c30565b1660ff166003811115610ae257610ae2614c30565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054610bca918391908190036144bc575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161454691614b54565b8154811061455657614556614bac565b6000918252602090912001546001600160a01b039081169150831681146145d9576001600160a01b03811660009081526074602052604090208290556073805482919084199081106145aa576145aa614bac565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806145ea576145ea614d49565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b0381168114610bca57600080fd5b6000806040838503121561467557600080fd5b82356146808161464d565b915060208301356146908161464d565b809150509250929050565b6000602082840312156146ad57600080fd5b8135610dc48161464d565b600080604083850312156146cb57600080fd5b82356146d68161464d565b946020939093013593505050565b6000602082840312156146f657600080fd5b5035919050565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610ae582846146fd565b815181526020808301519082015260408101610ae5565b8015158114610bca57600080fd5b6000806000806080858703121561479a57600080fd5b84356147a58161464d565b9350602085013592506040850135915060608501356147c381614776565b939692955090935050565b8060408101831015610ae557600080fd5b6000806000806000806000806000806000806101a08d8f03121561480257600080fd5b8c3561480d8161464d565b9b5060208d013561481d8161464d565b9a5060408d013561482d8161464d565b995060608d013561483d8161464d565b985060808d013561484d8161464d565b975060a08d013561485d8161464d565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506148938e6101608f016147ce565b90509295989b509295989b509295989b565b6001600160a01b0391909116815260200190565b600081518084526020808501945080840160005b838110156148f25781516001600160a01b0316875295820195908201906001016148cd565b509495945050505050565b602081526000610ae260208301846148b9565b60008083601f84011261492257600080fd5b5081356001600160401b0381111561493957600080fd5b6020830191508360208260051b850101111561495457600080fd5b9250929050565b6000806020838503121561496e57600080fd5b82356001600160401b0381111561498457600080fd5b61499085828601614910565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156149d65783511515835292840192918401916001016149b8565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156149d657614a118385516146fd565b9284019260e092909201916001016149fe565b803560108110610e4157600080fd5b60008060408385031215614a4657600080fd5b61468083614a24565b600060208284031215614a6157600080fd5b610ae282614a24565b600080600060608486031215614a7f57600080fd5b8335614a8a8161464d565b95602085013595506040909401359392505050565b60008060008060808587031215614ab557600080fd5b8435614ac08161464d565b93506020850135614ad08161464d565b92506040850135614ae08161464d565b9396929550929360600135925050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610ae557610ae5614b3e565b80820180821115610ae557610ae5614b3e565b6001600160a01b03929092168252602082015260400190565b600060208284031215614ba557600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060018201614bea57614bea614b3e565b5060010190565b60008060008060808587031215614c0757600080fd5b8451614c1281614776565b60208601516040870151606090970151919890975090945092505050565b634e487b7160e01b600052602160045260246000fd5b8281526040810160038310614c5d57614c5d614c30565b8260208301529392505050565b918252602082015260400190565b8082028115828204841417610ae557610ae5614b3e565b634e487b7160e01b600052601260045260246000fd5b600082614cb457614cb4614c8f565b500490565b60008060008060808587031215614ccf57600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008060408385031215614d0257600080fd5b505080516020909101519092909150565b604081526000614d2660408301856148b9565b90508260208301529392505050565b600082614d4457614d44614c8f565b500690565b634e487b7160e01b600052603160045260246000fd5b60108110614d6f57614d6f614c30565b9052565b60208101610ae58284614d5f565b600060208284031215614d9357600080fd5b8151610dc48161464d565b6001600160e01b03198316815260408101600b8310614c5d57614c5d614c30565b6001600160e01b03198416815260608101614ddd6020830185614d5f565b6001600160a01b03929092166040919091015292915050565b6020808252825182820181905260009190848201906040850190845b818110156149d65783516001600160a01b031683529284019291840191600101614e12565b604051601f8201601f191681016001600160401b0381118282101715614e5f57614e5f614bc2565b604052919050565b60006001600160401b03821115614e8057614e80614bc2565b5060051b60200190565b60006020808385031215614e9d57600080fd5b82516001600160401b03811115614eb357600080fd5b8301601f81018513614ec457600080fd5b8051614ed7614ed282614e67565b614e37565b81815260059190911b82018301908381019087831115614ef657600080fd5b928401925b82841015614f1d578351614f0e8161464d565b82529284019290840190614efb565b979650505050505050565b828152604060208201526000610cf260408301846148b9565b60006020808385031215614f5457600080fd5b82516001600160401b03811115614f6a57600080fd5b8301601f81018513614f7b57600080fd5b8051614f89614ed282614e67565b81815260059190911b82018301908381019087831115614fa857600080fd5b928401925b82841015614f1d57835182529284019290840190614fad565b600081518084526020808501945080840160005b838110156148f257815187529582019590820190600101614fda565b60608152600061500960608301866148b9565b828103602084015261501b8186614fc6565b915050826040830152949350505050565b83815260606020820152600061504560608301856148b9565b82810360408401526150578185614fc6565b9695505050505050565b84815260806020820152600061507a60808301866148b9565b828103604084015261508c8186614fc6565b91505082606083015295945050505050565b6000816150ad576150ad614b3e565b506000190190565b6000825160005b818110156150d657602081860181015185830152016150bc565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156149d65783546001600160a01b031683526001938401939285019201615103565b6000602080838503121561513b57600080fd5b82516001600160401b0381111561515157600080fd5b8301601f8101851361516257600080fd5b8051615170614ed282614e67565b81815260059190911b8201830190838101908783111561518f57600080fd5b928401925b82841015614f1d5783516151a781614776565b82529284019290840190615194565b60a0815260006151c960a08301886148b9565b82810360208401526151db8188614fc6565b905082810360408401526151ef8187614fc6565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498a164736f6c6343000813000a" } \ No newline at end of file diff --git a/deployments/ronin-testnet/SlashIndicatorLogic.json b/deployments/ronin-testnet/SlashIndicatorLogic.json index a7a7a8c59..b673d96a8 100644 --- a/deployments/ronin-testnet/SlashIndicatorLogic.json +++ b/deployments/ronin-testnet/SlashIndicatorLogic.json @@ -1,5 +1,5 @@ { - "address": "0x83C5bdBce6d60038468a643c817CaDC6d1e12324", + "address": "0x13C26C1f5E9CD0AAF510dcb2d15DBADBeC9B8251", "abi": [ { "inputs": [], @@ -63,16 +63,6 @@ "name": "ErrInvalidCutOffPercentageConfig", "type": "error" }, - { - "inputs": [], - "name": "ErrInvalidRatios", - "type": "error" - }, - { - "inputs": [], - "name": "ErrInvalidSlash", - "type": "error" - }, { "inputs": [ { @@ -142,8 +132,8 @@ "inputs": [ { "indexed": true, - "internalType": "address", - "name": "validator", + "internalType": "TConsensus", + "name": "consensus", "type": "address" }, { @@ -162,56 +152,6 @@ "name": "BailedOut", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "missingVotesRatioTier1", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "missingVotesRatioTier2", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "jailDurationForMissingVotesRatioTier2", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "skipBridgeOperatorSlashingThreshold", - "type": "uint256" - } - ], - "name": "BridgeOperatorSlashingConfigsUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "bridgeVotingThreshold", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "bridgeVotingSlashAmount", - "type": "uint256" - } - ], - "name": "BridgeVotingSlashingConfigsUpdated", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -397,8 +337,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -410,13 +350,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_validator", + "internalType": "TConsensus", + "name": "consensus", "type": "address" }, { "internalType": "uint256", - "name": "_period", + "name": "period", "type": "uint256" } ], @@ -434,8 +374,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_validator", + "internalType": "TConsensus", + "name": "consensus", "type": "address" } ], @@ -454,7 +394,7 @@ "inputs": [ { "internalType": "address[]", - "name": "_validators", + "name": "validatorIds", "type": "address[]" } ], @@ -466,72 +406,21 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tier", - "type": "uint256" + "internalType": "address[]", + "name": "validatorIds", + "type": "address[]" }, { "internalType": "uint256", - "name": "_period", + "name": "period", "type": "uint256" } ], - "name": "execSlashBridgeOperator", + "name": "execUpdateCreditScores", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "getBridgeOperatorSlashingConfigs", - "outputs": [ - { - "internalType": "uint256", - "name": "missingVotesRatioTier1_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "missingVotesRatioTier2_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "jailDurationForMissingVotesRatioTier2_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "skipBridgeOperatorSlashingThreshold_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getBridgeVotingSlashingConfigs", - "outputs": [ - { - "internalType": "uint256", - "name": "bridgeVotingThreshold_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bridgeVotingSlashAmount_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -554,8 +443,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_validator", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -642,8 +531,8 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_validators", + "internalType": "TConsensus[]", + "name": "consensusAddrs", "type": "address[]" } ], @@ -651,7 +540,7 @@ "outputs": [ { "internalType": "uint256[]", - "name": "_resultList", + "name": "resultList", "type": "uint256[]" } ], @@ -661,13 +550,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_validator", + "internalType": "TConsensus", + "name": "consensus", "type": "address" }, { "internalType": "uint256", - "name": "_period", + "name": "period", "type": "uint256" } ], @@ -734,12 +623,12 @@ }, { "internalType": "uint256[4]", - "name": "_bridgeOperatorSlashingConfigs", + "name": "", "type": "uint256[4]" }, { "internalType": "uint256[2]", - "name": "_bridgeVotingSlashingConfigs", + "name": "", "type": "uint256[2]" }, { @@ -828,52 +717,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_ratioTier1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_ratioTier2", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_jailDurationTier2", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_skipSlashingThreshold", - "type": "uint256" - } - ], - "name": "setBridgeOperatorSlashingConfigs", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_slashAmount", - "type": "uint256" - } - ], - "name": "setBridgeVotingSlashingConfigs", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -992,31 +835,18 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", - "type": "address" - } - ], - "name": "slashBridgeVoting", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "bytes", - "name": "_header1", + "name": "header1", "type": "bytes" }, { "internalType": "bytes", - "name": "_header2", + "name": "header2", "type": "bytes" } ], @@ -1028,7 +858,7 @@ { "inputs": [ { - "internalType": "address", + "internalType": "TConsensus", "name": "consensusAddr", "type": "address" }, @@ -1066,8 +896,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_validatorAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -1075,61 +905,43 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_validators", - "type": "address[]" - }, - { - "internalType": "uint256", - "name": "_period", - "type": "uint256" - } - ], - "name": "updateCreditScores", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0xfd11f0458273b94a1199ed16b5ea2eb4c87f719a9274eab6d063b792e2d9360d", + "transactionHash": "0x4c8e02d57a74f671e48b63e0a3b2bf383d055b55d9aefc1bc5c87bd187372f22", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x83C5bdBce6d60038468a643c817CaDC6d1e12324", + "contractAddress": "0x13C26C1f5E9CD0AAF510dcb2d15DBADBeC9B8251", "transactionIndex": 0, - "gasUsed": "2944149", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xab9cbbbf56425d5c54cf2e7873f01f9667a81047ee4bccf896dd20095f9f4bc9", - "transactionHash": "0xfd11f0458273b94a1199ed16b5ea2eb4c87f719a9274eab6d063b792e2d9360d", + "gasUsed": "2788515", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000001000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040800000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5354a2c363d6cc9635e2906a028c3a5a5cb029f3d54b94da0253a48b2aa8de84", + "transactionHash": "0x4c8e02d57a74f671e48b63e0a3b2bf383d055b55d9aefc1bc5c87bd187372f22", "logs": [ { "transactionIndex": 0, - "blockNumber": 20264313, - "transactionHash": "0xfd11f0458273b94a1199ed16b5ea2eb4c87f719a9274eab6d063b792e2d9360d", - "address": "0x83C5bdBce6d60038468a643c817CaDC6d1e12324", + "blockNumber": 21941085, + "transactionHash": "0x4c8e02d57a74f671e48b63e0a3b2bf383d055b55d9aefc1bc5c87bd187372f22", + "address": "0x13C26C1f5E9CD0AAF510dcb2d15DBADBeC9B8251", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0xab9cbbbf56425d5c54cf2e7873f01f9667a81047ee4bccf896dd20095f9f4bc9" + "blockHash": "0x5354a2c363d6cc9635e2906a028c3a5a5cb029f3d54b94da0253a48b2aa8de84" } ], - "blockNumber": 20264313, - "cumulativeGasUsed": "2944149", + "blockNumber": 21941085, + "cumulativeGasUsed": "2788515", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 10, - "solcInputHash": "8de8f567dee21c26fd39413b873c2cc0", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeJailedInTheCurrentPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrEvidenceAlreadySubmitted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientCreditScoreToBailOut\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidArguments\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCreditScoreConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCutOffPercentageConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidRatios\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidSlash\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidThreshold\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrValidatorHasBailedOutPreviously\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"usedCreditScore\",\"type\":\"uint256\"}],\"name\":\"BailedOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier1\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier2\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForMissingVotesRatioTier2\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"skipBridgeOperatorSlashingThreshold\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeVotingThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeVotingSlashAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeVotingSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gainCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout\",\"type\":\"uint256\"}],\"name\":\"CreditScoreConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"creditScores\",\"type\":\"uint256[]\"}],\"name\":\"CreditScoresUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"DoubleSignSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashFastFinalityAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fastFinalityJailUntilBlock\",\"type\":\"uint256\"}],\"name\":\"FastFinalitySlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum IBaseSlash.SlashType\",\"name\":\"slashType\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"Slashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"UnavailabilitySlashingConfigsUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"bailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkBailedOutAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"currentUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"execResetCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_tier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execSlashBridgeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperatorSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier1_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier2_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForMissingVotesRatioTier2_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"skipBridgeOperatorSlashingThreshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeVotingSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"bridgeVotingThreshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bridgeVotingSlashAmount_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"getCreditScore\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCreditScoreConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gainCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDoubleSignSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFastFinalitySlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"slashFastFinalityAmount_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fastFinalityJailUntilBlock_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"getManyCreditScores\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_resultList\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"getUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUnavailabilitySlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninGovernanceAdminContract\",\"type\":\"address\"},{\"internalType\":\"uint256[4]\",\"name\":\"_bridgeOperatorSlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_bridgeVotingSlashingConfigs\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[3]\",\"name\":\"_doubleSignSlashingConfigs\",\"type\":\"uint256[3]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_unavailabilitySlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_creditScoreConfigs\",\"type\":\"uint256[4]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"roninGovernanceAdminContract\",\"type\":\"address\"}],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"profileContract\",\"type\":\"address\"}],\"name\":\"initializeV3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastUnavailabilitySlashedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileValidateDoubleSignAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileValidateFastFinalityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ratioTier1\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioTier2\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationTier2\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_skipSlashingThreshold\",\"type\":\"uint256\"}],\"name\":\"setBridgeOperatorSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"}],\"name\":\"setBridgeVotingSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gainScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bailOutMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cutOffPercentage\",\"type\":\"uint256\"}],\"name\":\"setCreditScoreConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailUntilBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_offsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"setDoubleSignSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailUntilBlock\",\"type\":\"uint256\"}],\"name\":\"setFastFinalitySlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tier1Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_tier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmountForTier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationForTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"setUnavailabilitySlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"slashBridgeVoting\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_header1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_header2\",\"type\":\"bytes\"}],\"name\":\"slashDoubleSign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"voterPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[2]\",\"name\":\"targetBlockHash\",\"type\":\"bytes32[2]\"},{\"internalType\":\"bytes[][2]\",\"name\":\"listOfPublicKey\",\"type\":\"bytes[][2]\"},{\"internalType\":\"bytes[2]\",\"name\":\"aggregatedSignature\",\"type\":\"bytes[2]\"}],\"name\":\"slashFastFinality\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"}],\"name\":\"slashUnavailability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"updateCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeJailedInTheCurrentPeriod()\":[{\"details\":\"Error thrown when the caller must be jailed in the current period.\"}],\"ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock()\":[{\"details\":\"Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrEvidenceAlreadySubmitted()\":[{\"details\":\"Error thrown when evidence has already been submitted.\"}],\"ErrInsufficientCreditScoreToBailOut()\":[{\"details\":\"Error thrown when the caller's credit score is insufficient to bail out a situation.\"}],\"ErrInvalidArguments(bytes4)\":[{\"details\":\"Error indicating that arguments are invalid.\"}],\"ErrInvalidCreditScoreConfig()\":[{\"details\":\"Error thrown when an invalid credit score configuration is provided.\"}],\"ErrInvalidCutOffPercentageConfig()\":[{\"details\":\"Error thrown when an invalid cut-off percentage configuration is provided.\"}],\"ErrInvalidRatios()\":[{\"details\":\"Error thrown when invalid ratios are provided.\"}],\"ErrInvalidSlash()\":[{\"details\":\"Error thrown when an invalid slash is encountered.\"}],\"ErrInvalidThreshold(bytes4)\":[{\"details\":\"Error indicating that the provided threshold is invalid for a specific function signature.\",\"params\":{\"msgSig\":\"The function signature (bytes4) that the invalid threshold applies to.\"}}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrValidatorHasBailedOutPreviously()\":[{\"details\":\"Error thrown when a validator has previously bailed out.\"}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bailOut(address)\":{\"details\":\"A slashed validator use this method to get out of jail. Requirements: - The `_consensusAddr` must be a validator. - Only validator's admin can call this method. Emits the event `BailedOut`.\"},\"checkBailedOutAtPeriod(address,uint256)\":{\"details\":\"Returns the whether the `_validator` has been bailed out at the `_period`.\"},\"currentUnavailabilityIndicator(address)\":{\"details\":\"Returns the current unavailability indicator of a block producer.\"},\"execResetCreditScores(address[])\":{\"details\":\"Resets the credit score for the revoked validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"execSlashBridgeOperator(address,uint256,uint256)\":{\"details\":\"Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\",\"params\":{\"_tier\":\"The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1` and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2` Requirements: - Only validator contract can invoke this method. - Should be called only at the end of period. - Should be called only when there is slash of bridge operator. Emits the event `Slashed`.\"}},\"getBridgeOperatorSlashingConfigs()\":{\"details\":\"Returns the configs related to bridge operator slashing.\",\"returns\":{\"jailDurationForMissingVotesRatioTier2_\":\"The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\",\"missingVotesRatioTier1_\":\"The bridge reward will be deprecated if (s)he missed more than this ratio.\",\"missingVotesRatioTier2_\":\"The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio.\",\"skipBridgeOperatorSlashingThreshold_\":\"The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\"}},\"getBridgeVotingSlashingConfigs()\":{\"details\":\"Returns the configs related to bridge voting slashing.\",\"returns\":{\"bridgeVotingSlashAmount_\":\"The amount of RON to slash bridge voting.\",\"bridgeVotingThreshold_\":\"The threshold to slash when a trusted organization does not vote for bridge operators.\"}},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getCreditScore(address)\":{\"details\":\"Returns the current credit score of the validator.\"},\"getCreditScoreConfigs()\":{\"details\":\"Returns the configs related to credit score.\",\"returns\":{\"bailOutCostMultiplier_\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"cutOffPercentageAfterBailout_\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"gainCreditScore_\":\"The score to gain per period.\",\"maxCreditScore_\":\"The max number of credit score that a validator can hold.\"}},\"getDoubleSignSlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\"},\"returns\":{\"doubleSigningJailUntilBlock_\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"slashDoubleSignAmount_\":\"The amount of RON to slash double sign.\"}},\"getFastFinalitySlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"returns\":{\"fastFinalityJailUntilBlock_\":\"The block number that the punished validator will be jailed until, due to malicious fast finality.\",\"slashFastFinalityAmount_\":\"The amount of RON to slash fast finality.\"}},\"getManyCreditScores(address[])\":{\"details\":\"Returns the current credit score of a list of validators.\"},\"getUnavailabilityIndicator(address,uint256)\":{\"details\":\"Helper for CreditScore contract to query indicator of the validator.\"},\"getUnavailabilitySlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"returns\":{\"jailDurationForUnavailabilityTier2Threshold_\":\"The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\",\"slashAmountForUnavailabilityTier2Threshold_\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with tier-2 or tier-3.\",\"unavailabilityTier1Threshold_\":\"The mining reward will be deprecated, if (s)he missed more than this threshold. This threshold is applied for tier-1 and tier-3 slash.\",\"unavailabilityTier2Threshold_\":\" The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\"}},\"initialize(address,address,address,address,uint256[4],uint256[2],uint256[3],uint256[4],uint256[4])\":{\"details\":\"Initializes the contract storage.\"},\"precompileValidateDoubleSignAddress()\":{\"details\":\"Gets the address of the precompile of validating double sign evidence\"},\"precompileValidateFastFinalityAddress()\":{\"details\":\"Gets the address of the precompile of validating double sign evidence\"},\"setBridgeOperatorSlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash bridge operators. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"_jailDurationTier2\":\"The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\",\"_ratioTier1\":\"The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map to 0%-100%.\",\"_ratioTier2\":\"The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\",\"_skipSlashingThreshold\":\"The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\"}},\"setBridgeVotingSlashingConfigs(uint256,uint256)\":{\"details\":\"Sets the configs to slash bridge voting. Requirements: - The method caller is admin. Emits the event `BridgeVotingSlashingConfigsUpdated`.\",\"params\":{\"_slashAmount\":\"The amount of RON to slash bridge voting.\",\"_threshold\":\"The threshold to slash when a trusted organization does not vote for bridge operators.\"}},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setCreditScoreConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to credit score. Requirements: - The method caller is admin. Emits the event `CreditScoreConfigsUpdated`.\",\"params\":{\"_bailOutMultiplier\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"_cutOffPercentage\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"_gainScore\":\"The score to gain per period.\",\"_maxScore\":\"The max number of credit score that a validator can hold.\"}},\"setDoubleSignSlashingConfigs(uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `DoubleSignSlashingConfigsUpdated`.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\",\"_jailUntilBlock\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"_slashAmount\":\"The amount of RON to slash double sign.\"}},\"setFastFinalitySlashingConfigs(uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `FastFinalitySlashingConfigsUpdated`.\",\"params\":{\"jailUntilBlock\":\"The block number that the punished validator will be jailed until, due to fast finality.\",\"slashAmount\":\"The amount of RON to slash fast finality.\"}},\"setUnavailabilitySlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"_jailDurationForTier2Threshold\":\"The number of blocks to jail a block producer when (s)he is slashed tier-2.\",\"_slashAmountForTier2Threshold\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed tier-2.\",\"_tier1Threshold\":\"The mining reward will be deprecated, if (s)he missed more than this threshold.\",\"_tier2Threshold\":\"The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold.\"}},\"slashBridgeVoting(address)\":{\"details\":\"Slashes for bridge voter governance. Emits the event `Slashed`.\"},\"slashDoubleSign(address,bytes,bytes)\":{\"details\":\"Slashes for double signing. Requirements: - The method caller is coinbase. Emits the event `Slashed` if the double signing evidence of the two headers valid.\"},\"slashFastFinality(address,bytes,uint256,bytes32[2],bytes[][2],bytes[2])\":{\"details\":\"Slashes for fast finality. Requirements: - Only whitelisted addresses are allowed to call. Emits the event `Slashed` if the fast finality evidence of the two headers valid.\"},\"slashUnavailability(address)\":{\"details\":\"Slashes for unavailability by increasing the counter of block producer `_consensusAddr`. Requirements: - The method caller is coinbase. Emits the event `Slashed` when the threshold is reached.\"},\"updateCreditScores(address[],uint256)\":{\"details\":\"Updates the credit score for the validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/slash-indicator/SlashIndicator.sol\":\"SlashIndicator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeAdminProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { BridgeOperatorsBallot } from \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IBridgeAdminProposal {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 period, uint256 epoch, address[] operators);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory bridgeOperatorSetInfo);\\n}\\n\",\"keccak256\":\"0x38caf9faa1e53ca37b08813a8933760b1a975f821b391e7696c7ee38b69bf8c7\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n /**\\n * @dev Error thrown when attempting to schedule an already scheduled event.\\n */\\n error ErrAlreadyScheduled();\\n\\n /**\\n * @dev Error thrown when referring to a non-existent schedule.\\n */\\n error ErrUnexistedSchedule();\\n\\n /**\\n * @dev Error thrown when the end block of a schedule is out of range.\\n */\\n error ErrEndBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when the start block of a schedule is out of range.\\n */\\n error ErrStartBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\\n */\\n error ErrAlreadyOnMaintenance();\\n\\n /**\\n * @dev Error thrown when attempting an action before the cooldown period has ended.\\n */\\n error ErrCooldownTimeNotYetEnded();\\n\\n /**\\n * @dev Error thrown when the total number of schedules exceeds the limit.\\n */\\n error ErrTotalOfSchedulesExceeded();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration is specified.\\n */\\n error ErrInvalidMaintenanceDuration();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\\n */\\n error ErrInvalidMaintenanceDurationConfig();\\n\\n /**\\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\\n */\\n error ErrInvalidOffsetToStartScheduleConfigs();\\n\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnded(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedule() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(address _consensusAddr, uint256 _startedAtBlock, uint256 _endedAtBlock) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0xe30d31be54b9f9044c6a5d1393f04f9093d619a705d00276359853a086a91e8a\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n address consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address governor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n}\\n\",\"keccak256\":\"0x3d58574b5fdb760a69f9225ec87a8a96f192cc3d006badfd363a338122cd5867\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n /**\\n * @dev Error indicating that a query for a duplicate entry was made.\\n */\\n error ErrQueryForDupplicated();\\n\\n /**\\n * @dev Error indicating that a query was made for a non-existent consensus address.\\n */\\n error ErrQueryForNonExistentConsensusAddress();\\n\\n /**\\n * @dev Error indicating that a bridge voter has already been added.\\n * @param voter The address of the bridge voter that is already added.\\n */\\n error ErrBridgeVoterIsAlreadyAdded(address voter);\\n\\n /**\\n * @dev Error indicating that a governor address has already been added.\\n * @param addr The address of the governor that is already added.\\n */\\n error ErrGovernorAddressIsAlreadyAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is not added.\\n * @param addr The address of the consensus contract that is not added.\\n */\\n error ErrConsensusAddressIsNotAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is already added.\\n * @param addr The address of the consensus contract that is already added.\\n */\\n error ErrConsensusAddressIsAlreadyAdded(address addr);\\n\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeight() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeight(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeight(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeight(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganization() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x2eaef3332e209474b24574aeded61091e82a145fcbcf479577535c0cd210e1e5\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3,\\n FAST_FINALITY\\n }\\n\\n /// @dev Error thrown when evidence has already been submitted.\\n error ErrEvidenceAlreadySubmitted();\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x2e09934977e0701a28b7f776f0bd4eefdfd8d6b68134822440b2c756b6b7d1e4\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /**\\n * @dev Error thrown when an invalid credit score configuration is provided.\\n */\\n error ErrInvalidCreditScoreConfig();\\n\\n /**\\n * @dev Error thrown when an invalid cut-off percentage configuration is provided.\\n */\\n error ErrInvalidCutOffPercentageConfig();\\n\\n /**\\n * @dev Error thrown when the caller's credit score is insufficient to bail out a situation.\\n */\\n error ErrInsufficientCreditScoreToBailOut();\\n\\n /**\\n * @dev Error thrown when a validator has previously bailed out.\\n */\\n error ErrValidatorHasBailedOutPreviously();\\n\\n /**\\n * @dev Error thrown when the caller must be jailed in the current period.\\n */\\n error ErrCallerMustBeJailedInTheCurrentPeriod();\\n\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x26021ddf339495816692ea9f8545b4054d0ffb9c5ad11049cac4f3718a0bbc2d\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Error thrown when invalid ratios are provided.\\n */\\n error ErrInvalidRatios();\\n\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(address _consensusAddr, uint256 _tier, uint256 _period) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x3ea38604baf3bc5a12dd1a243eec2052de9ee2cb171222a2e5b0e5202d301471\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Error thrown when an invalid slash is encountered.\\n */\\n error ErrInvalidSlash();\\n\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x89751cbf99adf7dbd165fbbba5d6b62b5c47f8486322a7abb27d6d6aef345fae\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(address _validatorAddr, bytes calldata _header1, bytes calldata _header2) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xb1adb41d0b1c8a362b7e669d9975754adbd4ed0f8de912e8455fa70eedd80d35\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashFastFinality.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashFastFinality is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash fast finality is updated. See the method `getFastFinalitySlashingConfigs`\\n * for param details.\\n */\\n event FastFinalitySlashingConfigsUpdated(uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\\n\\n /**\\n * @dev Slashes for fast finality.\\n *\\n * Requirements:\\n * - Only whitelisted addresses are allowed to call.\\n *\\n * Emits the event `Slashed` if the fast finality evidence of the two headers valid.\\n */\\n function slashFastFinality(\\n address consensusAddr,\\n bytes calldata voterPublicKey,\\n uint256 targetBlockNumber,\\n bytes32[2] calldata targetBlockHash,\\n bytes[][2] calldata listOfPublicKey,\\n bytes[2] calldata aggregatedSignature\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return slashFastFinalityAmount The amount of RON to slash fast finality.\\n * @return fastFinalityJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * malicious fast finality.\\n */\\n function getFastFinalitySlashingConfigs()\\n external\\n view\\n returns (uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `FastFinalitySlashingConfigsUpdated`.\\n *\\n * @param slashAmount The amount of RON to slash fast finality.\\n * @param jailUntilBlock The block number that the punished validator will be jailed until, due to fast finality.\\n *\\n */\\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external;\\n}\\n\",\"keccak256\":\"0x6d46d8b31cf76709a4bc728f66e784b6c8c1e120489a72f187e40bb392bbc797\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\\n */\\n error ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\\n\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x458a7ae130a59b59b7f095fe3d4db8f779e0614041e5615f0afd36c543ac2046\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address ______deprecatedbridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnward() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address _consensusAddr, uint256 _effectiveTimestamp, uint256 _rate) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0x97dae7e2ed43c21c48200581501bfa065c7836299306ba2e7f39896c3a22ef2d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the fast finality reward is distributed.\\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\\n event FastFinalityRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(address validatorAddr, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0xac0b772f2fca9dafd7cc6742f91b442f9f545bf9472185b8d817fe045b680193\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x3fdfa86da33b889e5153075ffc028d6b0c607480a96b532fbbbc48ac7bbf27c9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n address _addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n address _addr,\\n uint256 _blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2b1846b05ca1d636299fb929c1bd7b392b236f5e3f7aa3e7eea2c6d57b8836fb\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /**\\n * @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n */\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducer() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x6823181ac93ea3320e6ebfb456624afda59ac2acb480de5c774783983c8f4749\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"../utils/CommonErrors.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n /**\\n * @dev Error thrown when an invalid order of the bridge operator is detected.\\n */\\n error ErrInvalidOrderOfBridgeOperator();\\n\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n if (_ballot.operators.length == 0) revert ErrEmptyArray();\\n\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; ) {\\n if (_addr >= _ballot.operators[_i]) revert ErrInvalidOrderOfBridgeOperator();\\n _addr = _ballot.operators[_i];\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet memory self) internal pure returns (bytes32 digest_) {\\n bytes32 operatorsHash;\\n address[] memory operators = self.operators;\\n\\n // return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n assembly {\\n operatorsHash := keccak256(add(operators, 32), mul(mload(operators), 32))\\n let ptr := mload(0x40)\\n mstore(ptr, BRIDGE_OPERATORS_BALLOT_TYPEHASH)\\n mstore(add(ptr, 0x20), mload(self)) // _ballot.period\\n mstore(add(ptr, 0x40), mload(add(self, 0x20))) // _ballot.epoch\\n mstore(add(ptr, 0x60), operatorsHash)\\n digest_ := keccak256(ptr, 0x80)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7671f6e599d5a33fa1e97538b1c8e04159337da5701eb6fa07b29d0566f57f81\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUValidateDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of validating double sign evidence\\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\\n return address(0x67);\\n }\\n\\n /**\\n * @dev Validates the two submitted block header if they are produced by the same address\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcValidateEvidence(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) internal view virtual returns (bool _validEvidence) {\\n address _smc = precompileValidateDoubleSignAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"validatingDoubleSignProof(address,bytes,bytes)\\\",\\n _consensusAddr,\\n _header1,\\n _header2\\n );\\n uint _payloadLength = _payload.length;\\n uint[1] memory _output;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n return (_output[0] != 0);\\n }\\n}\\n\",\"keccak256\":\"0x9df5b8272e1cd963d776b94e29a69ba1139f0df7404b67c213b3c5ebe19e527b\",\"license\":\"MIT\"},\"contracts/precompile-usages/PCUValidateFastFinality.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUValidateFastFinality is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of validating double sign evidence\\n function precompileValidateFastFinalityAddress() public view virtual returns (address) {\\n return address(0x69);\\n }\\n\\n /**\\n * @dev Validates the proof of malicious voting on fast finality\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcValidateFastFinalityEvidence(\\n bytes memory voterPublicKey,\\n uint256 targetBlockNumber,\\n bytes32[2] memory targetBlockHash,\\n bytes[][2] memory listOfPublicKey,\\n bytes[2] memory aggregatedSignature\\n ) internal view virtual returns (bool validEvidence) {\\n address smc = precompileValidateFastFinalityAddress();\\n bool success = true;\\n\\n bytes memory payload = abi.encodeWithSignature(\\n \\\"validateFinalityVoteProof(bytes,uint256,bytes32[2],bytes[][2],bytes[2])\\\",\\n voterPublicKey,\\n targetBlockNumber,\\n targetBlockHash,\\n listOfPublicKey,\\n aggregatedSignature\\n );\\n uint payloadLength = payload.length;\\n uint[1] memory output;\\n\\n assembly {\\n let payloadStart := add(payload, 0x20)\\n if iszero(staticcall(gas(), smc, payloadStart, payloadLength, output, 0x20)) {\\n success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n success := 0\\n }\\n }\\n\\n if (!success) revert ErrCallPrecompiled();\\n return (output[0] != 0);\\n }\\n}\\n\",\"keccak256\":\"0x99a8bb36a8b3fecd3865fdfdda61ecd5daf3e26dba78ff844a2349a8a07d1ace\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/CreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ICreditScore.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated, HasMaintenanceDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport { ErrUnauthorized, RoleAccess } from \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract CreditScore is\\n ICreditScore,\\n HasContracts,\\n HasValidatorDeprecated,\\n HasMaintenanceDeprecated,\\n PercentageConsumer\\n{\\n /// @dev Mapping from validator address => period index => whether bailed out before\\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\\n /// @dev Mapping from validator address => credit score\\n mapping(address => uint256) internal _creditScore;\\n\\n /// @dev The max gained number of credit score per period.\\n uint256 internal _gainCreditScore;\\n /// @dev The max number of credit score that a validator can hold.\\n uint256 internal _maxCreditScore;\\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n uint256 internal _bailOutCostMultiplier;\\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\\n uint256 internal _cutOffPercentageAfterBailout;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function updateCreditScores(\\n address[] calldata _validators,\\n uint256 _period\\n ) external override onlyContract(ContractType.VALIDATOR) {\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(msg.sender);\\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\\n\\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\\n bool[] memory _maintaineds = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedInBlockRange(\\n _validators,\\n _periodStartAtBlock,\\n block.number\\n );\\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\\n\\n for (uint _i = 0; _i < _validators.length; ) {\\n address _validator = _validators[_i];\\n\\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\\n bool _isJailedInPeriod = _jaileds[_i];\\n bool _isMaintainingInPeriod = _maintaineds[_i];\\n\\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\\n ? 0\\n : Math.subNonNegative(_gainCreditScore, _indicator);\\n\\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\\n _updatedCreditScores[_i] = _creditScore[_validator];\\n unchecked {\\n ++_i;\\n }\\n }\\n\\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\\n }\\n\\n function execResetCreditScores(\\n address[] calldata _validators\\n ) external override onlyContract(ContractType.VALIDATOR) {\\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\\n for (uint _i = 0; _i < _validators.length; ) {\\n address _validator = _validators[_i];\\n delete _creditScore[_validator];\\n delete _updatedCreditScores[_i];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function bailOut(address _consensusAddr) external override {\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n if (!_validatorContract.isValidatorCandidate(_consensusAddr))\\n revert ErrUnauthorized(msg.sig, RoleAccess.VALIDATOR_CANDIDATE);\\n\\n if (!_validatorContract.isCandidateAdmin(_consensusAddr, msg.sender))\\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\\n\\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\\n if (!_isJailed) revert ErrCallerMustBeJailedInTheCurrentPeriod();\\n\\n uint256 _period = _validatorContract.currentPeriod();\\n if (_checkBailedOutAtPeriod[_consensusAddr][_period]) revert ErrValidatorHasBailedOutPreviously();\\n\\n uint256 _score = _creditScore[_consensusAddr];\\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\\n if (_score < _cost) revert ErrInsufficientCreditScoreToBailOut();\\n\\n _validatorContract.execBailOut(_consensusAddr, _period);\\n\\n _creditScore[_consensusAddr] -= _cost;\\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\\n emit BailedOut(_consensusAddr, _period, _cost);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external override onlyAdmin {\\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability`\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 gainCreditScore_,\\n uint256 maxCreditScore_,\\n uint256 bailOutCostMultiplier_,\\n uint256 cutOffPercentageAfterBailout_\\n )\\n {\\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScore(address _validator) external view override returns (uint256) {\\n return _creditScore[_validator];\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getManyCreditScores(\\n address[] calldata _validators\\n ) public view override returns (uint256[] memory _resultList) {\\n _resultList = new uint256[](_validators.length);\\n\\n for (uint _i = 0; _i < _resultList.length; ) {\\n _resultList[_i] = _creditScore[_validators[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\\n return _checkBailedOutAtPeriod[_validator][_period];\\n }\\n\\n /**\\n * @dev See `SlashUnavailability`.\\n */\\n function _setUnavailabilityIndicator(address _validator, uint256 _period, uint256 _indicator) internal virtual;\\n\\n /**\\n * @dev See `ICreditScore-setCreditScoreConfigs`.\\n */\\n function _setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) internal {\\n if (_gainScore > _maxScore) revert ErrInvalidCreditScoreConfig();\\n if (_cutOffPercentage > _MAX_PERCENTAGE) revert ErrInvalidCutOffPercentageConfig();\\n\\n _gainCreditScore = _gainScore;\\n _maxCreditScore = _maxScore;\\n _bailOutCostMultiplier = _bailOutMultiplier;\\n _cutOffPercentageAfterBailout = _cutOffPercentage;\\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n}\\n\",\"keccak256\":\"0xb4321e0140e8a0ceb0b41e8a65d6448fbb2a74c56233fb0aa4a7769016d2b5c6\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../extensions/collections/HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\n\\nabstract contract SlashBridgeOperator is\\n ISlashBridgeOperator,\\n HasProxyAdmin,\\n HasContracts,\\n HasValidatorDeprecated,\\n PercentageConsumer\\n{\\n /**\\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\\n * Values 0-10,000 map to 0%-100%.\\n */\\n uint256 internal _missingVotesRatioTier1;\\n /**\\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\\n * more than the ratio. Values 0-10,000 map to 0%-100%.\\n */\\n uint256 internal _missingVotesRatioTier2;\\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\\n uint256 internal _jailDurationForMissingVotesRatioTier2;\\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\\n uint256 internal _skipBridgeOperatorSlashingThreshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 missingVotesRatioTier1_,\\n uint256 missingVotesRatioTier2_,\\n uint256 jailDurationForMissingVotesRatioTier2_,\\n uint256 skipBridgeOperatorSlashingThreshold_\\n )\\n {\\n return (\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2,\\n _jailDurationForMissingVotesRatioTier2,\\n _skipBridgeOperatorSlashingThreshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external override onlyAdmin {\\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external onlyContract(ContractType.VALIDATOR) {\\n if (_tier == 1) {\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\\n } else if (_tier == 2) {\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\\n }\\n }\\n\\n /**\\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\\n */\\n function _setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) internal {\\n if (_ratioTier1 > _ratioTier2 || _ratioTier1 > _MAX_PERCENTAGE || _ratioTier2 > _MAX_PERCENTAGE) {\\n revert ErrInvalidRatios();\\n }\\n\\n _missingVotesRatioTier1 = _ratioTier1;\\n _missingVotesRatioTier2 = _ratioTier2;\\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\\n }\\n}\\n\",\"keccak256\":\"0xb8125efc8cced5cd5e57be1e1ad25553439c6470545ef9eee79fb45d8774b18e\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated, HasTrustedOrgDeprecated, HasGovernanceAdminDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport { IBridgeAdminProposal } from \\\"../../interfaces/IBridgeAdminProposal.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\n\\n// TODO: remove this from slashing logic of consensus contract\\nabstract contract SlashBridgeVoting is\\n ISlashBridgeVoting,\\n HasContracts,\\n HasValidatorDeprecated,\\n HasTrustedOrgDeprecated,\\n HasGovernanceAdminDeprecated\\n{\\n /// @dev Mapping from validator address => period index => bridge voting slashed\\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\\n uint256 internal _bridgeVotingThreshold;\\n /// @dev The amount of RON to slash bridge voting.\\n uint256 internal _bridgeVotingSlashAmount;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function slashBridgeVoting(address _consensusAddr) external onlyAdmin {\\n IRoninTrustedOrganization.TrustedOrganization memory _org = IRoninTrustedOrganization(\\n getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)\\n ).getTrustedOrganization(_consensusAddr);\\n uint256 _lastVotedBlock = Math.max(\\n IBridgeAdminProposal(getContract(ContractType.BRIDGE_MANAGER)).lastVotedBlock(_org.bridgeVoter),\\n _org.addedBlock\\n );\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 _period = _validatorContract.currentPeriod();\\n\\n if (block.number - _lastVotedBlock <= _bridgeVotingThreshold || _bridgeVotingSlashed[_consensusAddr][_period])\\n revert ErrInvalidSlash();\\n\\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n override\\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\\n {\\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\\n }\\n\\n /**\\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\\n */\\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\\n _bridgeVotingThreshold = _threshold;\\n _bridgeVotingSlashAmount = _slashAmount;\\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\\n }\\n}\\n\",\"keccak256\":\"0x807b11148e3db8b738dda824fa3c333d143cc9f3d5faf44297d81a8556dd14b7\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ISlashDoubleSign.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../precompile-usages/PCUValidateDoubleSign.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\n\\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasContracts, HasValidatorDeprecated, PCUValidateDoubleSign {\\n /// @dev The amount of RON to slash double sign.\\n uint256 internal _slashDoubleSignAmount;\\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\\n uint256 internal _doubleSigningJailUntilBlock;\\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\\n * This parameter is exposed for system transaction.\\n **/\\n uint256 internal _doubleSigningOffsetLimitBlock;\\n /// @dev Recording of submitted proof to prevent relay attack.\\n mapping(bytes32 => bool) _submittedEvidence;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[24] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function slashDoubleSign(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external override onlyAdmin {\\n bytes32 _header1Checksum = keccak256(_header1);\\n bytes32 _header2Checksum = keccak256(_header2);\\n\\n if (_submittedEvidence[_header1Checksum] || _submittedEvidence[_header2Checksum]) {\\n revert ErrEvidenceAlreadySubmitted();\\n }\\n\\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 _period = _validatorContract.currentPeriod();\\n _submittedEvidence[_header1Checksum] = true;\\n _submittedEvidence[_header2Checksum] = true;\\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 slashDoubleSignAmount_,\\n uint256 doubleSigningJailUntilBlock_,\\n uint256 doubleSigningOffsetLimitBlock_\\n )\\n {\\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) external override onlyAdmin {\\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\\n }\\n\\n /**\\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\\n */\\n function _setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) internal {\\n _slashDoubleSignAmount = _slashAmount;\\n _doubleSigningJailUntilBlock = _jailUntilBlock;\\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(address _addr) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x2adce411c8e4ab69c76a5c3be69c7ae3dde7278d560f9db406c4ba4385b056b1\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashFastFinality.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ISlashFastFinality.sol\\\";\\nimport { IRoninValidatorSet } from \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport { IProfile } from \\\"../../interfaces/IProfile.sol\\\";\\nimport { IRoninTrustedOrganization } from \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../../precompile-usages/PCUValidateFastFinality.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUValidateFastFinality {\\n /// @dev The amount of RON to slash fast finality.\\n uint256 internal _slashFastFinalityAmount;\\n /// @dev The block number that the punished validator will be jailed until, due to malicious fast finality.\\n uint256 internal _fastFinalityJailUntilBlock;\\n /// @dev Recording of submitted proof to prevent relay attack.\\n mapping(bytes32 => bool) internal _processedEvidence;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[21] private ______gap;\\n\\n modifier onlyGoverningValidator() {\\n if (_getGovernorWeight(msg.sender) == 0) revert ErrUnauthorized(msg.sig, RoleAccess.GOVERNOR);\\n _;\\n }\\n\\n /**\\n * @inheritdoc ISlashFastFinality\\n */\\n function slashFastFinality(\\n address consensusAddr,\\n bytes calldata voterPublicKey,\\n uint256 targetBlockNumber,\\n bytes32[2] calldata targetBlockHash,\\n bytes[][2] calldata listOfPublicKey,\\n bytes[2] calldata aggregatedSignature\\n ) external override onlyGoverningValidator {\\n IProfile profileContract = IProfile(getContract(ContractType.PROFILE));\\n bytes memory expectingPubKey = (profileContract.getId2Profile(consensusAddr)).pubkey;\\n if (keccak256(voterPublicKey) != keccak256(expectingPubKey)) revert ErrInvalidArguments(msg.sig);\\n\\n bytes32 evidenceHash = keccak256(abi.encodePacked(consensusAddr, targetBlockNumber));\\n if (_processedEvidence[evidenceHash]) revert ErrEvidenceAlreadySubmitted();\\n\\n if (\\n _pcValidateFastFinalityEvidence(\\n voterPublicKey,\\n targetBlockNumber,\\n targetBlockHash,\\n listOfPublicKey,\\n aggregatedSignature\\n )\\n ) {\\n _processedEvidence[evidenceHash] = true;\\n\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 period = validatorContract.currentPeriod();\\n emit Slashed(consensusAddr, SlashType.FAST_FINALITY, period);\\n validatorContract.execSlash({\\n validatorAddr: consensusAddr,\\n newJailedUntil: _fastFinalityJailUntilBlock,\\n slashAmount: _slashFastFinalityAmount,\\n cannotBailout: true\\n });\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashFastFinality\\n */\\n function getFastFinalitySlashingConfigs()\\n external\\n view\\n override\\n returns (uint256 slashFastFinalityAmount_, uint256 fastFinalityJailUntilBlock_)\\n {\\n return (_slashFastFinalityAmount, _fastFinalityJailUntilBlock);\\n }\\n\\n /**\\n * @inheritdoc ISlashFastFinality\\n */\\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external override onlyAdmin {\\n _setFastFinalitySlashingConfigs(slashAmount, jailUntilBlock);\\n }\\n\\n /**\\n * @dev See `ISlashFastFinality-setFastFinalitySlashingConfigs`.\\n */\\n function _setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) internal {\\n _slashFastFinalityAmount = slashAmount;\\n _fastFinalityJailUntilBlock = jailUntilBlock;\\n emit FastFinalitySlashingConfigsUpdated(slashAmount, jailUntilBlock);\\n }\\n\\n /**\\n * @dev Get governor, i.e. governing validator's weight, of the `addr`.\\n */\\n function _getGovernorWeight(address addr) internal view returns (uint256) {\\n return IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getGovernorWeight(addr);\\n }\\n}\\n\",\"keccak256\":\"0xf6b0b7c990ca14465ffe0fac805003f425fa833df505a6f763421251786f77c8\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\nimport \\\"./SlashDoubleSign.sol\\\";\\nimport \\\"./SlashFastFinality.sol\\\";\\nimport \\\"./SlashBridgeVoting.sol\\\";\\nimport \\\"./SlashBridgeOperator.sol\\\";\\nimport \\\"./SlashUnavailability.sol\\\";\\nimport \\\"./CreditScore.sol\\\";\\n\\ncontract SlashIndicator is\\n ISlashIndicator,\\n SlashDoubleSign,\\n SlashFastFinality,\\n SlashBridgeVoting,\\n SlashBridgeOperator,\\n SlashUnavailability,\\n CreditScore,\\n Initializable\\n{\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __roninGovernanceAdminContract,\\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\\n uint256[2] calldata _bridgeVotingSlashingConfigs,\\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\\n uint256[3] calldata _doubleSignSlashingConfigs,\\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\\n uint256[4] calldata _unavailabilitySlashingConfigs,\\n // _creditScoreConfigs[0]: _gainCreditScore\\n // _creditScoreConfigs[1]: _maxCreditScore\\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\\n uint256[4] calldata _creditScoreConfigs\\n ) external initializer {\\n _setContract(ContractType.VALIDATOR, __validatorContract);\\n _setContract(ContractType.MAINTENANCE, __maintenanceContract);\\n _setContract(ContractType.GOVERNANCE_ADMIN, __roninGovernanceAdminContract);\\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract);\\n\\n _setBridgeOperatorSlashingConfigs(\\n _bridgeOperatorSlashingConfigs[0],\\n _bridgeOperatorSlashingConfigs[1],\\n _bridgeOperatorSlashingConfigs[2],\\n _bridgeOperatorSlashingConfigs[3]\\n );\\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\\n _setDoubleSignSlashingConfigs(\\n _doubleSignSlashingConfigs[0],\\n _doubleSignSlashingConfigs[1],\\n _doubleSignSlashingConfigs[2]\\n );\\n _setUnavailabilitySlashingConfigs(\\n _unavailabilitySlashingConfigs[0],\\n _unavailabilitySlashingConfigs[1],\\n _unavailabilitySlashingConfigs[2],\\n _unavailabilitySlashingConfigs[3]\\n );\\n _setCreditScoreConfigs(\\n _creditScoreConfigs[0],\\n _creditScoreConfigs[1],\\n _creditScoreConfigs[2],\\n _creditScoreConfigs[3]\\n );\\n }\\n\\n function initializeV2(address roninGovernanceAdminContract) external reinitializer(2) {\\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\\n _setContract(ContractType.MAINTENANCE, ______deprecatedMaintenance);\\n _setContract(ContractType.GOVERNANCE_ADMIN, roninGovernanceAdminContract);\\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ______deprecatedTrustedOrg);\\n\\n delete ______deprecatedValidator;\\n delete ______deprecatedMaintenance;\\n delete ______deprecatedTrustedOrg;\\n delete ______deprecatedGovernanceAdmin;\\n }\\n\\n function initializeV3(address profileContract) external reinitializer(3) {\\n _setContract(ContractType.PROFILE, profileContract);\\n _setFastFinalitySlashingConfigs(_slashDoubleSignAmount, _doubleSigningJailUntilBlock);\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal override(CreditScore, SlashUnavailability) {\\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to query indicator of the validator.\\n */\\n function getUnavailabilityIndicator(\\n address _validator,\\n uint256 _period\\n ) public view override(CreditScore, ISlashUnavailability, SlashUnavailability) returns (uint256) {\\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(\\n address _validator,\\n uint256 _period\\n ) public view override(CreditScore, ICreditScore, SlashUnavailability) returns (bool) {\\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\\n }\\n\\n /**\\n * @dev Sanity check the address to be slashed\\n */\\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\\n return\\n (msg.sender != _addr) &&\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isBlockProducer(_addr) &&\\n !IMaintenance(getContract(ContractType.MAINTENANCE)).checkMaintained(_addr, block.number);\\n }\\n}\\n\",\"keccak256\":\"0x816f24425b181c235f79da66bef32609574c1df7d801e705be67db022a2c69d9\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./CreditScore.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashUnavailability.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport { ErrInvalidThreshold } from \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract SlashUnavailability is ISlashUnavailability, HasContracts, HasValidatorDeprecated {\\n /// @dev The last block that a validator is slashed for unavailability.\\n uint256 public lastUnavailabilitySlashedBlock;\\n /// @dev Mapping from validator address => period index => unavailability indicator.\\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\\n\\n /**\\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\\n */\\n uint256 internal _unavailabilityTier1Threshold;\\n /**\\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n */\\n uint256 internal _unavailabilityTier2Threshold;\\n /**\\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\\n * tier-2 or tier-3.\\n **/\\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n modifier oncePerBlock() {\\n if (block.number <= lastUnavailabilitySlashedBlock) {\\n revert ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\\n }\\n\\n lastUnavailabilitySlashedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\\n if (msg.sender != block.coinbase) revert ErrUnauthorized(msg.sig, RoleAccess.COINBASE);\\n\\n if (!_shouldSlash(_validatorAddr)) {\\n // Should return instead of throwing error since this is a part of system transaction.\\n return;\\n }\\n\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 _period = _validatorContract.currentPeriod();\\n uint256 _count;\\n unchecked {\\n _count = ++_unavailabilityIndicator[_validatorAddr][_period];\\n }\\n uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\\n\\n if (_count == _unavailabilityTier2Threshold) {\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\\n _validatorContract.execSlash(\\n _validatorAddr,\\n _newJailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n false\\n );\\n } else if (_count == _unavailabilityTier1Threshold) {\\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\\n if (!_tier1SecondTime) {\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\\n } else {\\n /// Handles tier-3\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\\n _validatorContract.execSlash(\\n _validatorAddr,\\n _newJailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n true\\n );\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external override onlyAdmin {\\n _setUnavailabilitySlashingConfigs(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 unavailabilityTier1Threshold_,\\n uint256 unavailabilityTier2Threshold_,\\n uint256 slashAmountForUnavailabilityTier2Threshold_,\\n uint256 jailDurationForUnavailabilityTier2Threshold_\\n )\\n {\\n return (\\n _unavailabilityTier1Threshold,\\n _unavailabilityTier2Threshold,\\n _slashAmountForUnavailabilityTier2Threshold,\\n _jailDurationForUnavailabilityTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\\n return\\n getUnavailabilityIndicator(_validator, IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod());\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilityIndicator(\\n address _validator,\\n uint256 _period\\n ) public view virtual override returns (uint256) {\\n return _unavailabilityIndicator[_validator][_period];\\n }\\n\\n /**\\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\\n */\\n function _setUnavailabilityIndicator(address _validator, uint256 _period, uint256 _indicator) internal virtual {\\n _unavailabilityIndicator[_validator][_period] = _indicator;\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\\n */\\n function _setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) internal {\\n if (_unavailabilityTier1Threshold > _unavailabilityTier2Threshold) revert ErrInvalidThreshold(msg.sig);\\n\\n _unavailabilityTier1Threshold = _tier1Threshold;\\n _unavailabilityTier2Threshold = _tier2Threshold;\\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\\n emit UnavailabilitySlashingConfigsUpdated(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(address _addr) internal view virtual returns (bool);\\n\\n /**\\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x77e1f62b033c810f9847fefeca1b7b4e3cf7b5dd754928fd765da57512a29b4d\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x22942c8fea2d1ca863ac1f9c1662d714b8ac0856684e36f8aaf19508648c1053\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALTIY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x57e684dc2640b237ea5eaa29234a3b640b18ceb5d16c74d0c3f13fa0c28e533a\",\"license\":\"MIT\"},\"contracts/utils/DeprecatedSlots.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Deprecated Contracts\\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\\n * They provide functionality related to various aspects of a smart contract but have been marked\\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\\n */\\ncontract HasSlashIndicatorDeprecated {\\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\\n address internal ______deprecatedSlashIndicator;\\n}\\n\\ncontract HasStakingVestingDeprecated {\\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\\n address internal ______deprecatedStakingVesting;\\n}\\n\\ncontract HasBridgeDeprecated {\\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\\n address internal ______deprecatedBridge;\\n}\\n\\ncontract HasValidatorDeprecated {\\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\\n address internal ______deprecatedValidator;\\n}\\n\\ncontract HasStakingDeprecated {\\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\\n address internal ______deprecatedStakingContract;\\n}\\n\\ncontract HasMaintenanceDeprecated {\\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\\n address internal ______deprecatedMaintenance;\\n}\\n\\ncontract HasTrustedOrgDeprecated {\\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\\n address internal ______deprecatedTrustedOrg;\\n}\\n\\ncontract HasGovernanceAdminDeprecated {\\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\\n address internal ______deprecatedGovernanceAdmin;\\n}\\n\\ncontract HasBridgeTrackingDeprecated {\\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\\n address internal ______deprecatedBridgeTracking;\\n}\\n\",\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE\\n}\\n\",\"keccak256\":\"0xa98cec38c640c4e37f475debbcd366226f1188c3f5ea6e29de768bd33e021873\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e7565b61011354610100900460ff1615620000905760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b6101135460ff9081161015620000e557610113805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6133d080620000f76000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c806399103f7b1161011a578063d1cf4343116100ad578063df4b6ee01161007c578063df4b6ee01461046e578063e9bb166614610492578063f1001e7814610499578063f562b3c4146104b9578063fd422cd0146104c257600080fd5b8063d1cf43431461040c578063d1f992f71461041f578063d3dd2bdf14610432578063de981f1b1461045b57600080fd5b8063c6391fa2116100e9578063c6391fa2146103c2578063ccbb72ed146103d3578063cf39d13c146103e6578063d1737e27146103f957600080fd5b806399103f7b1461037e578063a345ecb214610391578063c008ce39146103a4578063c2e524dc146103b757600080fd5b80633101cfcb116101925780637680850c116101615780637680850c1461032a5780637c2b55a01461033d578063853af1b714610358578063865e6fd31461036b57600080fd5b80633101cfcb146102d75780633d48fd7d146102ea578063487e00ea146102fb57806362ffe6cb1461031757600080fd5b80631a697341116101ce5780631a6973411461027b5780631e90b2a01461028e57806329b6eca9146102a157806329ddc3c0146102b457600080fd5b806307c2d2f614610200578063082e7420146102155780630e1512ac1461023b5780631079402a1461024e575b600080fd5b61021361020e3660046125ad565b6104d5565b005b610228610223366004612603565b6105e2565b6040519081526020015b60405180910390f35b610213610249366004612620565b610659565b606d54606e54606f546070545b604080519485526020850193909352918301526060820152608001610232565b610213610289366004612603565b610673565b61021361029c366004612693565b610914565b6102136102af366004612603565b610afc565b6102c76102c2366004612715565b610c20565b6040519015158152602001610232565b6102136102e5366004612603565b610c4f565b60a55460a65460a75460a85461025b565b601d54601e545b60408051928352602083019190915201610232565b610228610325366004612715565b610cfc565b610213610338366004612741565b610d25565b60675b6040516001600160a01b039091168152602001610232565b61021361036636600461278c565b61103b565b6102136103793660046127bd565b611051565b61021361038c366004612816565b61106c565b61021361039f36600461278c565b6111d7565b6102136103b23660046128d4565b6111e9565b603854603954610302565b60dd5460de5460df5460e05461025b565b6102136103e1366004612620565b611273565b6102136103f4366004612909565b611287565b610213610407366004612620565b61129f565b61021361041a366004612935565b6112b3565b61021361042d366004612603565b6115df565b610228610440366004612603565b6001600160a01b0316600090815260dc602052604090205490565b6103406104693660046129f3565b6119ce565b60015460025460035460408051938452602084019290925290820152606001610232565b6069610340565b6104ac6104a73660046125ad565b611a49565b6040516102329190612a49565b61022860a35481565b6102136104d0366004612603565b611b13565b60086104e081611e27565b6000826001600160401b038111156104fa576104fa612a5c565b604051908082528060200260200182016040528015610523578160200160208202803683370190505b50905060005b838110156105a057600085858381811061054557610545612a72565b905060200201602081019061055a9190612603565b6001600160a01b038116600090815260dc6020526040812055835190915083908390811061058a5761058a612a72565b6000602091820292909201015250600101610529565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c234808484836040516105d493929190612ac6565b60405180910390a150505050565b6000610653826105f260086119ce565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa15801561062f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103259190612af6565b92915050565b610661611e73565b61066d84848484611ecf565b50505050565b61067b611e73565b6000610687600a6119ce565b604051636db349d160e11b81526001600160a01b038481166004830152919091169063db6693a29060240160a060405180830381865afa1580156106cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f39190612b94565b9050600061077d610704600b6119ce565b6040808501519051632623bd4f60e21b81526001600160a01b03918216600482015291169063988ef53c90602401602060405180830381865afa15801561074f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107739190612af6565b8360800151611f61565b9050600061078b60086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f19190612af6565b6038549091506108018443612c31565b11158061083157506001600160a01b038516600090815260376020908152604080832084845290915290205460ff165b1561084f57604051632e308a0b60e11b815260040160405180910390fd5b6001600160a01b038516600081815260376020908152604080832085845290915290819020805460ff19166001179055516000805160206133a48339815191529061089e906004908590612c6a565b60405180910390a2603954604051630bde081360e21b81526001600160a01b03841691632f78204c916108db918991600091908290600401612c81565b600060405180830381600087803b1580156108f557600080fd5b505af1158015610909573d6000803e3d6000fd5b505050505050505050565b61091c611e73565b6000848460405161092e929190612ca9565b604051809103902090506000838360405161094a929190612ca9565b604080519182900390912060008481526004602052919091205490915060ff1680610983575060008181526004602052604090205460ff165b156109a15760405163f27b8ec960e01b815260040160405180910390fd5b6109ae8787878787611f78565b15610af35760006109bf60086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a259190612af6565b6000858152600460205260408082208054600160ff19918216811790925587845292829020805490931617909155519091506001600160a01b038a16906000805160206133a483398151915290610a80906003908590612c6a565b60405180910390a260025460018054604051630bde081360e21b81526001600160a01b03861693632f78204c93610abe938f93909190600401612c81565b600060405180830381600087803b158015610ad857600080fd5b505af1158015610aec573d6000803e3d6000fd5b5050505050505b50505050505050565b61011354600290610100900460ff16158015610b2057506101135460ff8083169116105b610b455760405162461bcd60e51b8152600401610b3c90612cb9565b60405180910390fd5b610113805461ffff191660ff831617610100179055600054610b72906008906001600160a01b0316612022565b606c54610b8a906005906001600160a01b0316612022565b610b95600483612022565b603554610bad90600a906001600160a01b0316612022565b600080546001600160a01b0319908116909155606c8054821690556035805482169055603680549091169055610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff165b9392505050565b61011354600390610100900460ff16158015610c7357506101135460ff8083169116105b610c8f5760405162461bcd60e51b8152600401610b3c90612cb9565b610113805461ffff191660ff831617610100179055610caf600f83612022565b610cbd6001546002546120c6565b610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610c14565b6001600160a01b038216600090815260a460209081526040808320848452909152812054610c48565b6008610d3081611e27565b60003390506000816001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d999190612af6565b90506000826001600160a01b0316634de2b73588886040518363ffffffff1660e01b8152600401610dcb929190612d07565b600060405180830381865afa158015610de8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e109190810190612d4e565b90506000610e1e60056119ce565b6001600160a01b031663ba303755898986436040518563ffffffff1660e01b8152600401610e4f9493929190612dea565b600060405180830381865afa158015610e6c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e949190810190612d4e565b90506000876001600160401b03811115610eb057610eb0612a5c565b604051908082528060200260200182016040528015610ed9578160200160208202803683370190505b50905060005b88811015610ff45760008a8a83818110610efb57610efb612a72565b9050602002016020810190610f109190612603565b90506000610f1e828b610cfc565b90506000868481518110610f3457610f34612a72565b602002602001015190506000868581518110610f5257610f52612a72565b6020026020010151905060008280610f675750815b610f7c57610f7760dd5485612106565b610f7f565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610fa9918390612120565b6001600160a01b038616600090815260dc602052604090208190558751889088908110610fd857610fd8612a72565b6020026020010181815250508560010195505050505050610edf565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c2348089898360405161102893929190612ac6565b60405180910390a1505050505050505050565b611043611e73565b61104d828261213d565b5050565b611059611e73565b6110628161217d565b61104d8282612022565b61011354610100900460ff161580801561108e575061011354600160ff909116105b806110a95750303b1580156110a957506101135460ff166001145b6110c55760405162461bcd60e51b8152600401610b3c90612cb9565b610113805460ff1916600117905580156110ea57610113805461ff0019166101001790555b6110f560088b612022565b61110060058a612022565b61110b600488612022565b611116600a89612022565b61112f86356020880135604089013560608a0135611ecf565b61113e8535602087013561213d565b6111528435602086013560408701356121b3565b61116b8335602085013560408601356060870135612208565b6111848235602084013560408501356060860135612294565b80156111cb57610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6111df611e73565b61104d82826120c6565b60086111f481611e27565b8260010361123357836001600160a01b03166000805160206133a4833981519152600584604051611226929190612c6a565b60405180910390a261066d565b8260020361066d57836001600160a01b03166000805160206133a4833981519152600684604051611265929190612c6a565b60405180910390a250505050565b61127b611e73565b61066d84848484612294565b61128f611e73565b61129a8383836121b3565b505050565b6112a7611e73565b61066d84848484612208565b6112bc33612331565b6000036112ec576000356001600160e01b0319166003604051620f948f60ea1b8152600401610b3c929190612e11565b60006112f8600f6119ce565b6040516303d1982560e61b81526001600160a01b038a8116600483015291925060009183169063f466094090602401600060405180830381865afa158015611344573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261136c9190810190612ec8565b60a0015190508080519060200120888860405161138a929190612ca9565b6040518091039020146113be5760405163053265f160e01b81526001600160e01b0319600035166004820152602401610b3c565b6040516bffffffffffffffffffffffff1960608b901b1660208201526034810187905260009060540160408051601f1981840301815291815281516020928301206000818152601f90935291205490915060ff16156114305760405163f27b8ec960e01b815260040160405180910390fd5b6114a689898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820182528c935091508a90600290839083908082843760009201919091525061149891508a9050612fe0565b6114a1896130b7565b6123a9565b156111cb576000818152601f60205260408120805460ff191660011790556114ce60086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611510573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115349190612af6565b90508b6001600160a01b03166000805160206133a4833981519152600883604051611560929190612c6a565b60405180910390a2816001600160a01b0316632f78204c8d601e54601d5460016040518563ffffffff1660e01b815260040161159f9493929190612c81565b600060405180830381600087803b1580156115b957600080fd5b505af11580156115cd573d6000803e3d6000fd5b50505050505050505050505050505050565b60006115eb60086119ce565b604051635061f96960e11b81526001600160a01b0384811660048301529192509082169063a0c3f2d290602401602060405180830381865afa158015611635573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611659919061310f565b611686576000356001600160e01b0319166008604051620f948f60ea1b8152600401610b3c929190612e11565b6040516304d971ab60e01b81526001600160a01b0383811660048301523360248301528216906304d971ab90604401602060405180830381865afa1580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f6919061310f565b611723576000356001600160e01b0319166004604051620f948f60ea1b8152600401610b3c929190612e11565b604051634b2c2fe160e11b81526001600160a01b03838116600483015260009182918416906396585fc290602401606060405180830381865afa15801561176e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611792919061312a565b9250509150816117b557604051636cd31b5960e01b815260040160405180910390fd5b6000836001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118199190612af6565b6001600160a01b038616600090815260db6020908152604080832084845290915290205490915060ff161561186157604051637674d6a960e01b815260040160405180910390fd5b6001600160a01b038516600090815260dc602052604081205460df5490919061188a908561315f565b9050808210156118ad5760405163462e593760e11b815260040160405180910390fd5b604051630adaf5ef60e11b81526001600160a01b038881166004830152602482018590528716906315b5ebde90604401600060405180830381600087803b1580156118f757600080fd5b505af115801561190b573d6000803e3d6000fd5b505050506001600160a01b038716600090815260dc602052604081208054839290611937908490612c31565b90915550506001600160a01b038716600090815260a4602090815260408083208684529091528120556001600160a01b038716600081815260db60209081526040808320878452825291829020805460ff1916600117905581518681529081018490527f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a250505050505050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115611a0557611a05612c44565b60ff1681526020810191909152604001600020546001600160a01b0316905080611a44578160405163409140df60e11b8152600401610b3c919061318a565b919050565b6060816001600160401b03811115611a6357611a63612a5c565b604051908082528060200260200182016040528015611a8c578160200160208202803683370190505b50905060005b8151811015611b0c5760dc6000858584818110611ab157611ab1612a72565b9050602002016020810190611ac69190612603565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110611af957611af9612a72565b6020908102919091010152600101611a92565b5092915050565b60a3544311611b355760405163557fd09160e01b815260040160405180910390fd5b4360a355334114611b69576000356001600160e01b0319166002604051620f948f60ea1b8152600401610b3c929190612e11565b611b7281612404565b15611e24576000611b8360086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be99190612af6565b6001600160a01b038416600090815260a460209081526040808320848452909152812080546001019081905560a85492935091611c2790439061251a565b905060a6548203611cd057846001600160a01b03166000805160206133a4833981519152600285604051611c5c929190612c6a565b60405180910390a260a754604051630bde081360e21b81526001600160a01b03861691632f78204c91611c99918991869190600090600401612c81565b600060405180830381600087803b158015611cb357600080fd5b505af1158015611cc7573d6000803e3d6000fd5b50505050611e1f565b60a5548203611e1f576000611ce58685610c20565b905080611d8857856001600160a01b03166000805160206133a4833981519152600186604051611d16929190612c6a565b60405180910390a2604051630bde081360e21b81526001600160a01b03861690632f78204c90611d5190899060009081908190600401612c81565b600060405180830381600087803b158015611d6b57600080fd5b505af1158015611d7f573d6000803e3d6000fd5b50505050611e1d565b856001600160a01b03166000805160206133a4833981519152600786604051611db2929190612c6a565b60405180910390a260a754604051630bde081360e21b81526001600160a01b03871691632f78204c91611def918a91879190600190600401612c81565b600060405180830381600087803b158015611e0957600080fd5b505af11580156111cb573d6000803e3d6000fd5b505b505050505b50565b611e30816119ce565b6001600160a01b0316336001600160a01b031614611e24576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610b3c93929190613198565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611ecd576000356001600160e01b0319166001604051620f948f60ea1b8152600401610b3c929190612e11565b565b82841180611ede575061271084115b80611eea575061271083115b15611f0857604051631cbe1abf60e11b815260040160405180910390fd5b606d849055606e839055606f82905560708190556040805185815260208101859052908101839052606081018290527fd24c671da2227c139fe1a5b34de15e5a67bef9b46e912916b9e0d025d51b3e3b906080016105d4565b600081831015611f715781610c48565b5090919050565b6040516000906067906001908390611f9c908a908a908a908a908a906024016131f8565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b1790528051909150611fd3612544565b602083016020828483895afa611fe857600094505b503d611ff357600093505b8361201157604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f81111561205857612058612c44565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f81111561209957612099612c44565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b601d829055601e81905560408051838152602081018390527f381ec200df2ed0875638486318f9f8a84e3550bdc686bf1400c9371a18d087f09101610c14565b6000818311612116576000610c48565b610c488284612c31565b600061213561212f848661323c565b83612535565b949350505050565b6038829055603981905560408051838152602081018390527fbda9ec2980d7468ba6a9f363696315affca9f9770016396bdea2ac39c3e5d61a9101610c14565b806001600160a01b03163b600003611e2457604051630bfc64a360e21b81526001600160a01b0382166004820152602401610b3c565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b9060600160405180910390a1505050565b60a65460a554111561223b576040516387f6f09560e01b81526001600160e01b0319600035166004820152602401610b3c565b60a584905560a683905560a782905560a88190556040805185815260208101859052908101839052606081018290527f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa98906080016105d4565b828411156122b55760405163112af4d160e01b815260040160405180910390fd5b6127108111156122d85760405163382c88a360e21b815260040160405180910390fd5b60dd84905560de83905560df82905560e08190556040805185815260208101859052908101839052606081018290527fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b906080016105d4565b600061233d600a6119ce565b604051631af0725f60e31b81526001600160a01b038481166004830152919091169063d78392f890602401602060405180830381865afa158015612385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106539190612af6565b60405160009060699060019083906123cd908a908a908a908a908a906024016132c0565b60408051601f198184030181529190526020810180516001600160e01b0316637b47d06b60e01b1790528051909150611fd3612544565b6000336001600160a01b03831614801590612490575061242460086119ce565b604051633292276760e11b81526001600160a01b03848116600483015291909116906365244ece90602401602060405180830381865afa15801561246c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612490919061310f565b801561065357506124a160056119ce565b604051630fbeb37f60e01b81526001600160a01b0384811660048301524360248301529190911690630fbeb37f90604401602060405180830381865afa1580156124ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612513919061310f565b1592915050565b60008160000361252b576000610c48565b610c48828461323c565b6000818310611f715781610c48565b60405180602001604052806001906020820280368337509192915050565b60008083601f84011261257457600080fd5b5081356001600160401b0381111561258b57600080fd5b6020830191508360208260051b85010111156125a657600080fd5b9250929050565b600080602083850312156125c057600080fd5b82356001600160401b038111156125d657600080fd5b6125e285828601612562565b90969095509350505050565b6001600160a01b0381168114611e2457600080fd5b60006020828403121561261557600080fd5b8135610c48816125ee565b6000806000806080858703121561263657600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f84011261266457600080fd5b5081356001600160401b0381111561267b57600080fd5b6020830191508360208285010111156125a657600080fd5b6000806000806000606086880312156126ab57600080fd5b85356126b6816125ee565b945060208601356001600160401b03808211156126d257600080fd5b6126de89838a01612652565b909650945060408801359150808211156126f757600080fd5b5061270488828901612652565b969995985093965092949392505050565b6000806040838503121561272857600080fd5b8235612733816125ee565b946020939093013593505050565b60008060006040848603121561275657600080fd5b83356001600160401b0381111561276c57600080fd5b61277886828701612562565b909790965060209590950135949350505050565b6000806040838503121561279f57600080fd5b50508035926020909101359150565b803560108110611a4457600080fd5b600080604083850312156127d057600080fd5b6127d9836127ae565b915060208301356127e9816125ee565b809150509250929050565b806080810183101561065357600080fd5b806040810183101561065357600080fd5b60008060008060008060008060006102a08a8c03121561283557600080fd5b8935612840816125ee565b985060208a0135612850816125ee565b975060408a0135612860816125ee565b965060608a0135612870816125ee565b955061287f8b60808c016127f4565b945061288f8b6101008c01612805565b93506101a08a018b8111156128a357600080fd5b6101408b0193506128b48c826127f4565b9250506128c58b6102208c016127f4565b90509295985092959850929598565b6000806000606084860312156128e957600080fd5b83356128f4816125ee565b95602085013595506040909401359392505050565b60008060006060848603121561291e57600080fd5b505081359360208301359350604090920135919050565b600080600080600080600060e0888a03121561295057600080fd5b873561295b816125ee565b965060208801356001600160401b038082111561297757600080fd5b6129838b838c01612652565b909850965060408a0135955086915061299f8b60608c01612805565b945060a08a01359150808211156129b557600080fd5b6129c18b838c01612805565b935060c08a01359150808211156129d757600080fd5b506129e48a828b01612805565b91505092959891949750929550565b600060208284031215612a0557600080fd5b610c48826127ae565b600081518084526020808501945080840160005b83811015612a3e57815187529582019590820190600101612a22565b509495945050505050565b602081526000610c486020830184612a0e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8183526000602080850194508260005b85811015612a3e578135612aab816125ee565b6001600160a01b031687529582019590820190600101612a98565b604081526000612ada604083018587612a88565b8281036020840152612aec8185612a0e565b9695505050505050565b600060208284031215612b0857600080fd5b5051919050565b60405160c081016001600160401b0381118282101715612b3157612b31612a5c565b60405290565b604080519081016001600160401b0381118282101715612b3157612b31612a5c565b604051601f8201601f191681016001600160401b0381118282101715612b8157612b81612a5c565b604052919050565b8051611a44816125ee565b600060a08284031215612ba657600080fd5b60405160a081018181106001600160401b0382111715612bc857612bc8612a5c565b6040528251612bd6816125ee565b81526020830151612be6816125ee565b60208201526040830151612bf9816125ee565b6040820152606083810151908201526080928301519281019290925250919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561065357610653612c1b565b634e487b7160e01b600052602160045260246000fd5b60098110611e2457611e24612c44565b60408101612c7784612c5a565b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b8183823760009101908152919050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b602081526000612135602083018486612a88565b60006001600160401b03821115612d3457612d34612a5c565b5060051b60200190565b80518015158114611a4457600080fd5b60006020808385031215612d6157600080fd5b82516001600160401b03811115612d7757600080fd5b8301601f81018513612d8857600080fd5b8051612d9b612d9682612d1b565b612b59565b81815260059190911b82018301908381019087831115612dba57600080fd5b928401925b82841015612ddf57612dd084612d3e565b82529284019290840190612dbf565b979650505050505050565b606081526000612dfe606083018688612a88565b6020830194909452506040015292915050565b6001600160e01b03198316815260408101612e2b83612c5a565b8260208301529392505050565b60006001600160401b03821115612e5157612e51612a5c565b50601f01601f191660200190565b60005b83811015612e7a578181015183820152602001612e62565b50506000910152565b600082601f830112612e9457600080fd5b8151612ea2612d9682612e38565b818152846020838601011115612eb757600080fd5b612135826020830160208701612e5f565b600060208284031215612eda57600080fd5b81516001600160401b0380821115612ef157600080fd5b9083019060c08286031215612f0557600080fd5b612f0d612b0f565b8251612f18816125ee565b81526020830151612f28816125ee565b60208201526040830151612f3b816125ee565b6040820152612f4c60608401612b89565b6060820152612f5d60808401612b89565b608082015260a083015182811115612f7457600080fd5b612f8087828601612e83565b60a08301525095945050505050565b600082601f830112612fa057600080fd5b8135612fae612d9682612e38565b818152846020838601011115612fc357600080fd5b816020850160208301376000918101602001919091529392505050565b6000612fea612b37565b806040840136811115612ffc57600080fd5b845b818110156130ad5780356001600160401b038082111561301e5760008081fd5b9087019036601f8301126130325760008081fd5b81356020613042612d9683612d1b565b82815260059290921b840181019181810190368411156130625760008081fd5b8286015b8481101561309a5780358681111561307e5760008081fd5b61308c3686838b0101612f8f565b845250918301918301613066565b5089525090960195505050602001612ffe565b5090949350505050565b60006130c1612b37565b8060408401368111156130d357600080fd5b845b818110156130ad5780356001600160401b038111156130f45760008081fd5b61310036828901612f8f565b855250602093840193016130d5565b60006020828403121561312157600080fd5b610c4882612d3e565b60008060006060848603121561313f57600080fd5b61314884612d3e565b925060208401519150604084015190509250925092565b808202811582820484141761065357610653612c1b565b6010811061318657613186612c44565b9052565b602081016106538284613176565b6001600160e01b031984168152606081016131b66020830185613176565b6001600160a01b03929092166040919091015292915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038616815260606020820181905260009061321d90830186886131cf565b82810360408401526132308185876131cf565b98975050505050505050565b8082018082111561065357610653612c1b565b60008151808452613267816020860160208601612e5f565b601f01601f19169290920160200192915050565b600082604081018360005b60028110156132b557838303875261329f83835161324f565b6020978801979093509190910190600101613286565b509095945050505050565b60c0815260006132d360c083018861324f565b60208781850152604084018760005b60028110156132ff578151835291830191908301906001016132e2565b505050838203608085015281604081018760005b6002811015613380578583038452815180518085529086019086850190600581901b8601880160005b8281101561336a57601f1988830301845261335882865161324f565b948a0194938a0193915060010161333c565b5096880196955050509185019150600101613313565b505085810360a0870152613394818861327b565b9b9a505050505050505050505056fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d9a164736f6c6343000811000a", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c806399103f7b1161011a578063d1cf4343116100ad578063df4b6ee01161007c578063df4b6ee01461046e578063e9bb166614610492578063f1001e7814610499578063f562b3c4146104b9578063fd422cd0146104c257600080fd5b8063d1cf43431461040c578063d1f992f71461041f578063d3dd2bdf14610432578063de981f1b1461045b57600080fd5b8063c6391fa2116100e9578063c6391fa2146103c2578063ccbb72ed146103d3578063cf39d13c146103e6578063d1737e27146103f957600080fd5b806399103f7b1461037e578063a345ecb214610391578063c008ce39146103a4578063c2e524dc146103b757600080fd5b80633101cfcb116101925780637680850c116101615780637680850c1461032a5780637c2b55a01461033d578063853af1b714610358578063865e6fd31461036b57600080fd5b80633101cfcb146102d75780633d48fd7d146102ea578063487e00ea146102fb57806362ffe6cb1461031757600080fd5b80631a697341116101ce5780631a6973411461027b5780631e90b2a01461028e57806329b6eca9146102a157806329ddc3c0146102b457600080fd5b806307c2d2f614610200578063082e7420146102155780630e1512ac1461023b5780631079402a1461024e575b600080fd5b61021361020e3660046125ad565b6104d5565b005b610228610223366004612603565b6105e2565b6040519081526020015b60405180910390f35b610213610249366004612620565b610659565b606d54606e54606f546070545b604080519485526020850193909352918301526060820152608001610232565b610213610289366004612603565b610673565b61021361029c366004612693565b610914565b6102136102af366004612603565b610afc565b6102c76102c2366004612715565b610c20565b6040519015158152602001610232565b6102136102e5366004612603565b610c4f565b60a55460a65460a75460a85461025b565b601d54601e545b60408051928352602083019190915201610232565b610228610325366004612715565b610cfc565b610213610338366004612741565b610d25565b60675b6040516001600160a01b039091168152602001610232565b61021361036636600461278c565b61103b565b6102136103793660046127bd565b611051565b61021361038c366004612816565b61106c565b61021361039f36600461278c565b6111d7565b6102136103b23660046128d4565b6111e9565b603854603954610302565b60dd5460de5460df5460e05461025b565b6102136103e1366004612620565b611273565b6102136103f4366004612909565b611287565b610213610407366004612620565b61129f565b61021361041a366004612935565b6112b3565b61021361042d366004612603565b6115df565b610228610440366004612603565b6001600160a01b0316600090815260dc602052604090205490565b6103406104693660046129f3565b6119ce565b60015460025460035460408051938452602084019290925290820152606001610232565b6069610340565b6104ac6104a73660046125ad565b611a49565b6040516102329190612a49565b61022860a35481565b6102136104d0366004612603565b611b13565b60086104e081611e27565b6000826001600160401b038111156104fa576104fa612a5c565b604051908082528060200260200182016040528015610523578160200160208202803683370190505b50905060005b838110156105a057600085858381811061054557610545612a72565b905060200201602081019061055a9190612603565b6001600160a01b038116600090815260dc6020526040812055835190915083908390811061058a5761058a612a72565b6000602091820292909201015250600101610529565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c234808484836040516105d493929190612ac6565b60405180910390a150505050565b6000610653826105f260086119ce565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa15801561062f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103259190612af6565b92915050565b610661611e73565b61066d84848484611ecf565b50505050565b61067b611e73565b6000610687600a6119ce565b604051636db349d160e11b81526001600160a01b038481166004830152919091169063db6693a29060240160a060405180830381865afa1580156106cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f39190612b94565b9050600061077d610704600b6119ce565b6040808501519051632623bd4f60e21b81526001600160a01b03918216600482015291169063988ef53c90602401602060405180830381865afa15801561074f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107739190612af6565b8360800151611f61565b9050600061078b60086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f19190612af6565b6038549091506108018443612c31565b11158061083157506001600160a01b038516600090815260376020908152604080832084845290915290205460ff165b1561084f57604051632e308a0b60e11b815260040160405180910390fd5b6001600160a01b038516600081815260376020908152604080832085845290915290819020805460ff19166001179055516000805160206133a48339815191529061089e906004908590612c6a565b60405180910390a2603954604051630bde081360e21b81526001600160a01b03841691632f78204c916108db918991600091908290600401612c81565b600060405180830381600087803b1580156108f557600080fd5b505af1158015610909573d6000803e3d6000fd5b505050505050505050565b61091c611e73565b6000848460405161092e929190612ca9565b604051809103902090506000838360405161094a929190612ca9565b604080519182900390912060008481526004602052919091205490915060ff1680610983575060008181526004602052604090205460ff165b156109a15760405163f27b8ec960e01b815260040160405180910390fd5b6109ae8787878787611f78565b15610af35760006109bf60086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a259190612af6565b6000858152600460205260408082208054600160ff19918216811790925587845292829020805490931617909155519091506001600160a01b038a16906000805160206133a483398151915290610a80906003908590612c6a565b60405180910390a260025460018054604051630bde081360e21b81526001600160a01b03861693632f78204c93610abe938f93909190600401612c81565b600060405180830381600087803b158015610ad857600080fd5b505af1158015610aec573d6000803e3d6000fd5b5050505050505b50505050505050565b61011354600290610100900460ff16158015610b2057506101135460ff8083169116105b610b455760405162461bcd60e51b8152600401610b3c90612cb9565b60405180910390fd5b610113805461ffff191660ff831617610100179055600054610b72906008906001600160a01b0316612022565b606c54610b8a906005906001600160a01b0316612022565b610b95600483612022565b603554610bad90600a906001600160a01b0316612022565b600080546001600160a01b0319908116909155606c8054821690556035805482169055603680549091169055610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff165b9392505050565b61011354600390610100900460ff16158015610c7357506101135460ff8083169116105b610c8f5760405162461bcd60e51b8152600401610b3c90612cb9565b610113805461ffff191660ff831617610100179055610caf600f83612022565b610cbd6001546002546120c6565b610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610c14565b6001600160a01b038216600090815260a460209081526040808320848452909152812054610c48565b6008610d3081611e27565b60003390506000816001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d999190612af6565b90506000826001600160a01b0316634de2b73588886040518363ffffffff1660e01b8152600401610dcb929190612d07565b600060405180830381865afa158015610de8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e109190810190612d4e565b90506000610e1e60056119ce565b6001600160a01b031663ba303755898986436040518563ffffffff1660e01b8152600401610e4f9493929190612dea565b600060405180830381865afa158015610e6c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e949190810190612d4e565b90506000876001600160401b03811115610eb057610eb0612a5c565b604051908082528060200260200182016040528015610ed9578160200160208202803683370190505b50905060005b88811015610ff45760008a8a83818110610efb57610efb612a72565b9050602002016020810190610f109190612603565b90506000610f1e828b610cfc565b90506000868481518110610f3457610f34612a72565b602002602001015190506000868581518110610f5257610f52612a72565b6020026020010151905060008280610f675750815b610f7c57610f7760dd5485612106565b610f7f565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610fa9918390612120565b6001600160a01b038616600090815260dc602052604090208190558751889088908110610fd857610fd8612a72565b6020026020010181815250508560010195505050505050610edf565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c2348089898360405161102893929190612ac6565b60405180910390a1505050505050505050565b611043611e73565b61104d828261213d565b5050565b611059611e73565b6110628161217d565b61104d8282612022565b61011354610100900460ff161580801561108e575061011354600160ff909116105b806110a95750303b1580156110a957506101135460ff166001145b6110c55760405162461bcd60e51b8152600401610b3c90612cb9565b610113805460ff1916600117905580156110ea57610113805461ff0019166101001790555b6110f560088b612022565b61110060058a612022565b61110b600488612022565b611116600a89612022565b61112f86356020880135604089013560608a0135611ecf565b61113e8535602087013561213d565b6111528435602086013560408701356121b3565b61116b8335602085013560408601356060870135612208565b6111848235602084013560408501356060860135612294565b80156111cb57610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6111df611e73565b61104d82826120c6565b60086111f481611e27565b8260010361123357836001600160a01b03166000805160206133a4833981519152600584604051611226929190612c6a565b60405180910390a261066d565b8260020361066d57836001600160a01b03166000805160206133a4833981519152600684604051611265929190612c6a565b60405180910390a250505050565b61127b611e73565b61066d84848484612294565b61128f611e73565b61129a8383836121b3565b505050565b6112a7611e73565b61066d84848484612208565b6112bc33612331565b6000036112ec576000356001600160e01b0319166003604051620f948f60ea1b8152600401610b3c929190612e11565b60006112f8600f6119ce565b6040516303d1982560e61b81526001600160a01b038a8116600483015291925060009183169063f466094090602401600060405180830381865afa158015611344573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261136c9190810190612ec8565b60a0015190508080519060200120888860405161138a929190612ca9565b6040518091039020146113be5760405163053265f160e01b81526001600160e01b0319600035166004820152602401610b3c565b6040516bffffffffffffffffffffffff1960608b901b1660208201526034810187905260009060540160408051601f1981840301815291815281516020928301206000818152601f90935291205490915060ff16156114305760405163f27b8ec960e01b815260040160405180910390fd5b6114a689898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820182528c935091508a90600290839083908082843760009201919091525061149891508a9050612fe0565b6114a1896130b7565b6123a9565b156111cb576000818152601f60205260408120805460ff191660011790556114ce60086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611510573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115349190612af6565b90508b6001600160a01b03166000805160206133a4833981519152600883604051611560929190612c6a565b60405180910390a2816001600160a01b0316632f78204c8d601e54601d5460016040518563ffffffff1660e01b815260040161159f9493929190612c81565b600060405180830381600087803b1580156115b957600080fd5b505af11580156115cd573d6000803e3d6000fd5b50505050505050505050505050505050565b60006115eb60086119ce565b604051635061f96960e11b81526001600160a01b0384811660048301529192509082169063a0c3f2d290602401602060405180830381865afa158015611635573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611659919061310f565b611686576000356001600160e01b0319166008604051620f948f60ea1b8152600401610b3c929190612e11565b6040516304d971ab60e01b81526001600160a01b0383811660048301523360248301528216906304d971ab90604401602060405180830381865afa1580156116d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f6919061310f565b611723576000356001600160e01b0319166004604051620f948f60ea1b8152600401610b3c929190612e11565b604051634b2c2fe160e11b81526001600160a01b03838116600483015260009182918416906396585fc290602401606060405180830381865afa15801561176e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611792919061312a565b9250509150816117b557604051636cd31b5960e01b815260040160405180910390fd5b6000836001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118199190612af6565b6001600160a01b038616600090815260db6020908152604080832084845290915290205490915060ff161561186157604051637674d6a960e01b815260040160405180910390fd5b6001600160a01b038516600090815260dc602052604081205460df5490919061188a908561315f565b9050808210156118ad5760405163462e593760e11b815260040160405180910390fd5b604051630adaf5ef60e11b81526001600160a01b038881166004830152602482018590528716906315b5ebde90604401600060405180830381600087803b1580156118f757600080fd5b505af115801561190b573d6000803e3d6000fd5b505050506001600160a01b038716600090815260dc602052604081208054839290611937908490612c31565b90915550506001600160a01b038716600090815260a4602090815260408083208684529091528120556001600160a01b038716600081815260db60209081526040808320878452825291829020805460ff1916600117905581518681529081018490527f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a250505050505050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f811115611a0557611a05612c44565b60ff1681526020810191909152604001600020546001600160a01b0316905080611a44578160405163409140df60e11b8152600401610b3c919061318a565b919050565b6060816001600160401b03811115611a6357611a63612a5c565b604051908082528060200260200182016040528015611a8c578160200160208202803683370190505b50905060005b8151811015611b0c5760dc6000858584818110611ab157611ab1612a72565b9050602002016020810190611ac69190612603565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110611af957611af9612a72565b6020908102919091010152600101611a92565b5092915050565b60a3544311611b355760405163557fd09160e01b815260040160405180910390fd5b4360a355334114611b69576000356001600160e01b0319166002604051620f948f60ea1b8152600401610b3c929190612e11565b611b7281612404565b15611e24576000611b8360086119ce565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be99190612af6565b6001600160a01b038416600090815260a460209081526040808320848452909152812080546001019081905560a85492935091611c2790439061251a565b905060a6548203611cd057846001600160a01b03166000805160206133a4833981519152600285604051611c5c929190612c6a565b60405180910390a260a754604051630bde081360e21b81526001600160a01b03861691632f78204c91611c99918991869190600090600401612c81565b600060405180830381600087803b158015611cb357600080fd5b505af1158015611cc7573d6000803e3d6000fd5b50505050611e1f565b60a5548203611e1f576000611ce58685610c20565b905080611d8857856001600160a01b03166000805160206133a4833981519152600186604051611d16929190612c6a565b60405180910390a2604051630bde081360e21b81526001600160a01b03861690632f78204c90611d5190899060009081908190600401612c81565b600060405180830381600087803b158015611d6b57600080fd5b505af1158015611d7f573d6000803e3d6000fd5b50505050611e1d565b856001600160a01b03166000805160206133a4833981519152600786604051611db2929190612c6a565b60405180910390a260a754604051630bde081360e21b81526001600160a01b03871691632f78204c91611def918a91879190600190600401612c81565b600060405180830381600087803b158015611e0957600080fd5b505af11580156111cb573d6000803e3d6000fd5b505b505050505b50565b611e30816119ce565b6001600160a01b0316336001600160a01b031614611e24576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610b3c93929190613198565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611ecd576000356001600160e01b0319166001604051620f948f60ea1b8152600401610b3c929190612e11565b565b82841180611ede575061271084115b80611eea575061271083115b15611f0857604051631cbe1abf60e11b815260040160405180910390fd5b606d849055606e839055606f82905560708190556040805185815260208101859052908101839052606081018290527fd24c671da2227c139fe1a5b34de15e5a67bef9b46e912916b9e0d025d51b3e3b906080016105d4565b600081831015611f715781610c48565b5090919050565b6040516000906067906001908390611f9c908a908a908a908a908a906024016131f8565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b1790528051909150611fd3612544565b602083016020828483895afa611fe857600094505b503d611ff357600093505b8361201157604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f81111561205857612058612c44565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f81111561209957612099612c44565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b601d829055601e81905560408051838152602081018390527f381ec200df2ed0875638486318f9f8a84e3550bdc686bf1400c9371a18d087f09101610c14565b6000818311612116576000610c48565b610c488284612c31565b600061213561212f848661323c565b83612535565b949350505050565b6038829055603981905560408051838152602081018390527fbda9ec2980d7468ba6a9f363696315affca9f9770016396bdea2ac39c3e5d61a9101610c14565b806001600160a01b03163b600003611e2457604051630bfc64a360e21b81526001600160a01b0382166004820152602401610b3c565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b9060600160405180910390a1505050565b60a65460a554111561223b576040516387f6f09560e01b81526001600160e01b0319600035166004820152602401610b3c565b60a584905560a683905560a782905560a88190556040805185815260208101859052908101839052606081018290527f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa98906080016105d4565b828411156122b55760405163112af4d160e01b815260040160405180910390fd5b6127108111156122d85760405163382c88a360e21b815260040160405180910390fd5b60dd84905560de83905560df82905560e08190556040805185815260208101859052908101839052606081018290527fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b906080016105d4565b600061233d600a6119ce565b604051631af0725f60e31b81526001600160a01b038481166004830152919091169063d78392f890602401602060405180830381865afa158015612385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106539190612af6565b60405160009060699060019083906123cd908a908a908a908a908a906024016132c0565b60408051601f198184030181529190526020810180516001600160e01b0316637b47d06b60e01b1790528051909150611fd3612544565b6000336001600160a01b03831614801590612490575061242460086119ce565b604051633292276760e11b81526001600160a01b03848116600483015291909116906365244ece90602401602060405180830381865afa15801561246c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612490919061310f565b801561065357506124a160056119ce565b604051630fbeb37f60e01b81526001600160a01b0384811660048301524360248301529190911690630fbeb37f90604401602060405180830381865afa1580156124ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612513919061310f565b1592915050565b60008160000361252b576000610c48565b610c48828461323c565b6000818310611f715781610c48565b60405180602001604052806001906020820280368337509192915050565b60008083601f84011261257457600080fd5b5081356001600160401b0381111561258b57600080fd5b6020830191508360208260051b85010111156125a657600080fd5b9250929050565b600080602083850312156125c057600080fd5b82356001600160401b038111156125d657600080fd5b6125e285828601612562565b90969095509350505050565b6001600160a01b0381168114611e2457600080fd5b60006020828403121561261557600080fd5b8135610c48816125ee565b6000806000806080858703121561263657600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f84011261266457600080fd5b5081356001600160401b0381111561267b57600080fd5b6020830191508360208285010111156125a657600080fd5b6000806000806000606086880312156126ab57600080fd5b85356126b6816125ee565b945060208601356001600160401b03808211156126d257600080fd5b6126de89838a01612652565b909650945060408801359150808211156126f757600080fd5b5061270488828901612652565b969995985093965092949392505050565b6000806040838503121561272857600080fd5b8235612733816125ee565b946020939093013593505050565b60008060006040848603121561275657600080fd5b83356001600160401b0381111561276c57600080fd5b61277886828701612562565b909790965060209590950135949350505050565b6000806040838503121561279f57600080fd5b50508035926020909101359150565b803560108110611a4457600080fd5b600080604083850312156127d057600080fd5b6127d9836127ae565b915060208301356127e9816125ee565b809150509250929050565b806080810183101561065357600080fd5b806040810183101561065357600080fd5b60008060008060008060008060006102a08a8c03121561283557600080fd5b8935612840816125ee565b985060208a0135612850816125ee565b975060408a0135612860816125ee565b965060608a0135612870816125ee565b955061287f8b60808c016127f4565b945061288f8b6101008c01612805565b93506101a08a018b8111156128a357600080fd5b6101408b0193506128b48c826127f4565b9250506128c58b6102208c016127f4565b90509295985092959850929598565b6000806000606084860312156128e957600080fd5b83356128f4816125ee565b95602085013595506040909401359392505050565b60008060006060848603121561291e57600080fd5b505081359360208301359350604090920135919050565b600080600080600080600060e0888a03121561295057600080fd5b873561295b816125ee565b965060208801356001600160401b038082111561297757600080fd5b6129838b838c01612652565b909850965060408a0135955086915061299f8b60608c01612805565b945060a08a01359150808211156129b557600080fd5b6129c18b838c01612805565b935060c08a01359150808211156129d757600080fd5b506129e48a828b01612805565b91505092959891949750929550565b600060208284031215612a0557600080fd5b610c48826127ae565b600081518084526020808501945080840160005b83811015612a3e57815187529582019590820190600101612a22565b509495945050505050565b602081526000610c486020830184612a0e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8183526000602080850194508260005b85811015612a3e578135612aab816125ee565b6001600160a01b031687529582019590820190600101612a98565b604081526000612ada604083018587612a88565b8281036020840152612aec8185612a0e565b9695505050505050565b600060208284031215612b0857600080fd5b5051919050565b60405160c081016001600160401b0381118282101715612b3157612b31612a5c565b60405290565b604080519081016001600160401b0381118282101715612b3157612b31612a5c565b604051601f8201601f191681016001600160401b0381118282101715612b8157612b81612a5c565b604052919050565b8051611a44816125ee565b600060a08284031215612ba657600080fd5b60405160a081018181106001600160401b0382111715612bc857612bc8612a5c565b6040528251612bd6816125ee565b81526020830151612be6816125ee565b60208201526040830151612bf9816125ee565b6040820152606083810151908201526080928301519281019290925250919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561065357610653612c1b565b634e487b7160e01b600052602160045260246000fd5b60098110611e2457611e24612c44565b60408101612c7784612c5a565b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b8183823760009101908152919050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b602081526000612135602083018486612a88565b60006001600160401b03821115612d3457612d34612a5c565b5060051b60200190565b80518015158114611a4457600080fd5b60006020808385031215612d6157600080fd5b82516001600160401b03811115612d7757600080fd5b8301601f81018513612d8857600080fd5b8051612d9b612d9682612d1b565b612b59565b81815260059190911b82018301908381019087831115612dba57600080fd5b928401925b82841015612ddf57612dd084612d3e565b82529284019290840190612dbf565b979650505050505050565b606081526000612dfe606083018688612a88565b6020830194909452506040015292915050565b6001600160e01b03198316815260408101612e2b83612c5a565b8260208301529392505050565b60006001600160401b03821115612e5157612e51612a5c565b50601f01601f191660200190565b60005b83811015612e7a578181015183820152602001612e62565b50506000910152565b600082601f830112612e9457600080fd5b8151612ea2612d9682612e38565b818152846020838601011115612eb757600080fd5b612135826020830160208701612e5f565b600060208284031215612eda57600080fd5b81516001600160401b0380821115612ef157600080fd5b9083019060c08286031215612f0557600080fd5b612f0d612b0f565b8251612f18816125ee565b81526020830151612f28816125ee565b60208201526040830151612f3b816125ee565b6040820152612f4c60608401612b89565b6060820152612f5d60808401612b89565b608082015260a083015182811115612f7457600080fd5b612f8087828601612e83565b60a08301525095945050505050565b600082601f830112612fa057600080fd5b8135612fae612d9682612e38565b818152846020838601011115612fc357600080fd5b816020850160208301376000918101602001919091529392505050565b6000612fea612b37565b806040840136811115612ffc57600080fd5b845b818110156130ad5780356001600160401b038082111561301e5760008081fd5b9087019036601f8301126130325760008081fd5b81356020613042612d9683612d1b565b82815260059290921b840181019181810190368411156130625760008081fd5b8286015b8481101561309a5780358681111561307e5760008081fd5b61308c3686838b0101612f8f565b845250918301918301613066565b5089525090960195505050602001612ffe565b5090949350505050565b60006130c1612b37565b8060408401368111156130d357600080fd5b845b818110156130ad5780356001600160401b038111156130f45760008081fd5b61310036828901612f8f565b855250602093840193016130d5565b60006020828403121561312157600080fd5b610c4882612d3e565b60008060006060848603121561313f57600080fd5b61314884612d3e565b925060208401519150604084015190509250925092565b808202811582820484141761065357610653612c1b565b6010811061318657613186612c44565b9052565b602081016106538284613176565b6001600160e01b031984168152606081016131b66020830185613176565b6001600160a01b03929092166040919091015292915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038616815260606020820181905260009061321d90830186886131cf565b82810360408401526132308185876131cf565b98975050505050505050565b8082018082111561065357610653612c1b565b60008151808452613267816020860160208601612e5f565b601f01601f19169290920160200192915050565b600082604081018360005b60028110156132b557838303875261329f83835161324f565b6020978801979093509190910190600101613286565b509095945050505050565b60c0815260006132d360c083018861324f565b60208781850152604084018760005b60028110156132ff578151835291830191908301906001016132e2565b505050838203608085015281604081018760005b6002811015613380578583038452815180518085529086019086850190600581901b8601880160005b8281101561336a57601f1988830301845261335882865161324f565b948a0194938a0193915060010161333c565b5096880196955050509185019150600101613313565b505085810360a0870152613394818861327b565b9b9a505050505050505050505056fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d9a164736f6c6343000811000a", + "numDeployments": 11, + "solcInputHash": "f5939ebe47e4086c92eac99ab2681ceb", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeJailedInTheCurrentPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrEvidenceAlreadySubmitted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientCreditScoreToBailOut\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidArguments\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCreditScoreConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCutOffPercentageConfig\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrInvalidThreshold\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrValidatorHasBailedOutPreviously\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"usedCreditScore\",\"type\":\"uint256\"}],\"name\":\"BailedOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gainCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout\",\"type\":\"uint256\"}],\"name\":\"CreditScoreConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"creditScores\",\"type\":\"uint256[]\"}],\"name\":\"CreditScoresUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"DoubleSignSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashFastFinalityAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fastFinalityJailUntilBlock\",\"type\":\"uint256\"}],\"name\":\"FastFinalitySlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum IBaseSlash.SlashType\",\"name\":\"slashType\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"Slashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"UnavailabilitySlashingConfigsUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"bailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"checkBailedOutAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"}],\"name\":\"currentUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validatorIds\",\"type\":\"address[]\"}],\"name\":\"execResetCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validatorIds\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"execUpdateCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"getCreditScore\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCreditScoreConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gainCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDoubleSignSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFastFinalitySlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"slashFastFinalityAmount_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fastFinalityJailUntilBlock_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"getManyCreditScores\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"resultList\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensus\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"getUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUnavailabilitySlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninGovernanceAdminContract\",\"type\":\"address\"},{\"internalType\":\"uint256[4]\",\"name\":\"\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[2]\",\"name\":\"\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[3]\",\"name\":\"_doubleSignSlashingConfigs\",\"type\":\"uint256[3]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_unavailabilitySlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_creditScoreConfigs\",\"type\":\"uint256[4]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"roninGovernanceAdminContract\",\"type\":\"address\"}],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"profileContract\",\"type\":\"address\"}],\"name\":\"initializeV3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastUnavailabilitySlashedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileValidateDoubleSignAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileValidateFastFinalityAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gainScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bailOutMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cutOffPercentage\",\"type\":\"uint256\"}],\"name\":\"setCreditScoreConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailUntilBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_offsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"setDoubleSignSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailUntilBlock\",\"type\":\"uint256\"}],\"name\":\"setFastFinalitySlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tier1Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_tier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmountForTier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationForTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"setUnavailabilitySlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"header1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"header2\",\"type\":\"bytes\"}],\"name\":\"slashDoubleSign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"voterPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[2]\",\"name\":\"targetBlockHash\",\"type\":\"bytes32[2]\"},{\"internalType\":\"bytes[][2]\",\"name\":\"listOfPublicKey\",\"type\":\"bytes[][2]\"},{\"internalType\":\"bytes[2]\",\"name\":\"aggregatedSignature\",\"type\":\"bytes[2]\"}],\"name\":\"slashFastFinality\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"slashUnavailability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeJailedInTheCurrentPeriod()\":[{\"details\":\"Error thrown when the caller must be jailed in the current period.\"}],\"ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock()\":[{\"details\":\"Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrEvidenceAlreadySubmitted()\":[{\"details\":\"Error thrown when evidence has already been submitted.\"}],\"ErrInsufficientCreditScoreToBailOut()\":[{\"details\":\"Error thrown when the caller's credit score is insufficient to bail out a situation.\"}],\"ErrInvalidArguments(bytes4)\":[{\"details\":\"Error indicating that arguments are invalid.\"}],\"ErrInvalidCreditScoreConfig()\":[{\"details\":\"Error thrown when an invalid credit score configuration is provided.\"}],\"ErrInvalidCutOffPercentageConfig()\":[{\"details\":\"Error thrown when an invalid cut-off percentage configuration is provided.\"}],\"ErrInvalidThreshold(bytes4)\":[{\"details\":\"Error indicating that the provided threshold is invalid for a specific function signature.\",\"params\":{\"msgSig\":\"The function signature (bytes4) that the invalid threshold applies to.\"}}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrValidatorHasBailedOutPreviously()\":[{\"details\":\"Error thrown when a validator has previously bailed out.\"}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}]},\"events\":{\"BailedOut(address,uint256,uint256)\":{\"details\":\"Emitted when a validator bailed out of jail.\"},\"ContractUpdated(uint8,address)\":{\"details\":\"Emitted when a contract is updated.\"},\"CreditScoreConfigsUpdated(uint256,uint256,uint256,uint256)\":{\"details\":\"Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\"},\"CreditScoresUpdated(address[],uint256[])\":{\"details\":\"Emitted the credit score of validators is updated.\"},\"DoubleSignSlashingConfigsUpdated(uint256,uint256,uint256)\":{\"details\":\"Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs` for param details.\"},\"FastFinalitySlashingConfigsUpdated(uint256,uint256)\":{\"details\":\"Emitted when the configs to slash fast finality is updated. See the method `getFastFinalitySlashingConfigs` for param details.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Slashed(address,uint8,uint256)\":{\"details\":\"Emitted when the validator is slashed.\"},\"UnavailabilitySlashingConfigsUpdated(uint256,uint256,uint256,uint256)\":{\"details\":\"Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs` for param details.\"}},\"kind\":\"dev\",\"methods\":{\"bailOut(address)\":{\"details\":\"A slashed validator use this method to get out of jail. Requirements: - The `_consensusAddr` must be a validator. - Only validator's admin can call this method. Emits the event `BailedOut`.\"},\"checkBailedOutAtPeriod(address,uint256)\":{\"details\":\"Returns the whether the `consensus` has been bailed out at the `period`.\"},\"currentUnavailabilityIndicator(address)\":{\"details\":\"Returns the current unavailability indicator of a block producer.\"},\"execResetCreditScores(address[])\":{\"details\":\"Resets the credit score for the revoked validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"execUpdateCreditScores(address[],uint256)\":{\"details\":\"Updates the credit score for the validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getCreditScore(address)\":{\"details\":\"Returns the current credit score of the validator.\"},\"getCreditScoreConfigs()\":{\"details\":\"Returns the configs related to credit score.\",\"returns\":{\"bailOutCostMultiplier_\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"cutOffPercentageAfterBailout_\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"gainCreditScore_\":\"The score to gain per period.\",\"maxCreditScore_\":\"The max number of credit score that a validator can hold.\"}},\"getDoubleSignSlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\"},\"returns\":{\"doubleSigningJailUntilBlock_\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"slashDoubleSignAmount_\":\"The amount of RON to slash double sign.\"}},\"getFastFinalitySlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"returns\":{\"fastFinalityJailUntilBlock_\":\"The block number that the punished validator will be jailed until, due to malicious fast finality.\",\"slashFastFinalityAmount_\":\"The amount of RON to slash fast finality.\"}},\"getManyCreditScores(address[])\":{\"details\":\"Returns the current credit score of a list of validators.\"},\"getUnavailabilityIndicator(address,uint256)\":{\"details\":\"Returns the unavailability indicator in the period `period` of a block producer.\"},\"getUnavailabilitySlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"returns\":{\"jailDurationForUnavailabilityTier2Threshold_\":\"The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\",\"slashAmountForUnavailabilityTier2Threshold_\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with tier-2 or tier-3.\",\"unavailabilityTier1Threshold_\":\"The mining reward will be deprecated, if (s)he missed more than this threshold. This threshold is applied for tier-1 and tier-3 slash.\",\"unavailabilityTier2Threshold_\":\" The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\"}},\"initialize(address,address,address,address,uint256[4],uint256[2],uint256[3],uint256[4],uint256[4])\":{\"details\":\"Initializes the contract storage.\"},\"lastUnavailabilitySlashedBlock()\":{\"details\":\"Returns the last block that a block producer is slashed for unavailability.\"},\"precompileValidateDoubleSignAddress()\":{\"details\":\"Gets the address of the precompile of validating double sign evidence\"},\"precompileValidateFastFinalityAddress()\":{\"details\":\"Gets the address of the precompile of validating double sign evidence\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setCreditScoreConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to credit score. Requirements: - The method caller is admin. Emits the event `CreditScoreConfigsUpdated`.\",\"params\":{\"_bailOutMultiplier\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"_cutOffPercentage\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"_gainScore\":\"The score to gain per period.\",\"_maxScore\":\"The max number of credit score that a validator can hold.\"}},\"setDoubleSignSlashingConfigs(uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `DoubleSignSlashingConfigsUpdated`.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\",\"_jailUntilBlock\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"_slashAmount\":\"The amount of RON to slash double sign.\"}},\"setFastFinalitySlashingConfigs(uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `FastFinalitySlashingConfigsUpdated`.\",\"params\":{\"jailUntilBlock\":\"The block number that the punished validator will be jailed until, due to fast finality.\",\"slashAmount\":\"The amount of RON to slash fast finality.\"}},\"setUnavailabilitySlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"jailDurationForTier2Threshold\":\"The number of blocks to jail a block producer when (s)he is slashed tier-2.\",\"slashAmountForTier2Threshold\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed tier-2.\",\"tier1Threshold\":\"The mining reward will be deprecated, if (s)he missed more than this threshold.\",\"tier2Threshold\":\"The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold.\"}},\"slashDoubleSign(address,bytes,bytes)\":{\"details\":\"Slashes for double signing. Requirements: - The method caller is coinbase. Emits the event `Slashed` if the double signing evidence of the two headers valid.\"},\"slashFastFinality(address,bytes,uint256,bytes32[2],bytes[][2],bytes[2])\":{\"details\":\"Slashes for fast finality. Requirements: - Only whitelisted addresses are allowed to call. Emits the event `Slashed` if the fast finality evidence of the two headers valid.\"},\"slashUnavailability(address)\":{\"details\":\"Slashes for unavailability by increasing the counter of block producer `consensusAddr`. Requirements: - The method caller is coinbase. Emits the event `Slashed` when the threshold is reached.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/slash-indicator/SlashIndicator.sol\":\"SlashIndicator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../udvts/Types.sol\\\";\\n\\ninterface IMaintenance {\\n /**\\n * @dev Error thrown when attempting to schedule an already scheduled event.\\n */\\n error ErrAlreadyScheduled();\\n\\n /**\\n * @dev Error thrown when referring to a non-existent schedule.\\n */\\n error ErrUnexistedSchedule();\\n\\n /**\\n * @dev Error thrown when the end block of a schedule is out of range.\\n */\\n error ErrEndBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when the start block of a schedule is out of range.\\n */\\n error ErrStartBlockOutOfRange();\\n\\n /**\\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\\n */\\n error ErrAlreadyOnMaintenance();\\n\\n /**\\n * @dev Error thrown when attempting an action before the cooldown period has ended.\\n */\\n error ErrCooldownTimeNotYetEnded();\\n\\n /**\\n * @dev Error thrown when the total number of schedules exceeds the limit.\\n */\\n error ErrTotalOfSchedulesExceeded();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration is specified.\\n */\\n error ErrInvalidMaintenanceDuration();\\n\\n /**\\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\\n */\\n error ErrInvalidMaintenanceDurationConfig();\\n\\n /**\\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\\n */\\n error ErrInvalidOffsetToStartScheduleConfigs();\\n\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(TConsensus indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(TConsensus indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(TConsensus consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator whose id `validatorId` maintained at the block number `_block`.\\n */\\n function checkMaintainedById(address validatorId, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n TConsensus consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `k` or not.\\n */\\n function checkManyMaintained(\\n TConsensus[] calldata consensusAddrList,\\n uint256 atBlock\\n ) external view returns (bool[] memory);\\n\\n function checkManyMaintainedById(\\n address[] calldata candidateIdList,\\n uint256 atBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n TConsensus[] calldata _consensusAddrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n function checkManyMaintainedInBlockRangeById(\\n address[] calldata idList,\\n uint256 fromBlock,\\n uint256 toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` has finished cooldown.\\n */\\n function checkCooldownEnded(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `consensusAddr` has schedule.\\n */\\n function checkScheduled(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `consensusAddr`.\\n */\\n function getSchedule(TConsensus consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedule() external view returns (uint256 count);\\n\\n /**\\n * @dev Returns the cooldown to maintain in seconds.\\n */\\n function cooldownSecsToMaintain() external view returns (uint256);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 minMaintenanceDurationInBlock_,\\n uint256 maxMaintenanceDurationInBlock_,\\n uint256 minOffsetToStartSchedule_,\\n uint256 maxOffsetToStartSchedule_,\\n uint256 maxSchedules_,\\n uint256 cooldownSecsToMaintain_\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `startedAtBlock` to `endedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `consensusAddr`.\\n * - The candidate `consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `consensusAddr`.\\n * - A schedule for the `consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(TConsensus consensusAddr) external;\\n}\\n\",\"keccak256\":\"0xa0e68b1e94b0d7ea96578ad759e1116a3299059cf7d376b8e2556687d1ef63f0\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../udvts/Types.sol\\\";\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n TConsensus consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address __reservedGovernor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n /// @dev Event emitted when the pubkey of the `id` is changed.\\n event PubkeyChanged(address indexed id, bytes pubkey);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n /// @dev Error when create a new profile whose id and consensus are not identical.\\n error ErrIdAndConsensusDiffer();\\n /**\\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\\n * and with value type of `infoType`.\\n */\\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\\n error ErrDuplicatedPubkey(bytes pubkey);\\n error ErrZeroAddress(RoleAccess infoType);\\n error ErrZeroPubkey();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\\n\\n /// @dev Getter to backward query from `consensus` address to `id` address.\\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\\n\\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\\n * applying for candidate role.\\n *\\n * Requirements:\\n * - Only `stakingContract` can call this method.\\n */\\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\\n\\n /**\\n * @notice The candidate admin changes the public key.\\n *\\n * @dev Requirements:\\n * - The profile must be existed.\\n * - Only user with candidate admin role can call this method.\\n * - New public key must not be duplicated.\\n */\\n\\n function changePubkey(address id, bytes memory pubkey) external;\\n}\\n\",\"keccak256\":\"0x14dfb3198bf21724f5315198e1b23564902821ef56730c7db49e3d1165a36d36\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(\\n uint256 _numerator,\\n uint256 _denominator\\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x6b7920b04a73a0e1ff7404aa1a3b5fc738fc0b6154839480f666fd69b55123f0\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\nimport \\\"../udvts/Types.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n /**\\n * @dev Error indicating that a query for a duplicate entry was made.\\n */\\n error ErrQueryForDupplicated();\\n\\n /**\\n * @dev Error indicating that a query was made for a non-existent consensus address.\\n */\\n error ErrQueryForNonExistentConsensusAddress();\\n\\n /**\\n * @dev Error indicating that a governor address has already been added.\\n * @param addr The address of the governor that is already added.\\n */\\n error ErrGovernorAddressIsAlreadyAdded(address addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is not added.\\n * @param addr The address of the consensus contract that is not added.\\n */\\n error ErrConsensusAddressIsNotAdded(TConsensus addr);\\n\\n /**\\n * @dev Error indicating that a consensus address is already added.\\n * @param addr The address of the consensus contract that is already added.\\n */\\n error ErrConsensusAddressIsAlreadyAdded(TConsensus addr);\\n\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n TConsensus consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address __deprecatedBridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(TConsensus[] orgs);\\n /// @dev Emitted when the consensus address of a trusted organization is changed.\\n event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n *\\n * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\\n */\\n function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeight() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeightById(address cid) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganization() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x0b2a44131128f965e20cbea424987817cb504502e5d83d6523ae45ffeb5e53fe\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3,\\n FAST_FINALITY\\n }\\n\\n /// @dev Error thrown when evidence has already been submitted.\\n error ErrEvidenceAlreadySubmitted();\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x2e09934977e0701a28b7f776f0bd4eefdfd8d6b68134822440b2c756b6b7d1e4\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICreditScore {\\n /**\\n * @dev Error thrown when an invalid credit score configuration is provided.\\n */\\n error ErrInvalidCreditScoreConfig();\\n\\n /**\\n * @dev Error thrown when an invalid cut-off percentage configuration is provided.\\n */\\n error ErrInvalidCutOffPercentageConfig();\\n\\n /**\\n * @dev Error thrown when the caller's credit score is insufficient to bail out a situation.\\n */\\n error ErrInsufficientCreditScoreToBailOut();\\n\\n /**\\n * @dev Error thrown when a validator has previously bailed out.\\n */\\n error ErrValidatorHasBailedOutPreviously();\\n\\n /**\\n * @dev Error thrown when the caller must be jailed in the current period.\\n */\\n error ErrCallerMustBeJailedInTheCurrentPeriod();\\n\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(TConsensus indexed consensus, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execUpdateCreditScores(address[] calldata validatorIds, uint256 period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata validatorIds) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(TConsensus consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(TConsensus consensus) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(\\n TConsensus[] calldata consensusAddrs\\n ) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `consensus` has been bailed out at the `period`.\\n */\\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x3cf62e68ac61811a4514be28eb75e37c12f977fb10d442e92be43605ae405a91\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(TConsensus _validatorAddr, bytes calldata _header1, bytes calldata _header2) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xb9bcab2333ef220db67a51edc072afa9dae94e261177cfddb601da0c0be04bdd\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashFastFinality.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ISlashFastFinality is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash fast finality is updated. See the method `getFastFinalitySlashingConfigs`\\n * for param details.\\n */\\n event FastFinalitySlashingConfigsUpdated(uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\\n\\n /**\\n * @dev Slashes for fast finality.\\n *\\n * Requirements:\\n * - Only whitelisted addresses are allowed to call.\\n *\\n * Emits the event `Slashed` if the fast finality evidence of the two headers valid.\\n */\\n function slashFastFinality(\\n TConsensus consensusAddr,\\n bytes calldata voterPublicKey,\\n uint256 targetBlockNumber,\\n bytes32[2] calldata targetBlockHash,\\n bytes[][2] calldata listOfPublicKey,\\n bytes[2] calldata aggregatedSignature\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return slashFastFinalityAmount The amount of RON to slash fast finality.\\n * @return fastFinalityJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * malicious fast finality.\\n */\\n function getFastFinalitySlashingConfigs()\\n external\\n view\\n returns (uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `FastFinalitySlashingConfigsUpdated`.\\n *\\n * @param slashAmount The amount of RON to slash fast finality.\\n * @param jailUntilBlock The block number that the punished validator will be jailed until, due to fast finality.\\n *\\n */\\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external;\\n}\\n\",\"keccak256\":\"0xaa45b7bdd92b68161124ac9db3ed0d3c87e2297f4b22eb42eee4abc2de5e6b14\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0x2908d4111459fda33a8bedb4c66cbcbe9ae5ab2aa9c0ae2ca05e9ba9a93d9e5e\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\\n */\\n error ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\\n\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(TConsensus consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(TConsensus consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `period` of a block producer.\\n */\\n function getUnavailabilityIndicator(TConsensus consensusAddr, uint256 period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 tier1Threshold,\\n uint256 tier2Threshold,\\n uint256 slashAmountForTier2Threshold,\\n uint256 jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x1a30a9edd2eb5593e1da65210dcd712173b9702d6814f4fb31f800efb5f2098b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n /**\\n * @dev The address of the candidate admin.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\\n */\\n address __shadowedAdmin;\\n /**\\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\\n */\\n TConsensus __shadowedConsensus;\\n /**\\n * @dev Address that receives mining reward of the validator\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\\n */\\n address payable __shadowedTreasury;\\n /// @dev Address of the bridge operator corresponding to the candidate\\n address ____deprecatedBridgeOperatorAddr;\\n /**\\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\\n * Values in range [0; 100_00] stands for 0-100%\\n */\\n uint256 commissionRate;\\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnward() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xd797160208b17456231633415848fffa0a5ba7e9ab7f81b241d1bd89c74c2c83\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManagerCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManagerCallback {\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address candidateAdmin,\\n address cid,\\n address payable treasuryAddr,\\n uint256 commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\\n * This updates the shadow storage slot of \\\"shadowedAdmin\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeAdminAddress(address cid, address newAdmin) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n * This updates the shadow storage slot of \\\"shadowedConsensus\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\\n * This updates the shadow storage slot of \\\"shadowedTreasury\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\\n}\\n\",\"keccak256\":\"0x0f241310c7f284374c26792fe73230a3b2cabc709d04f28a7b366292821f96dc\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the fast finality reward is distributed.\\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\\n event FastFinalityRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n /// @dev Error thrown when the info of releasing locked fund not exist.\\n error ErrLockedFundReleaseInfoNotFound(address cid);\\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\\n error ErrLockedFundMightBeRecycled(address cid);\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x98caa14d1e6dc6a9ab6d09c864a32790014890f9e2ad7951b77ff5658e0f7c8b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./ICandidateManagerCallback.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManagerCallback,\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0xf4f96a624e7c77bbce044c67e3f4b406e65871debc19e7bfab663c1fcfcbc7b0\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed cid,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed cid, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address cid, uint256 period) external;\\n}\\n\",\"keccak256\":\"0xbf540beae3c94d2b42e7bbb74f921086c23613fa4db43a5ca5310cb179b46d5e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xb63c6a5edcc82cc04af534e8398eee9a805bb9cb179f3e00750e6ff92354bed9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(TConsensus) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n TConsensus addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n TConsensus addr,\\n uint256 blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\\n\\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x27afa712094804b997f55e8f8d320760e07d7260ab33aeb8fb61c39849f09bf3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport { TConsensus } from \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducer() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x45ba68ae461f9c8ecde0fb3c7db78d6d9f44a4a6cc0f03e7b8edad0cced55643\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUValidateDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of validating double sign evidence\\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\\n return address(0x67);\\n }\\n\\n /**\\n * @dev Validates the two submitted block header if they are produced by the same address\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcValidateEvidence(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) internal view virtual returns (bool _validEvidence) {\\n address _smc = precompileValidateDoubleSignAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"validatingDoubleSignProof(address,bytes,bytes)\\\",\\n _consensusAddr,\\n _header1,\\n _header2\\n );\\n uint _payloadLength = _payload.length;\\n uint[1] memory _output;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n return (_output[0] != 0);\\n }\\n}\\n\",\"keccak256\":\"0x9df5b8272e1cd963d776b94e29a69ba1139f0df7404b67c213b3c5ebe19e527b\",\"license\":\"MIT\"},\"contracts/precompile-usages/PCUValidateFastFinality.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUValidateFastFinality is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of validating double sign evidence\\n function precompileValidateFastFinalityAddress() public view virtual returns (address) {\\n return address(0x69);\\n }\\n\\n /**\\n * @dev Validates the proof of malicious voting on fast finality\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcValidateFastFinalityEvidence(\\n bytes memory voterPublicKey,\\n uint256 targetBlockNumber,\\n bytes32[2] memory targetBlockHash,\\n bytes[][2] memory listOfPublicKey,\\n bytes[2] memory aggregatedSignature\\n ) internal view virtual returns (bool validEvidence) {\\n address smc = precompileValidateFastFinalityAddress();\\n bool success = true;\\n\\n bytes memory payload = abi.encodeWithSignature(\\n \\\"validateFinalityVoteProof(bytes,uint256,bytes32[2],bytes[][2],bytes[2])\\\",\\n voterPublicKey,\\n targetBlockNumber,\\n targetBlockHash,\\n listOfPublicKey,\\n aggregatedSignature\\n );\\n uint payloadLength = payload.length;\\n uint[1] memory output;\\n\\n assembly {\\n let payloadStart := add(payload, 0x20)\\n if iszero(staticcall(gas(), smc, payloadStart, payloadLength, output, 0x20)) {\\n success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n success := 0\\n }\\n }\\n\\n if (!success) revert ErrCallPrecompiled();\\n return (output[0] != 0);\\n }\\n}\\n\",\"keccak256\":\"0x99a8bb36a8b3fecd3865fdfdda61ecd5daf3e26dba78ff844a2349a8a07d1ace\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/CreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ICreditScore.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated, HasMaintenanceDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport { ErrUnauthorized, RoleAccess } from \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract CreditScore is\\n ICreditScore,\\n HasContracts,\\n HasValidatorDeprecated,\\n HasMaintenanceDeprecated,\\n PercentageConsumer\\n{\\n /// @dev Mapping from validator id => period index => whether bailed out before\\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\\n /// @dev Mapping from validator address => credit score\\n mapping(address => uint256) internal _creditScore;\\n\\n /// @dev The max gained number of credit score per period.\\n uint256 internal _gainCreditScore;\\n /// @dev The max number of credit score that a validator can hold.\\n uint256 internal _maxCreditScore;\\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n uint256 internal _bailOutCostMultiplier;\\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\\n uint256 internal _cutOffPercentageAfterBailout;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function execUpdateCreditScores(\\n address[] calldata validatorIds,\\n uint256 period\\n ) external override onlyContract(ContractType.VALIDATOR) {\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(msg.sender);\\n uint256 periodStartAtBlock = validatorContract.currentPeriodStartAtBlock();\\n\\n bool[] memory jaileds = validatorContract.checkManyJailedById(validatorIds);\\n bool[] memory maintaineds = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedInBlockRangeById(\\n validatorIds,\\n periodStartAtBlock,\\n block.number\\n );\\n uint256[] memory updatedCreditScores = new uint256[](validatorIds.length);\\n\\n for (uint i = 0; i < validatorIds.length; ) {\\n address vId = validatorIds[i];\\n\\n uint256 indicator = _getUnavailabilityIndicatorById(vId, period);\\n bool isJailedInPeriod = jaileds[i];\\n bool isMaintainingInPeriod = maintaineds[i];\\n\\n uint256 _actualGain = (isJailedInPeriod || isMaintainingInPeriod)\\n ? 0\\n : Math.subNonNegative(_gainCreditScore, indicator);\\n\\n _creditScore[vId] = Math.addWithUpperbound(_creditScore[vId], _actualGain, _maxCreditScore);\\n updatedCreditScores[i] = _creditScore[vId];\\n unchecked {\\n ++i;\\n }\\n }\\n\\n emit CreditScoresUpdated(validatorIds, updatedCreditScores);\\n }\\n\\n function execResetCreditScores(\\n address[] calldata validatorIds\\n ) external override onlyContract(ContractType.VALIDATOR) {\\n uint256[] memory updatedCreditScores = new uint256[](validatorIds.length);\\n for (uint i = 0; i < validatorIds.length; ) {\\n address _validator = validatorIds[i];\\n delete _creditScore[_validator];\\n delete updatedCreditScores[i];\\n\\n unchecked {\\n ++i;\\n }\\n }\\n emit CreditScoresUpdated(validatorIds, updatedCreditScores);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function bailOut(TConsensus consensusAddr) external override {\\n address validatorId = __css2cid(consensusAddr);\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n if (!validatorContract.isValidatorCandidate(consensusAddr))\\n revert ErrUnauthorized(msg.sig, RoleAccess.VALIDATOR_CANDIDATE);\\n\\n if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender))\\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\\n\\n (bool isJailed, , uint256 jailedEpochLeft) = validatorContract.getJailedTimeLeft(consensusAddr);\\n if (!isJailed) revert ErrCallerMustBeJailedInTheCurrentPeriod();\\n\\n uint256 period = validatorContract.currentPeriod();\\n if (_checkBailedOutAtPeriod[validatorId][period]) revert ErrValidatorHasBailedOutPreviously();\\n\\n uint256 score = _creditScore[validatorId];\\n uint256 cost = jailedEpochLeft * _bailOutCostMultiplier;\\n if (score < cost) revert ErrInsufficientCreditScoreToBailOut();\\n\\n validatorContract.execBailOut(validatorId, period);\\n\\n _creditScore[validatorId] -= cost;\\n _setUnavailabilityIndicator(validatorId, period, 0);\\n _checkBailedOutAtPeriod[validatorId][period] = true;\\n emit BailedOut(consensusAddr, period, cost);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external override onlyAdmin {\\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability`\\n */\\n function _getUnavailabilityIndicatorById(address validator, uint256 period) internal view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 gainCreditScore_,\\n uint256 maxCreditScore_,\\n uint256 bailOutCostMultiplier_,\\n uint256 cutOffPercentageAfterBailout_\\n )\\n {\\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScore(TConsensus consensusAddr) external view override returns (uint256) {\\n return _creditScore[__css2cid(consensusAddr)];\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getManyCreditScores(\\n TConsensus[] calldata consensusAddrs\\n ) public view override returns (uint256[] memory resultList) {\\n address[] memory validatorIds = __css2cidBatch(consensusAddrs);\\n resultList = new uint256[](validatorIds.length);\\n\\n for (uint i = 0; i < resultList.length; ) {\\n resultList[i] = _creditScore[validatorIds[i]];\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view override returns (bool) {\\n return _checkBailedOutAtPeriodById(__css2cid(consensus), period);\\n }\\n\\n function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool) {\\n return _checkBailedOutAtPeriod[validatorId][period];\\n }\\n\\n /**\\n * @dev See `SlashUnavailability`.\\n */\\n function _setUnavailabilityIndicator(address _validator, uint256 period, uint256 _indicator) internal virtual;\\n\\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\\n\\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\\n\\n /**\\n * @dev See `ICreditScore-setCreditScoreConfigs`.\\n */\\n function _setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) internal {\\n if (_gainScore > _maxScore) revert ErrInvalidCreditScoreConfig();\\n if (_cutOffPercentage > _MAX_PERCENTAGE) revert ErrInvalidCutOffPercentageConfig();\\n\\n _gainCreditScore = _gainScore;\\n _maxCreditScore = _maxScore;\\n _bailOutCostMultiplier = _bailOutMultiplier;\\n _cutOffPercentageAfterBailout = _cutOffPercentage;\\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n}\\n\",\"keccak256\":\"0xb000de911e146545cc37af81d0caa4073a71908cf96f20db086f5b042754069c\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/DeprecatedSlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasProxyAdmin.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\n\\nabstract contract DeprecatedSlashBridgeOperator is HasProxyAdmin, HasContracts, HasValidatorDeprecated {\\n /**\\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\\n * Values 0-10,000 map to 0%-100%.\\n */\\n uint256 private ____deprecatedMissingVotesRatioTier1;\\n /**\\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\\n * more than the ratio. Values 0-10,000 map to 0%-100%.\\n */\\n uint256 private ____deprecatedMissingVotesRatioTier2;\\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\\n uint256 private ____deprecatedJailDurationForMissingVotesRatioTier2;\\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\\n uint256 private ____deprecatedSkipBridgeOperatorSlashingThreshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n}\\n\",\"keccak256\":\"0x264f02546345e88bb0306e9a96c0275d3187987e0355cde5c61b1759cc4ec92d\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/DeprecatedSlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { HasValidatorDeprecated, HasTrustedOrgDeprecated, HasGovernanceAdminDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\n\\n// TODO: remove this from slashing logic of consensus contract\\nabstract contract DeprecatedSlashBridgeVoting is\\n HasContracts,\\n HasValidatorDeprecated,\\n HasTrustedOrgDeprecated,\\n HasGovernanceAdminDeprecated\\n{\\n /// @dev Mapping from validator address => period index => bridge voting slashed\\n mapping(address => mapping(uint256 => bool)) private __deprecatedBridgeVotingSlashed;\\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\\n uint256 private __deprecatedBridgeVotingThreshold;\\n /// @dev The amount of RON to slash bridge voting.\\n uint256 private __deprecatedBridgeVotingSlashAmount;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n}\\n\",\"keccak256\":\"0x7ce98fae2a6b9505f4339d1dc81bdc1c4bb809ea7fbac503155a81f834f4bbe4\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ISlashDoubleSign.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../precompile-usages/PCUValidateDoubleSign.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\n\\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasContracts, HasValidatorDeprecated, PCUValidateDoubleSign {\\n /// @dev The amount of RON to slash double sign.\\n uint256 internal _slashDoubleSignAmount;\\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\\n uint256 internal _doubleSigningJailUntilBlock;\\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\\n * This parameter is exposed for system transaction.\\n **/\\n uint256 internal _doubleSigningOffsetLimitBlock;\\n /// @dev Recording of submitted proof to prevent relay attack.\\n mapping(bytes32 => bool) _submittedEvidence;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[24] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function slashDoubleSign(\\n TConsensus consensusAddr,\\n bytes calldata header1,\\n bytes calldata header2\\n ) external override onlyAdmin {\\n bytes32 header1Checksum = keccak256(header1);\\n bytes32 header2Checksum = keccak256(header2);\\n\\n if (_submittedEvidence[header1Checksum] || _submittedEvidence[header2Checksum]) {\\n revert ErrEvidenceAlreadySubmitted();\\n }\\n\\n address validatorId = __css2cid(consensusAddr);\\n\\n // NOTE: Edge case: non-validator who never apply for the candidate role, nor have a profile.\\n // Must be slashed by the consensus address, since the validatorId will be address(0).\\n if (validatorId == address(0)) {\\n validatorId = TConsensus.unwrap(consensusAddr);\\n }\\n\\n if (_pcValidateEvidence(validatorId, header1, header2)) {\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 period = validatorContract.currentPeriod();\\n _submittedEvidence[header1Checksum] = true;\\n _submittedEvidence[header2Checksum] = true;\\n emit Slashed(validatorId, SlashType.DOUBLE_SIGNING, period);\\n validatorContract.execSlash(validatorId, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 slashDoubleSignAmount_,\\n uint256 doubleSigningJailUntilBlock_,\\n uint256 doubleSigningOffsetLimitBlock_\\n )\\n {\\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) external override onlyAdmin {\\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\\n }\\n\\n /**\\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\\n */\\n function _setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) internal {\\n _slashDoubleSignAmount = _slashAmount;\\n _doubleSigningJailUntilBlock = _jailUntilBlock;\\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool);\\n\\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\\n}\\n\",\"keccak256\":\"0x22c3b6343d7d03d0957546fbea9f204fe370713d95049b9f1b8cab140ad13f20\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashFastFinality.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ISlashFastFinality.sol\\\";\\nimport { IRoninValidatorSet } from \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport { IProfile } from \\\"../../interfaces/IProfile.sol\\\";\\nimport { IRoninTrustedOrganization } from \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../../precompile-usages/PCUValidateFastFinality.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUValidateFastFinality {\\n /// @dev The amount of RON to slash fast finality.\\n uint256 internal _slashFastFinalityAmount;\\n /// @dev The block number that the punished validator will be jailed until, due to malicious fast finality.\\n uint256 internal _fastFinalityJailUntilBlock;\\n /// @dev Recording of submitted proof to prevent relay attack.\\n mapping(bytes32 => bool) internal _processedEvidence;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[21] private ______gap;\\n\\n modifier onlyGoverningValidator() {\\n if (_getGovernorWeight(msg.sender) == 0) revert ErrUnauthorized(msg.sig, RoleAccess.GOVERNOR);\\n _;\\n }\\n\\n /**\\n * @inheritdoc ISlashFastFinality\\n */\\n function slashFastFinality(\\n TConsensus consensusAddr,\\n bytes calldata voterPublicKey,\\n uint256 targetBlockNumber,\\n bytes32[2] calldata targetBlockHash,\\n bytes[][2] calldata listOfPublicKey,\\n bytes[2] calldata aggregatedSignature\\n ) external override onlyGoverningValidator {\\n address validatorId = __css2cid(consensusAddr);\\n IProfile profileContract = IProfile(getContract(ContractType.PROFILE));\\n bytes memory expectingPubKey = (profileContract.getId2Profile(validatorId)).pubkey;\\n if (keccak256(voterPublicKey) != keccak256(expectingPubKey)) revert ErrInvalidArguments(msg.sig);\\n\\n bytes32 evidenceHash = keccak256(abi.encodePacked(consensusAddr, targetBlockNumber));\\n if (_processedEvidence[evidenceHash]) revert ErrEvidenceAlreadySubmitted();\\n\\n if (\\n _pcValidateFastFinalityEvidence(\\n voterPublicKey,\\n targetBlockNumber,\\n targetBlockHash,\\n listOfPublicKey,\\n aggregatedSignature\\n )\\n ) {\\n _processedEvidence[evidenceHash] = true;\\n\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 period = validatorContract.currentPeriod();\\n emit Slashed(validatorId, SlashType.FAST_FINALITY, period);\\n validatorContract.execSlash({\\n cid: validatorId,\\n newJailedUntil: _fastFinalityJailUntilBlock,\\n slashAmount: _slashFastFinalityAmount,\\n cannotBailout: true\\n });\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashFastFinality\\n */\\n function getFastFinalitySlashingConfigs()\\n external\\n view\\n override\\n returns (uint256 slashFastFinalityAmount_, uint256 fastFinalityJailUntilBlock_)\\n {\\n return (_slashFastFinalityAmount, _fastFinalityJailUntilBlock);\\n }\\n\\n /**\\n * @inheritdoc ISlashFastFinality\\n */\\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external override onlyAdmin {\\n _setFastFinalitySlashingConfigs(slashAmount, jailUntilBlock);\\n }\\n\\n /**\\n * @dev See `ISlashFastFinality-setFastFinalitySlashingConfigs`.\\n */\\n function _setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) internal {\\n _slashFastFinalityAmount = slashAmount;\\n _fastFinalityJailUntilBlock = jailUntilBlock;\\n emit FastFinalitySlashingConfigsUpdated(slashAmount, jailUntilBlock);\\n }\\n\\n /**\\n * @dev Get governor, i.e. governing validator's weight, of the `addr`.\\n */\\n function _getGovernorWeight(address addr) internal view returns (uint256) {\\n return IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getGovernorWeight(addr);\\n }\\n\\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\\n}\\n\",\"keccak256\":\"0xdd117b7ce496aa530bbf3b0dca4ad085ccef2237cb23ea0f830555c6a8cf3121\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport \\\"./DeprecatedSlashBridgeOperator.sol\\\";\\nimport \\\"./DeprecatedSlashBridgeVoting.sol\\\";\\nimport \\\"./SlashDoubleSign.sol\\\";\\nimport \\\"./SlashFastFinality.sol\\\";\\nimport \\\"./SlashUnavailability.sol\\\";\\nimport \\\"./CreditScore.sol\\\";\\n\\ncontract SlashIndicator is\\n ISlashIndicator,\\n SlashDoubleSign,\\n SlashFastFinality,\\n DeprecatedSlashBridgeVoting,\\n DeprecatedSlashBridgeOperator,\\n SlashUnavailability,\\n CreditScore,\\n Initializable\\n{\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __roninGovernanceAdminContract,\\n uint256[4] calldata /* _bridgeOperatorSlashingConfigs */,\\n uint256[2] calldata /* _bridgeVotingSlashingConfigs */,\\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\\n uint256[3] calldata _doubleSignSlashingConfigs,\\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\\n uint256[4] calldata _unavailabilitySlashingConfigs,\\n // _creditScoreConfigs[0]: _gainCreditScore\\n // _creditScoreConfigs[1]: _maxCreditScore\\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\\n uint256[4] calldata _creditScoreConfigs\\n ) external initializer {\\n _setContract(ContractType.VALIDATOR, __validatorContract);\\n _setContract(ContractType.MAINTENANCE, __maintenanceContract);\\n _setContract(ContractType.GOVERNANCE_ADMIN, __roninGovernanceAdminContract);\\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract);\\n\\n _setDoubleSignSlashingConfigs(\\n _doubleSignSlashingConfigs[0],\\n _doubleSignSlashingConfigs[1],\\n _doubleSignSlashingConfigs[2]\\n );\\n _setUnavailabilitySlashingConfigs(\\n _unavailabilitySlashingConfigs[0],\\n _unavailabilitySlashingConfigs[1],\\n _unavailabilitySlashingConfigs[2],\\n _unavailabilitySlashingConfigs[3]\\n );\\n _setCreditScoreConfigs(\\n _creditScoreConfigs[0],\\n _creditScoreConfigs[1],\\n _creditScoreConfigs[2],\\n _creditScoreConfigs[3]\\n );\\n }\\n\\n function initializeV2(address roninGovernanceAdminContract) external reinitializer(2) {\\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\\n _setContract(ContractType.MAINTENANCE, ______deprecatedMaintenance);\\n _setContract(ContractType.GOVERNANCE_ADMIN, roninGovernanceAdminContract);\\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ______deprecatedTrustedOrg);\\n\\n delete ______deprecatedValidator;\\n delete ______deprecatedMaintenance;\\n delete ______deprecatedTrustedOrg;\\n delete ______deprecatedGovernanceAdmin;\\n }\\n\\n function initializeV3(address profileContract) external reinitializer(3) {\\n _setContract(ContractType.PROFILE, profileContract);\\n _setFastFinalitySlashingConfigs(_slashDoubleSignAmount, _doubleSigningJailUntilBlock);\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\\n */\\n function _setUnavailabilityIndicator(\\n address validator,\\n uint256 period,\\n uint256 indicator\\n ) internal override(CreditScore, SlashUnavailability) {\\n SlashUnavailability._setUnavailabilityIndicator(validator, period, indicator);\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to query indicator of the validator.\\n */\\n function _getUnavailabilityIndicatorById(\\n address validatorId,\\n uint256 period\\n ) internal view override(CreditScore, SlashUnavailability) returns (uint256) {\\n return SlashUnavailability._getUnavailabilityIndicatorById(validatorId, period);\\n }\\n\\n function _checkBailedOutAtPeriodById(\\n address cid,\\n uint256 period\\n ) internal view override(CreditScore, SlashUnavailability) returns (bool) {\\n return CreditScore._checkBailedOutAtPeriodById(cid, period);\\n }\\n\\n /**\\n * @dev Sanity check the address to be slashed\\n */\\n function _shouldSlash(\\n TConsensus consensus,\\n address validatorId\\n ) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\\n return\\n (msg.sender != TConsensus.unwrap(consensus)) &&\\n (msg.sender != validatorId) &&\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isBlockProducer(consensus) &&\\n !IMaintenance(getContract(ContractType.MAINTENANCE)).checkMaintainedById(validatorId, block.number);\\n }\\n\\n function __css2cid(\\n TConsensus consensusAddr\\n ) internal view override(CreditScore, SlashDoubleSign, SlashUnavailability, SlashFastFinality) returns (address) {\\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\\n }\\n\\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view override returns (address[] memory) {\\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\\n }\\n}\\n\",\"keccak256\":\"0x9c04173414424dde143a29cb727731c5428b5478ca583807de1c88ffbe42cbdb\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./CreditScore.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashUnavailability.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport { ErrInvalidThreshold } from \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract SlashUnavailability is ISlashUnavailability, HasContracts, HasValidatorDeprecated {\\n /// @dev The last block that a validator is slashed for unavailability.\\n uint256 internal _lastUnavailabilitySlashedBlock;\\n /// @dev Mapping from validator address => period index => unavailability indicator.\\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\\n\\n /**\\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\\n */\\n uint256 internal _unavailabilityTier1Threshold;\\n /**\\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n */\\n uint256 internal _unavailabilityTier2Threshold;\\n /**\\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\\n * tier-2 or tier-3.\\n **/\\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n modifier oncePerBlock() {\\n if (block.number <= _lastUnavailabilitySlashedBlock) {\\n revert ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\\n }\\n\\n _lastUnavailabilitySlashedBlock = block.number;\\n _;\\n }\\n\\n function lastUnavailabilitySlashedBlock() external view returns (uint256) {\\n return _lastUnavailabilitySlashedBlock;\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function slashUnavailability(TConsensus consensusAddr) external override oncePerBlock {\\n if (msg.sender != block.coinbase) revert ErrUnauthorized(msg.sig, RoleAccess.COINBASE);\\n\\n address validatorId = __css2cid(consensusAddr);\\n if (!_shouldSlash(consensusAddr, validatorId)) {\\n // Should return instead of throwing error since this is a part of system transaction.\\n return;\\n }\\n\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n uint256 period = _validatorContract.currentPeriod();\\n uint256 count;\\n unchecked {\\n count = ++_unavailabilityIndicator[validatorId][period];\\n }\\n uint256 newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\\n\\n if (count == _unavailabilityTier2Threshold) {\\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_2, period);\\n _validatorContract.execSlash(\\n validatorId,\\n newJailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n false\\n );\\n } else if (count == _unavailabilityTier1Threshold) {\\n bool tier1SecondTime = _checkBailedOutAtPeriodById(validatorId, period);\\n if (!tier1SecondTime) {\\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_1, period);\\n _validatorContract.execSlash(validatorId, 0, 0, false);\\n } else {\\n /// Handles tier-3\\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_3, period);\\n _validatorContract.execSlash(\\n validatorId,\\n newJailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n true\\n );\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external override onlyAdmin {\\n _setUnavailabilitySlashingConfigs(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 unavailabilityTier1Threshold_,\\n uint256 unavailabilityTier2Threshold_,\\n uint256 slashAmountForUnavailabilityTier2Threshold_,\\n uint256 jailDurationForUnavailabilityTier2Threshold_\\n )\\n {\\n return (\\n _unavailabilityTier1Threshold,\\n _unavailabilityTier2Threshold,\\n _slashAmountForUnavailabilityTier2Threshold,\\n _jailDurationForUnavailabilityTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function currentUnavailabilityIndicator(TConsensus consensus) external view override returns (uint256) {\\n return\\n _getUnavailabilityIndicatorById(\\n __css2cid(consensus),\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod()\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilityIndicator(\\n TConsensus consensus,\\n uint256 period\\n ) external view virtual override returns (uint256) {\\n return _getUnavailabilityIndicatorById(__css2cid(consensus), period);\\n }\\n\\n function _getUnavailabilityIndicatorById(\\n address validatorId,\\n uint256 period\\n ) internal view virtual returns (uint256) {\\n return _unavailabilityIndicator[validatorId][period];\\n }\\n\\n /**\\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\\n */\\n function _setUnavailabilityIndicator(address _validator, uint256 _period, uint256 _indicator) internal virtual {\\n _unavailabilityIndicator[_validator][_period] = _indicator;\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\\n */\\n function _setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) internal {\\n if (_unavailabilityTier1Threshold > _unavailabilityTier2Threshold) revert ErrInvalidThreshold(msg.sig);\\n\\n _unavailabilityTier1Threshold = _tier1Threshold;\\n _unavailabilityTier2Threshold = _tier2Threshold;\\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\\n emit UnavailabilitySlashingConfigsUpdated(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool);\\n\\n /**\\n * @dev See `ICreditScore-checkBailedOutAtPeriodById`\\n */\\n function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool);\\n\\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\\n}\\n\",\"keccak256\":\"0x9d982af0ef1472369d69bd5cda0a685de85228508ffb53e3a47387f6008ec53a\",\"license\":\"MIT\"},\"contracts/udvts/Types.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ntype TPoolId is address;\\ntype TConsensus is address;\\n\\nusing { TPoolIdEq as == } for TPoolId global;\\nusing { TConsensusEq as == } for TConsensus global;\\n\\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\\n}\\n\\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\\n}\\n\",\"keccak256\":\"0x3017524670c86eaf3930447e482b6f372ae091bb5f8eb89570924599fa626ed7\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x7e228d0dbe377086fb2f7438b1e79b4e30b4eeb0225036b90a33effc5af06197\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALITY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\"},\"contracts/utils/DeprecatedSlots.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Deprecated Contracts\\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\\n * They provide functionality related to various aspects of a smart contract but have been marked\\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\\n */\\ncontract HasSlashIndicatorDeprecated {\\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\\n address internal ______deprecatedSlashIndicator;\\n}\\n\\ncontract HasStakingVestingDeprecated {\\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\\n address internal ______deprecatedStakingVesting;\\n}\\n\\ncontract HasBridgeDeprecated {\\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\\n address internal ______deprecatedBridge;\\n}\\n\\ncontract HasValidatorDeprecated {\\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\\n address internal ______deprecatedValidator;\\n}\\n\\ncontract HasStakingDeprecated {\\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\\n address internal ______deprecatedStakingContract;\\n}\\n\\ncontract HasMaintenanceDeprecated {\\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\\n address internal ______deprecatedMaintenance;\\n}\\n\\ncontract HasTrustedOrgDeprecated {\\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\\n address internal ______deprecatedTrustedOrg;\\n}\\n\\ncontract HasGovernanceAdminDeprecated {\\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\\n address internal ______deprecatedGovernanceAdmin;\\n}\\n\\ncontract HasBridgeTrackingDeprecated {\\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\\n address internal ______deprecatedBridgeTracking;\\n}\\n\",\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE,\\n /* 9 */ CONSENSUS,\\n /* 10 */ TREASURY\\n}\\n\",\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e7565b61011354610100900460ff1615620000905760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b6101135460ff9081161015620000e557610113805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61310080620000f76000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c8063a345ecb2116100f9578063d3dd2bdf11610097578063e9bb166611610071578063e9bb1666146103c1578063f1001e78146103c8578063f562b3c4146103e8578063fd422cd0146103f057600080fd5b8063d3dd2bdf14610377578063de981f1b1461038a578063df4b6ee01461039d57600080fd5b8063cf39d13c116100d3578063cf39d13c1461032b578063d1737e271461033e578063d1cf434314610351578063d1f992f71461036457600080fd5b8063a345ecb2146102f4578063c6391fa214610307578063ccbb72ed1461031857600080fd5b80633101cfcb1161016657806362ffe6cb1161014057806362ffe6cb146102a05780637c2b55a0146102b3578063865e6fd3146102ce57806399103f7b146102e157600080fd5b80633101cfcb146102455780633d48fd7d14610258578063487e00ea1461028557600080fd5b806307c2d2f6146101ae578063082e7420146101c3578063185368db146101e95780631e90b2a0146101fc57806329b6eca91461020f57806329ddc3c014610222575b600080fd5b6101c16101bc36600461227a565b610403565b005b6101d66101d13660046122d0565b610510565b6040519081526020015b60405180910390f35b6101c16101f73660046122ed565b610594565b6101c161020a366004612379565b6108aa565b6101c161021d3660046122d0565b610ab1565b6102356102303660046123fb565b610bd5565b60405190151581526020016101e0565b6101c16102533660046122d0565b610bf0565b60a45460a55460a65460a7545b6040805194855260208501939093529183015260608201526080016101e0565b601d54601e54604080519283526020830191909152016101e0565b6101d66102ae3660046123fb565b610c9d565b60675b6040516001600160a01b0390911681526020016101e0565b6101c16102dc366004612436565b610cb1565b6101c16102ef36600461248f565b610cd0565b6101c161030236600461254d565b610e13565b60dd5460de5460df5460e054610265565b6101c161032636600461256f565b610e25565b6101c16103393660046125a1565b610e3f565b6101c161034c36600461256f565b610e57565b6101c161035f3660046125cd565b610e6b565b6101c16103723660046122d0565b6111a6565b6101d66103853660046122d0565b6115a8565b6102b661039836600461268b565b6115d7565b600154600254600354604080519384526020840192909252908201526060016101e0565b60696102b6565b6103db6103d636600461227a565b611652565b6040516101e091906126e1565b60a2546101d6565b6101c16103fe3660046122d0565b611751565b600861040e81611a77565b6000826001600160401b03811115610428576104286126f4565b604051908082528060200260200182016040528015610451578160200160208202803683370190505b50905060005b838110156104ce5760008585838181106104735761047361270a565b905060200201602081019061048891906122d0565b6001600160a01b038116600090815260dc602052604081205583519091508390839081106104b8576104b861270a565b6000602091820292909201015250600101610457565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c234808484836040516105029392919061275e565b60405180910390a150505050565b600061058e61051e83611ac3565b61052860086115d7565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610565573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610589919061278e565b611b3b565b92915050565b600861059f81611a77565b60003390506000816001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610608919061278e565b90506000826001600160a01b0316637e1dc16f88886040518363ffffffff1660e01b815260040161063a9291906127a7565b600060405180830381865afa158015610657573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261067f9190810190612868565b9050600061068d60056115d7565b6001600160a01b0316638b042a72898986436040518563ffffffff1660e01b81526004016106be9493929190612904565b600060405180830381865afa1580156106db573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107039190810190612868565b90506000876001600160401b0381111561071f5761071f6126f4565b604051908082528060200260200182016040528015610748578160200160208202803683370190505b50905060005b888110156108635760008a8a8381811061076a5761076a61270a565b905060200201602081019061077f91906122d0565b9050600061078d828b611b3b565b905060008684815181106107a3576107a361270a565b6020026020010151905060008685815181106107c1576107c161270a565b60200260200101519050600082806107d65750815b6107eb576107e660dd5485611b64565b6107ee565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610818918390611b7e565b6001600160a01b038616600090815260dc6020526040902081905587518890889081106108475761084761270a565b602002602001018181525050856001019550505050505061074e565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c234808989836040516108979392919061275e565b60405180910390a1505050505050505050565b6108b2611b9b565b600084846040516108c492919061292b565b60405180910390209050600083836040516108e092919061292b565b604080519182900390912060008481526004602052919091205490915060ff1680610919575060008181526004602052604090205460ff165b156109375760405163f27b8ec960e01b815260040160405180910390fd5b600061094288611ac3565b90506001600160a01b0381166109555750865b6109628188888888611bf7565b15610aa757600061097360086115d7565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d9919061278e565b6000868152600460205260408082208054600160ff19918216811790925588845292829020805490931617909155519091506001600160a01b038416906000805160206130ab83398151915290610a34906003908590612951565b60405180910390a260025460018054604051630bde081360e21b81526001600160a01b03861693632f78204c93610a7293899390919060040161296f565b600060405180830381600087803b158015610a8c57600080fd5b505af1158015610aa0573d6000803e3d6000fd5b5050505050505b5050505050505050565b61011354600290610100900460ff16158015610ad557506101135460ff8083169116105b610afa5760405162461bcd60e51b8152600401610af190612997565b60405180910390fd5b610113805461ffff191660ff831617610100179055600054610b27906008906001600160a01b0316611ca1565b60da54610b3f906005906001600160a01b0316611ca1565b610b4a600483611ca1565b603554610b6290600a906001600160a01b0316611ca1565b600080546001600160a01b031990811690915560da8054821690556035805482169055603680549091169055610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6000610be9610be384611ac3565b83611d45565b9392505050565b61011354600390610100900460ff16158015610c1457506101135460ff8083169116105b610c305760405162461bcd60e51b8152600401610af190612997565b610113805461ffff191660ff831617610100179055610c50600f83611ca1565b610c5e600154600254611d71565b610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610bc9565b6000610be9610cab84611ac3565b83611b3b565b610cb9611b9b565b610cc281611db1565b610ccc8282611ca1565b5050565b61011354610100900460ff1615808015610cf2575061011354600160ff909116105b80610d0d5750303b158015610d0d57506101135460ff166001145b610d295760405162461bcd60e51b8152600401610af190612997565b610113805460ff191660011790558015610d4e57610113805461ff0019166101001790555b610d5960088b611ca1565b610d6460058a611ca1565b610d6f600488611ca1565b610d7a600a89611ca1565b610d8e843560208601356040870135611de7565b610da78335602085013560408601356060870135611e3c565b610dc08235602084013560408501356060860135611ec8565b8015610e0757610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b610e1b611b9b565b610ccc8282611d71565b610e2d611b9b565b610e3984848484611ec8565b50505050565b610e47611b9b565b610e52838383611de7565b505050565b610e5f611b9b565b610e3984848484611e3c565b610e7433611f65565b600003610ea4576000356001600160e01b0319166003604051620f948f60ea1b8152600401610af19291906129e5565b6000610eaf88611ac3565b90506000610ebd600f6115d7565b6040516303d1982560e61b81526001600160a01b03848116600483015291925060009183169063f466094090602401600060405180830381865afa158015610f09573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f319190810190612aae565b60a00151905080805190602001208989604051610f4f92919061292b565b604051809103902014610f835760405163053265f160e01b81526001600160e01b0319600035166004820152602401610af1565b6040516bffffffffffffffffffffffff1960608c901b1660208201526034810188905260009060540160408051601f1981840301815291815281516020928301206000818152601f90935291205490915060ff1615610ff55760405163f27b8ec960e01b815260040160405180910390fd5b61106b8a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820182528d935091508b90600290839083908082843760009201919091525061105d91508b9050612bc6565b6110668a612c9d565b611fdd565b15611199576000818152601f60205260408120805460ff1916600117905561109360086115d7565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f9919061278e565b9050856001600160a01b03166000805160206130ab833981519152600883604051611125929190612951565b60405180910390a2601e54601d54604051630bde081360e21b81526001600160a01b03851692632f78204c92611164928b92919060019060040161296f565b600060405180830381600087803b15801561117e57600080fd5b505af1158015611192573d6000803e3d6000fd5b5050505050505b5050505050505050505050565b60006111b182611ac3565b905060006111bf60086115d7565b604051635061f96960e11b81526001600160a01b0385811660048301529192509082169063a0c3f2d290602401602060405180830381865afa158015611209573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122d9190612cf5565b61125a576000356001600160e01b0319166008604051620f948f60ea1b8152600401610af19291906129e5565b6040516304d971ab60e01b81526001600160a01b0384811660048301523360248301528216906304d971ab90604401602060405180830381865afa1580156112a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ca9190612cf5565b6112f7576000356001600160e01b0319166004604051620f948f60ea1b8152600401610af19291906129e5565b604051634b2c2fe160e11b81526001600160a01b03848116600483015260009182918416906396585fc290602401606060405180830381865afa158015611342573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113669190612d10565b92505091508161138957604051636cd31b5960e01b815260040160405180910390fd5b6000836001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed919061278e565b6001600160a01b038616600090815260db6020908152604080832084845290915290205490915060ff161561143557604051637674d6a960e01b815260040160405180910390fd5b6001600160a01b038516600090815260dc602052604081205460df5490919061145e9085612d5b565b9050808210156114815760405163462e593760e11b815260040160405180910390fd5b604051630adaf5ef60e11b81526001600160a01b038881166004830152602482018590528716906315b5ebde90604401600060405180830381600087803b1580156114cb57600080fd5b505af11580156114df573d6000803e3d6000fd5b505050506001600160a01b038716600090815260dc60205260408120805483929061150b908490612d72565b90915550506001600160a01b038716600090815260a3602090815260408083208684529091528120556001600160a01b03878116600090815260db60209081526040808320878452825291829020805460ff191660011790558151868152908101849052918a16917f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a25050505050505050565b600060dc60006115b784611ac3565b6001600160a01b0316815260208101919091526040016000205492915050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f81111561160e5761160e61293b565b60ff1681526020810191909152604001600020546001600160a01b031690508061164d578160405163409140df60e11b8152600401610af19190612d99565b919050565b6060600061169284848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061203892505050565b905080516001600160401b038111156116ad576116ad6126f4565b6040519080825280602002602001820160405280156116d6578160200160208202803683370190505b50915060005b82518110156117495760dc60008383815181106116fb576116fb61270a565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020548382815181106117365761173661270a565b60209081029190910101526001016116dc565b505092915050565b60a25443116117735760405163557fd09160e01b815260040160405180910390fd5b4360a2553341146117a7576000356001600160e01b0319166002604051620f948f60ea1b8152600401610af19291906129e5565b60006117b282611ac3565b90506117be82826120b4565b6117c6575050565b60006117d260086115d7565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061278e565b6001600160a01b038416600090815260a360209081526040808320848452909152812080546001019081905560a754929350916118769043906121e0565b905060a554820361191f57846001600160a01b03166000805160206130ab8339815191526002856040516118ab929190612951565b60405180910390a260a654604051630bde081360e21b81526001600160a01b03861691632f78204c916118e891899186919060009060040161296f565b600060405180830381600087803b15801561190257600080fd5b505af1158015611916573d6000803e3d6000fd5b50505050611a6e565b60a4548203611a6e5760006119348685611d45565b9050806119d757856001600160a01b03166000805160206130ab833981519152600186604051611965929190612951565b60405180910390a2604051630bde081360e21b81526001600160a01b03861690632f78204c906119a09089906000908190819060040161296f565b600060405180830381600087803b1580156119ba57600080fd5b505af11580156119ce573d6000803e3d6000fd5b50505050611a6c565b856001600160a01b03166000805160206130ab833981519152600786604051611a01929190612951565b60405180910390a260a654604051630bde081360e21b81526001600160a01b03871691632f78204c91611a3e918a9187919060019060040161296f565b600060405180830381600087803b158015611a5857600080fd5b505af1158015611199573d6000803e3d6000fd5b505b50505050505b50565b611a80816115d7565b6001600160a01b0316336001600160a01b031614611a74576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610af193929190612da7565b6000611acf600f6115d7565b6040516350a9fc2960e01b81526001600160a01b03848116600483015291909116906350a9fc2990602401602060405180830381865afa158015611b17573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058e9190612dde565b6001600160a01b038216600090815260a360209081526040808320848452909152812054610be9565b6000818311611b74576000610be9565b610be98284612d72565b6000611b93611b8d8486612dfb565b836121fb565b949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611bf5576000356001600160e01b0319166001604051620f948f60ea1b8152600401610af19291906129e5565b565b6040516000906067906001908390611c1b908a908a908a908a908a90602401612e37565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b1790528051909150611c52612211565b602083016020828483895afa611c6757600094505b503d611c7257600093505b83611c9057604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115611cd757611cd761293b565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115611d1857611d1861293b565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff16610be9565b601d829055601e81905560408051838152602081018390527f381ec200df2ed0875638486318f9f8a84e3550bdc686bf1400c9371a18d087f09101610bc9565b806001600160a01b03163b600003611a7457604051630bfc64a360e21b81526001600160a01b0382166004820152602401610af1565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b9060600160405180910390a1505050565b60a55460a4541115611e6f576040516387f6f09560e01b81526001600160e01b0319600035166004820152602401610af1565b60a484905560a583905560a682905560a78190556040805185815260208101859052908101839052606081018290527f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa9890608001610502565b82841115611ee95760405163112af4d160e01b815260040160405180910390fd5b612710811115611f0c5760405163382c88a360e21b815260040160405180910390fd5b60dd84905560de83905560df82905560e08190556040805185815260208101859052908101839052606081018290527fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b90608001610502565b6000611f71600a6115d7565b604051631af0725f60e31b81526001600160a01b038481166004830152919091169063d78392f890602401602060405180830381865afa158015611fb9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058e919061278e565b6040516000906069906001908390612001908a908a908a908a908a90602401612eec565b60408051601f198184030181529190526020810180516001600160e01b0316637b47d06b60e01b1790528051909150611c52612211565b6060612044600f6115d7565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b815260040161206f9190612fcf565b600060405180830381865afa15801561208c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261058e919081019061301c565b6000336001600160a01b038416148015906120d85750336001600160a01b03831614155b801561215557506120e960086115d7565b604051633292276760e11b81526001600160a01b03858116600483015291909116906365244ece90602401602060405180830381865afa158015612131573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121559190612cf5565b8015610be9575061216660056115d7565b604051638d5b675960e01b81526001600160a01b0384811660048301524360248301529190911690638d5b675990604401602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d89190612cf5565b159392505050565b6000816000036121f1576000610be9565b610be98284612dfb565b600081831061220a5781610be9565b5090919050565b60405180602001604052806001906020820280368337509192915050565b60008083601f84011261224157600080fd5b5081356001600160401b0381111561225857600080fd5b6020830191508360208260051b850101111561227357600080fd5b9250929050565b6000806020838503121561228d57600080fd5b82356001600160401b038111156122a357600080fd5b6122af8582860161222f565b90969095509350505050565b6001600160a01b0381168114611a7457600080fd5b6000602082840312156122e257600080fd5b8135610be9816122bb565b60008060006040848603121561230257600080fd5b83356001600160401b0381111561231857600080fd5b6123248682870161222f565b909790965060209590950135949350505050565b60008083601f84011261234a57600080fd5b5081356001600160401b0381111561236157600080fd5b60208301915083602082850101111561227357600080fd5b60008060008060006060868803121561239157600080fd5b853561239c816122bb565b945060208601356001600160401b03808211156123b857600080fd5b6123c489838a01612338565b909650945060408801359150808211156123dd57600080fd5b506123ea88828901612338565b969995985093965092949392505050565b6000806040838503121561240e57600080fd5b8235612419816122bb565b946020939093013593505050565b80356010811061164d57600080fd5b6000806040838503121561244957600080fd5b61245283612427565b91506020830135612462816122bb565b809150509250929050565b806080810183101561058e57600080fd5b806040810183101561058e57600080fd5b60008060008060008060008060006102a08a8c0312156124ae57600080fd5b89356124b9816122bb565b985060208a01356124c9816122bb565b975060408a01356124d9816122bb565b965060608a01356124e9816122bb565b95506124f88b60808c0161246d565b94506125088b6101008c0161247e565b93506101a08a018b81111561251c57600080fd5b6101408b01935061252d8c8261246d565b92505061253e8b6102208c0161246d565b90509295985092959850929598565b6000806040838503121561256057600080fd5b50508035926020909101359150565b6000806000806080858703121561258557600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000606084860312156125b657600080fd5b505081359360208301359350604090920135919050565b600080600080600080600060e0888a0312156125e857600080fd5b87356125f3816122bb565b965060208801356001600160401b038082111561260f57600080fd5b61261b8b838c01612338565b909850965060408a013595508691506126378b60608c0161247e565b945060a08a013591508082111561264d57600080fd5b6126598b838c0161247e565b935060c08a013591508082111561266f57600080fd5b5061267c8a828b0161247e565b91505092959891949750929550565b60006020828403121561269d57600080fd5b610be982612427565b600081518084526020808501945080840160005b838110156126d6578151875295820195908201906001016126ba565b509495945050505050565b602081526000610be960208301846126a6565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8183526000602080850194508260005b858110156126d6578135612743816122bb565b6001600160a01b031687529582019590820190600101612730565b604081526000612772604083018587612720565b828103602084015261278481856126a6565b9695505050505050565b6000602082840312156127a057600080fd5b5051919050565b602081526000611b93602083018486612720565b60405160c081016001600160401b03811182821017156127dd576127dd6126f4565b60405290565b604080519081016001600160401b03811182821017156127dd576127dd6126f4565b604051601f8201601f191681016001600160401b038111828210171561282d5761282d6126f4565b604052919050565b60006001600160401b0382111561284e5761284e6126f4565b5060051b60200190565b8051801515811461164d57600080fd5b6000602080838503121561287b57600080fd5b82516001600160401b0381111561289157600080fd5b8301601f810185136128a257600080fd5b80516128b56128b082612835565b612805565b81815260059190911b820183019083810190878311156128d457600080fd5b928401925b828410156128f9576128ea84612858565b825292840192908401906128d9565b979650505050505050565b606081526000612918606083018688612720565b6020830194909452506040015292915050565b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fd5b60408101600984106129655761296561293b565b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160e01b03198316815260408101600b8310612a0657612a0661293b565b8260208301529392505050565b805161164d816122bb565b60006001600160401b03821115612a3757612a376126f4565b50601f01601f191660200190565b60005b83811015612a60578181015183820152602001612a48565b50506000910152565b600082601f830112612a7a57600080fd5b8151612a886128b082612a1e565b818152846020838601011115612a9d57600080fd5b611b93826020830160208701612a45565b600060208284031215612ac057600080fd5b81516001600160401b0380821115612ad757600080fd5b9083019060c08286031215612aeb57600080fd5b612af36127bb565b8251612afe816122bb565b81526020830151612b0e816122bb565b60208201526040830151612b21816122bb565b6040820152612b3260608401612a13565b6060820152612b4360808401612a13565b608082015260a083015182811115612b5a57600080fd5b612b6687828601612a69565b60a08301525095945050505050565b600082601f830112612b8657600080fd5b8135612b946128b082612a1e565b818152846020838601011115612ba957600080fd5b816020850160208301376000918101602001919091529392505050565b6000612bd06127e3565b806040840136811115612be257600080fd5b845b81811015612c935780356001600160401b0380821115612c045760008081fd5b9087019036601f830112612c185760008081fd5b81356020612c286128b083612835565b82815260059290921b84018101918181019036841115612c485760008081fd5b8286015b84811015612c8057803586811115612c645760008081fd5b612c723686838b0101612b75565b845250918301918301612c4c565b5089525090960195505050602001612be4565b5090949350505050565b6000612ca76127e3565b806040840136811115612cb957600080fd5b845b81811015612c935780356001600160401b03811115612cda5760008081fd5b612ce636828901612b75565b85525060209384019301612cbb565b600060208284031215612d0757600080fd5b610be982612858565b600080600060608486031215612d2557600080fd5b612d2e84612858565b925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761058e5761058e612d45565b8181038181111561058e5761058e612d45565b60108110612d9557612d9561293b565b9052565b6020810161058e8284612d85565b6001600160e01b03198416815260608101612dc56020830185612d85565b6001600160a01b03929092166040919091015292915050565b600060208284031215612df057600080fd5b8151610be9816122bb565b8082018082111561058e5761058e612d45565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090612e5c9083018688612e0e565b8281036040840152612e6f818587612e0e565b98975050505050505050565b60008151808452612e93816020860160208601612a45565b601f01601f19169290920160200192915050565b600082604081018360005b6002811015612ee1578383038752612ecb838351612e7b565b6020978801979093509190910190600101612eb2565b509095945050505050565b60c081526000612eff60c0830188612e7b565b60208781850152604084018760005b6002811015612f2b57815183529183019190830190600101612f0e565b505050838203608085015281604081018760005b6002811015612fac578583038452815180518085529086019086850190600581901b8601880160005b82811015612f9657601f19888303018452612f84828651612e7b565b948a0194938a01939150600101612f68565b5096880196955050509185019150600101612f3f565b505085810360a0870152612fc08188612ea7565b9b9a5050505050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156130105783516001600160a01b031683529284019291840191600101612feb565b50909695505050505050565b6000602080838503121561302f57600080fd5b82516001600160401b0381111561304557600080fd5b8301601f8101851361305657600080fd5b80516130646128b082612835565b81815260059190911b8201830190838101908783111561308357600080fd5b928401925b828410156128f957835161309b816122bb565b8252928401929084019061308856fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d9a264697066735822122044c31e0275363a320e2635619d2e64fac4ce28df081f0c7c841ba7a971c59c1864736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063a345ecb2116100f9578063d3dd2bdf11610097578063e9bb166611610071578063e9bb1666146103c1578063f1001e78146103c8578063f562b3c4146103e8578063fd422cd0146103f057600080fd5b8063d3dd2bdf14610377578063de981f1b1461038a578063df4b6ee01461039d57600080fd5b8063cf39d13c116100d3578063cf39d13c1461032b578063d1737e271461033e578063d1cf434314610351578063d1f992f71461036457600080fd5b8063a345ecb2146102f4578063c6391fa214610307578063ccbb72ed1461031857600080fd5b80633101cfcb1161016657806362ffe6cb1161014057806362ffe6cb146102a05780637c2b55a0146102b3578063865e6fd3146102ce57806399103f7b146102e157600080fd5b80633101cfcb146102455780633d48fd7d14610258578063487e00ea1461028557600080fd5b806307c2d2f6146101ae578063082e7420146101c3578063185368db146101e95780631e90b2a0146101fc57806329b6eca91461020f57806329ddc3c014610222575b600080fd5b6101c16101bc36600461227a565b610403565b005b6101d66101d13660046122d0565b610510565b6040519081526020015b60405180910390f35b6101c16101f73660046122ed565b610594565b6101c161020a366004612379565b6108aa565b6101c161021d3660046122d0565b610ab1565b6102356102303660046123fb565b610bd5565b60405190151581526020016101e0565b6101c16102533660046122d0565b610bf0565b60a45460a55460a65460a7545b6040805194855260208501939093529183015260608201526080016101e0565b601d54601e54604080519283526020830191909152016101e0565b6101d66102ae3660046123fb565b610c9d565b60675b6040516001600160a01b0390911681526020016101e0565b6101c16102dc366004612436565b610cb1565b6101c16102ef36600461248f565b610cd0565b6101c161030236600461254d565b610e13565b60dd5460de5460df5460e054610265565b6101c161032636600461256f565b610e25565b6101c16103393660046125a1565b610e3f565b6101c161034c36600461256f565b610e57565b6101c161035f3660046125cd565b610e6b565b6101c16103723660046122d0565b6111a6565b6101d66103853660046122d0565b6115a8565b6102b661039836600461268b565b6115d7565b600154600254600354604080519384526020840192909252908201526060016101e0565b60696102b6565b6103db6103d636600461227a565b611652565b6040516101e091906126e1565b60a2546101d6565b6101c16103fe3660046122d0565b611751565b600861040e81611a77565b6000826001600160401b03811115610428576104286126f4565b604051908082528060200260200182016040528015610451578160200160208202803683370190505b50905060005b838110156104ce5760008585838181106104735761047361270a565b905060200201602081019061048891906122d0565b6001600160a01b038116600090815260dc602052604081205583519091508390839081106104b8576104b861270a565b6000602091820292909201015250600101610457565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c234808484836040516105029392919061275e565b60405180910390a150505050565b600061058e61051e83611ac3565b61052860086115d7565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610565573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610589919061278e565b611b3b565b92915050565b600861059f81611a77565b60003390506000816001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610608919061278e565b90506000826001600160a01b0316637e1dc16f88886040518363ffffffff1660e01b815260040161063a9291906127a7565b600060405180830381865afa158015610657573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261067f9190810190612868565b9050600061068d60056115d7565b6001600160a01b0316638b042a72898986436040518563ffffffff1660e01b81526004016106be9493929190612904565b600060405180830381865afa1580156106db573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107039190810190612868565b90506000876001600160401b0381111561071f5761071f6126f4565b604051908082528060200260200182016040528015610748578160200160208202803683370190505b50905060005b888110156108635760008a8a8381811061076a5761076a61270a565b905060200201602081019061077f91906122d0565b9050600061078d828b611b3b565b905060008684815181106107a3576107a361270a565b6020026020010151905060008685815181106107c1576107c161270a565b60200260200101519050600082806107d65750815b6107eb576107e660dd5485611b64565b6107ee565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610818918390611b7e565b6001600160a01b038616600090815260dc6020526040902081905587518890889081106108475761084761270a565b602002602001018181525050856001019550505050505061074e565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c234808989836040516108979392919061275e565b60405180910390a1505050505050505050565b6108b2611b9b565b600084846040516108c492919061292b565b60405180910390209050600083836040516108e092919061292b565b604080519182900390912060008481526004602052919091205490915060ff1680610919575060008181526004602052604090205460ff165b156109375760405163f27b8ec960e01b815260040160405180910390fd5b600061094288611ac3565b90506001600160a01b0381166109555750865b6109628188888888611bf7565b15610aa757600061097360086115d7565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d9919061278e565b6000868152600460205260408082208054600160ff19918216811790925588845292829020805490931617909155519091506001600160a01b038416906000805160206130ab83398151915290610a34906003908590612951565b60405180910390a260025460018054604051630bde081360e21b81526001600160a01b03861693632f78204c93610a7293899390919060040161296f565b600060405180830381600087803b158015610a8c57600080fd5b505af1158015610aa0573d6000803e3d6000fd5b5050505050505b5050505050505050565b61011354600290610100900460ff16158015610ad557506101135460ff8083169116105b610afa5760405162461bcd60e51b8152600401610af190612997565b60405180910390fd5b610113805461ffff191660ff831617610100179055600054610b27906008906001600160a01b0316611ca1565b60da54610b3f906005906001600160a01b0316611ca1565b610b4a600483611ca1565b603554610b6290600a906001600160a01b0316611ca1565b600080546001600160a01b031990811690915560da8054821690556035805482169055603680549091169055610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6000610be9610be384611ac3565b83611d45565b9392505050565b61011354600390610100900460ff16158015610c1457506101135460ff8083169116105b610c305760405162461bcd60e51b8152600401610af190612997565b610113805461ffff191660ff831617610100179055610c50600f83611ca1565b610c5e600154600254611d71565b610113805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610bc9565b6000610be9610cab84611ac3565b83611b3b565b610cb9611b9b565b610cc281611db1565b610ccc8282611ca1565b5050565b61011354610100900460ff1615808015610cf2575061011354600160ff909116105b80610d0d5750303b158015610d0d57506101135460ff166001145b610d295760405162461bcd60e51b8152600401610af190612997565b610113805460ff191660011790558015610d4e57610113805461ff0019166101001790555b610d5960088b611ca1565b610d6460058a611ca1565b610d6f600488611ca1565b610d7a600a89611ca1565b610d8e843560208601356040870135611de7565b610da78335602085013560408601356060870135611e3c565b610dc08235602084013560408501356060860135611ec8565b8015610e0757610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b610e1b611b9b565b610ccc8282611d71565b610e2d611b9b565b610e3984848484611ec8565b50505050565b610e47611b9b565b610e52838383611de7565b505050565b610e5f611b9b565b610e3984848484611e3c565b610e7433611f65565b600003610ea4576000356001600160e01b0319166003604051620f948f60ea1b8152600401610af19291906129e5565b6000610eaf88611ac3565b90506000610ebd600f6115d7565b6040516303d1982560e61b81526001600160a01b03848116600483015291925060009183169063f466094090602401600060405180830381865afa158015610f09573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f319190810190612aae565b60a00151905080805190602001208989604051610f4f92919061292b565b604051809103902014610f835760405163053265f160e01b81526001600160e01b0319600035166004820152602401610af1565b6040516bffffffffffffffffffffffff1960608c901b1660208201526034810188905260009060540160408051601f1981840301815291815281516020928301206000818152601f90935291205490915060ff1615610ff55760405163f27b8ec960e01b815260040160405180910390fd5b61106b8a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820182528d935091508b90600290839083908082843760009201919091525061105d91508b9050612bc6565b6110668a612c9d565b611fdd565b15611199576000818152601f60205260408120805460ff1916600117905561109360086115d7565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f9919061278e565b9050856001600160a01b03166000805160206130ab833981519152600883604051611125929190612951565b60405180910390a2601e54601d54604051630bde081360e21b81526001600160a01b03851692632f78204c92611164928b92919060019060040161296f565b600060405180830381600087803b15801561117e57600080fd5b505af1158015611192573d6000803e3d6000fd5b5050505050505b5050505050505050505050565b60006111b182611ac3565b905060006111bf60086115d7565b604051635061f96960e11b81526001600160a01b0385811660048301529192509082169063a0c3f2d290602401602060405180830381865afa158015611209573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122d9190612cf5565b61125a576000356001600160e01b0319166008604051620f948f60ea1b8152600401610af19291906129e5565b6040516304d971ab60e01b81526001600160a01b0384811660048301523360248301528216906304d971ab90604401602060405180830381865afa1580156112a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ca9190612cf5565b6112f7576000356001600160e01b0319166004604051620f948f60ea1b8152600401610af19291906129e5565b604051634b2c2fe160e11b81526001600160a01b03848116600483015260009182918416906396585fc290602401606060405180830381865afa158015611342573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113669190612d10565b92505091508161138957604051636cd31b5960e01b815260040160405180910390fd5b6000836001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed919061278e565b6001600160a01b038616600090815260db6020908152604080832084845290915290205490915060ff161561143557604051637674d6a960e01b815260040160405180910390fd5b6001600160a01b038516600090815260dc602052604081205460df5490919061145e9085612d5b565b9050808210156114815760405163462e593760e11b815260040160405180910390fd5b604051630adaf5ef60e11b81526001600160a01b038881166004830152602482018590528716906315b5ebde90604401600060405180830381600087803b1580156114cb57600080fd5b505af11580156114df573d6000803e3d6000fd5b505050506001600160a01b038716600090815260dc60205260408120805483929061150b908490612d72565b90915550506001600160a01b038716600090815260a3602090815260408083208684529091528120556001600160a01b03878116600090815260db60209081526040808320878452825291829020805460ff191660011790558151868152908101849052918a16917f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a25050505050505050565b600060dc60006115b784611ac3565b6001600160a01b0316815260208101919091526040016000205492915050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f81111561160e5761160e61293b565b60ff1681526020810191909152604001600020546001600160a01b031690508061164d578160405163409140df60e11b8152600401610af19190612d99565b919050565b6060600061169284848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061203892505050565b905080516001600160401b038111156116ad576116ad6126f4565b6040519080825280602002602001820160405280156116d6578160200160208202803683370190505b50915060005b82518110156117495760dc60008383815181106116fb576116fb61270a565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020548382815181106117365761173661270a565b60209081029190910101526001016116dc565b505092915050565b60a25443116117735760405163557fd09160e01b815260040160405180910390fd5b4360a2553341146117a7576000356001600160e01b0319166002604051620f948f60ea1b8152600401610af19291906129e5565b60006117b282611ac3565b90506117be82826120b4565b6117c6575050565b60006117d260086115d7565b90506000816001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061278e565b6001600160a01b038416600090815260a360209081526040808320848452909152812080546001019081905560a754929350916118769043906121e0565b905060a554820361191f57846001600160a01b03166000805160206130ab8339815191526002856040516118ab929190612951565b60405180910390a260a654604051630bde081360e21b81526001600160a01b03861691632f78204c916118e891899186919060009060040161296f565b600060405180830381600087803b15801561190257600080fd5b505af1158015611916573d6000803e3d6000fd5b50505050611a6e565b60a4548203611a6e5760006119348685611d45565b9050806119d757856001600160a01b03166000805160206130ab833981519152600186604051611965929190612951565b60405180910390a2604051630bde081360e21b81526001600160a01b03861690632f78204c906119a09089906000908190819060040161296f565b600060405180830381600087803b1580156119ba57600080fd5b505af11580156119ce573d6000803e3d6000fd5b50505050611a6c565b856001600160a01b03166000805160206130ab833981519152600786604051611a01929190612951565b60405180910390a260a654604051630bde081360e21b81526001600160a01b03871691632f78204c91611a3e918a9187919060019060040161296f565b600060405180830381600087803b158015611a5857600080fd5b505af1158015611199573d6000803e3d6000fd5b505b50505050505b50565b611a80816115d7565b6001600160a01b0316336001600160a01b031614611a74576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610af193929190612da7565b6000611acf600f6115d7565b6040516350a9fc2960e01b81526001600160a01b03848116600483015291909116906350a9fc2990602401602060405180830381865afa158015611b17573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058e9190612dde565b6001600160a01b038216600090815260a360209081526040808320848452909152812054610be9565b6000818311611b74576000610be9565b610be98284612d72565b6000611b93611b8d8486612dfb565b836121fb565b949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611bf5576000356001600160e01b0319166001604051620f948f60ea1b8152600401610af19291906129e5565b565b6040516000906067906001908390611c1b908a908a908a908a908a90602401612e37565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b1790528051909150611c52612211565b602083016020828483895afa611c6757600094505b503d611c7257600093505b83611c9057604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f811115611cd757611cd761293b565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f811115611d1857611d1861293b565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff16610be9565b601d829055601e81905560408051838152602081018390527f381ec200df2ed0875638486318f9f8a84e3550bdc686bf1400c9371a18d087f09101610bc9565b806001600160a01b03163b600003611a7457604051630bfc64a360e21b81526001600160a01b0382166004820152602401610af1565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b9060600160405180910390a1505050565b60a55460a4541115611e6f576040516387f6f09560e01b81526001600160e01b0319600035166004820152602401610af1565b60a484905560a583905560a682905560a78190556040805185815260208101859052908101839052606081018290527f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa9890608001610502565b82841115611ee95760405163112af4d160e01b815260040160405180910390fd5b612710811115611f0c5760405163382c88a360e21b815260040160405180910390fd5b60dd84905560de83905560df82905560e08190556040805185815260208101859052908101839052606081018290527fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b90608001610502565b6000611f71600a6115d7565b604051631af0725f60e31b81526001600160a01b038481166004830152919091169063d78392f890602401602060405180830381865afa158015611fb9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058e919061278e565b6040516000906069906001908390612001908a908a908a908a908a90602401612eec565b60408051601f198184030181529190526020810180516001600160e01b0316637b47d06b60e01b1790528051909150611c52612211565b6060612044600f6115d7565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b815260040161206f9190612fcf565b600060405180830381865afa15801561208c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261058e919081019061301c565b6000336001600160a01b038416148015906120d85750336001600160a01b03831614155b801561215557506120e960086115d7565b604051633292276760e11b81526001600160a01b03858116600483015291909116906365244ece90602401602060405180830381865afa158015612131573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121559190612cf5565b8015610be9575061216660056115d7565b604051638d5b675960e01b81526001600160a01b0384811660048301524360248301529190911690638d5b675990604401602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d89190612cf5565b159392505050565b6000816000036121f1576000610be9565b610be98284612dfb565b600081831061220a5781610be9565b5090919050565b60405180602001604052806001906020820280368337509192915050565b60008083601f84011261224157600080fd5b5081356001600160401b0381111561225857600080fd5b6020830191508360208260051b850101111561227357600080fd5b9250929050565b6000806020838503121561228d57600080fd5b82356001600160401b038111156122a357600080fd5b6122af8582860161222f565b90969095509350505050565b6001600160a01b0381168114611a7457600080fd5b6000602082840312156122e257600080fd5b8135610be9816122bb565b60008060006040848603121561230257600080fd5b83356001600160401b0381111561231857600080fd5b6123248682870161222f565b909790965060209590950135949350505050565b60008083601f84011261234a57600080fd5b5081356001600160401b0381111561236157600080fd5b60208301915083602082850101111561227357600080fd5b60008060008060006060868803121561239157600080fd5b853561239c816122bb565b945060208601356001600160401b03808211156123b857600080fd5b6123c489838a01612338565b909650945060408801359150808211156123dd57600080fd5b506123ea88828901612338565b969995985093965092949392505050565b6000806040838503121561240e57600080fd5b8235612419816122bb565b946020939093013593505050565b80356010811061164d57600080fd5b6000806040838503121561244957600080fd5b61245283612427565b91506020830135612462816122bb565b809150509250929050565b806080810183101561058e57600080fd5b806040810183101561058e57600080fd5b60008060008060008060008060006102a08a8c0312156124ae57600080fd5b89356124b9816122bb565b985060208a01356124c9816122bb565b975060408a01356124d9816122bb565b965060608a01356124e9816122bb565b95506124f88b60808c0161246d565b94506125088b6101008c0161247e565b93506101a08a018b81111561251c57600080fd5b6101408b01935061252d8c8261246d565b92505061253e8b6102208c0161246d565b90509295985092959850929598565b6000806040838503121561256057600080fd5b50508035926020909101359150565b6000806000806080858703121561258557600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000606084860312156125b657600080fd5b505081359360208301359350604090920135919050565b600080600080600080600060e0888a0312156125e857600080fd5b87356125f3816122bb565b965060208801356001600160401b038082111561260f57600080fd5b61261b8b838c01612338565b909850965060408a013595508691506126378b60608c0161247e565b945060a08a013591508082111561264d57600080fd5b6126598b838c0161247e565b935060c08a013591508082111561266f57600080fd5b5061267c8a828b0161247e565b91505092959891949750929550565b60006020828403121561269d57600080fd5b610be982612427565b600081518084526020808501945080840160005b838110156126d6578151875295820195908201906001016126ba565b509495945050505050565b602081526000610be960208301846126a6565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8183526000602080850194508260005b858110156126d6578135612743816122bb565b6001600160a01b031687529582019590820190600101612730565b604081526000612772604083018587612720565b828103602084015261278481856126a6565b9695505050505050565b6000602082840312156127a057600080fd5b5051919050565b602081526000611b93602083018486612720565b60405160c081016001600160401b03811182821017156127dd576127dd6126f4565b60405290565b604080519081016001600160401b03811182821017156127dd576127dd6126f4565b604051601f8201601f191681016001600160401b038111828210171561282d5761282d6126f4565b604052919050565b60006001600160401b0382111561284e5761284e6126f4565b5060051b60200190565b8051801515811461164d57600080fd5b6000602080838503121561287b57600080fd5b82516001600160401b0381111561289157600080fd5b8301601f810185136128a257600080fd5b80516128b56128b082612835565b612805565b81815260059190911b820183019083810190878311156128d457600080fd5b928401925b828410156128f9576128ea84612858565b825292840192908401906128d9565b979650505050505050565b606081526000612918606083018688612720565b6020830194909452506040015292915050565b8183823760009101908152919050565b634e487b7160e01b600052602160045260246000fd5b60408101600984106129655761296561293b565b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6001600160e01b03198316815260408101600b8310612a0657612a0661293b565b8260208301529392505050565b805161164d816122bb565b60006001600160401b03821115612a3757612a376126f4565b50601f01601f191660200190565b60005b83811015612a60578181015183820152602001612a48565b50506000910152565b600082601f830112612a7a57600080fd5b8151612a886128b082612a1e565b818152846020838601011115612a9d57600080fd5b611b93826020830160208701612a45565b600060208284031215612ac057600080fd5b81516001600160401b0380821115612ad757600080fd5b9083019060c08286031215612aeb57600080fd5b612af36127bb565b8251612afe816122bb565b81526020830151612b0e816122bb565b60208201526040830151612b21816122bb565b6040820152612b3260608401612a13565b6060820152612b4360808401612a13565b608082015260a083015182811115612b5a57600080fd5b612b6687828601612a69565b60a08301525095945050505050565b600082601f830112612b8657600080fd5b8135612b946128b082612a1e565b818152846020838601011115612ba957600080fd5b816020850160208301376000918101602001919091529392505050565b6000612bd06127e3565b806040840136811115612be257600080fd5b845b81811015612c935780356001600160401b0380821115612c045760008081fd5b9087019036601f830112612c185760008081fd5b81356020612c286128b083612835565b82815260059290921b84018101918181019036841115612c485760008081fd5b8286015b84811015612c8057803586811115612c645760008081fd5b612c723686838b0101612b75565b845250918301918301612c4c565b5089525090960195505050602001612be4565b5090949350505050565b6000612ca76127e3565b806040840136811115612cb957600080fd5b845b81811015612c935780356001600160401b03811115612cda5760008081fd5b612ce636828901612b75565b85525060209384019301612cbb565b600060208284031215612d0757600080fd5b610be982612858565b600080600060608486031215612d2557600080fd5b612d2e84612858565b925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761058e5761058e612d45565b8181038181111561058e5761058e612d45565b60108110612d9557612d9561293b565b9052565b6020810161058e8284612d85565b6001600160e01b03198416815260608101612dc56020830185612d85565b6001600160a01b03929092166040919091015292915050565b600060208284031215612df057600080fd5b8151610be9816122bb565b8082018082111561058e5761058e612d45565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090612e5c9083018688612e0e565b8281036040840152612e6f818587612e0e565b98975050505050505050565b60008151808452612e93816020860160208601612a45565b601f01601f19169290920160200192915050565b600082604081018360005b6002811015612ee1578383038752612ecb838351612e7b565b6020978801979093509190910190600101612eb2565b509095945050505050565b60c081526000612eff60c0830188612e7b565b60208781850152604084018760005b6002811015612f2b57815183529183019190830190600101612f0e565b505050838203608085015281604081018760005b6002811015612fac578583038452815180518085529086019086850190600581901b8601880160005b82811015612f9657601f19888303018452612f84828651612e7b565b948a0194938a01939150600101612f68565b5096880196955050509185019150600101612f3f565b505085810360a0870152612fc08188612ea7565b9b9a5050505050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156130105783516001600160a01b031683529284019291840191600101612feb565b50909695505050505050565b6000602080838503121561302f57600080fd5b82516001600160401b0381111561304557600080fd5b8301601f8101851361305657600080fd5b80516130646128b082612835565b81815260059190911b8201830190838101908783111561308357600080fd5b928401925b828410156128f957835161309b816122bb565b8252928401929084019061308856fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d9a264697066735822122044c31e0275363a320e2635619d2e64fac4ce28df081f0c7c841ba7a971c59c1864736f6c63430008130033", "devdoc": { "errors": { "ErrCallPrecompiled()": [ @@ -1177,16 +989,6 @@ "details": "Error thrown when an invalid cut-off percentage configuration is provided." } ], - "ErrInvalidRatios()": [ - { - "details": "Error thrown when invalid ratios are provided." - } - ], - "ErrInvalidSlash()": [ - { - "details": "Error thrown when an invalid slash is encountered." - } - ], "ErrInvalidThreshold(bytes4)": [ { "details": "Error indicating that the provided threshold is invalid for a specific function signature.", @@ -1225,13 +1027,42 @@ } ] }, + "events": { + "BailedOut(address,uint256,uint256)": { + "details": "Emitted when a validator bailed out of jail." + }, + "ContractUpdated(uint8,address)": { + "details": "Emitted when a contract is updated." + }, + "CreditScoreConfigsUpdated(uint256,uint256,uint256,uint256)": { + "details": "Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details." + }, + "CreditScoresUpdated(address[],uint256[])": { + "details": "Emitted the credit score of validators is updated." + }, + "DoubleSignSlashingConfigsUpdated(uint256,uint256,uint256)": { + "details": "Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs` for param details." + }, + "FastFinalitySlashingConfigsUpdated(uint256,uint256)": { + "details": "Emitted when the configs to slash fast finality is updated. See the method `getFastFinalitySlashingConfigs` for param details." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Slashed(address,uint8,uint256)": { + "details": "Emitted when the validator is slashed." + }, + "UnavailabilitySlashingConfigsUpdated(uint256,uint256,uint256,uint256)": { + "details": "Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs` for param details." + } + }, "kind": "dev", "methods": { "bailOut(address)": { "details": "A slashed validator use this method to get out of jail. Requirements: - The `_consensusAddr` must be a validator. - Only validator's admin can call this method. Emits the event `BailedOut`." }, "checkBailedOutAtPeriod(address,uint256)": { - "details": "Returns the whether the `_validator` has been bailed out at the `_period`." + "details": "Returns the whether the `consensus` has been bailed out at the `period`." }, "currentUnavailabilityIndicator(address)": { "details": "Returns the current unavailability indicator of a block producer." @@ -1239,27 +1070,8 @@ "execResetCreditScores(address[])": { "details": "Resets the credit score for the revoked validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`." }, - "execSlashBridgeOperator(address,uint256,uint256)": { - "details": "Acknowledges bridge operator slash and emit `Slashed` event correspondingly.", - "params": { - "_tier": "The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1` and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2` Requirements: - Only validator contract can invoke this method. - Should be called only at the end of period. - Should be called only when there is slash of bridge operator. Emits the event `Slashed`." - } - }, - "getBridgeOperatorSlashingConfigs()": { - "details": "Returns the configs related to bridge operator slashing.", - "returns": { - "jailDurationForMissingVotesRatioTier2_": "The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.", - "missingVotesRatioTier1_": "The bridge reward will be deprecated if (s)he missed more than this ratio.", - "missingVotesRatioTier2_": "The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio.", - "skipBridgeOperatorSlashingThreshold_": "The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small." - } - }, - "getBridgeVotingSlashingConfigs()": { - "details": "Returns the configs related to bridge voting slashing.", - "returns": { - "bridgeVotingSlashAmount_": "The amount of RON to slash bridge voting.", - "bridgeVotingThreshold_": "The threshold to slash when a trusted organization does not vote for bridge operators." - } + "execUpdateCreditScores(address[],uint256)": { + "details": "Updates the credit score for the validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`." }, "getContract(uint8)": { "details": "Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.", @@ -1303,7 +1115,7 @@ "details": "Returns the current credit score of a list of validators." }, "getUnavailabilityIndicator(address,uint256)": { - "details": "Helper for CreditScore contract to query indicator of the validator." + "details": "Returns the unavailability indicator in the period `period` of a block producer." }, "getUnavailabilitySlashingConfigs()": { "details": "Returns the configs related to block producer slashing.", @@ -1317,28 +1129,15 @@ "initialize(address,address,address,address,uint256[4],uint256[2],uint256[3],uint256[4],uint256[4])": { "details": "Initializes the contract storage." }, + "lastUnavailabilitySlashedBlock()": { + "details": "Returns the last block that a block producer is slashed for unavailability." + }, "precompileValidateDoubleSignAddress()": { "details": "Gets the address of the precompile of validating double sign evidence" }, "precompileValidateFastFinalityAddress()": { "details": "Gets the address of the precompile of validating double sign evidence" }, - "setBridgeOperatorSlashingConfigs(uint256,uint256,uint256,uint256)": { - "details": "Sets the configs to slash bridge operators. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.", - "params": { - "_jailDurationTier2": "The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.", - "_ratioTier1": "The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map to 0%-100%.", - "_ratioTier2": "The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.", - "_skipSlashingThreshold": "The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small." - } - }, - "setBridgeVotingSlashingConfigs(uint256,uint256)": { - "details": "Sets the configs to slash bridge voting. Requirements: - The method caller is admin. Emits the event `BridgeVotingSlashingConfigsUpdated`.", - "params": { - "_slashAmount": "The amount of RON to slash bridge voting.", - "_threshold": "The threshold to slash when a trusted organization does not vote for bridge operators." - } - }, "setContract(uint8,address)": { "details": "Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.", "params": { @@ -1373,15 +1172,12 @@ "setUnavailabilitySlashingConfigs(uint256,uint256,uint256,uint256)": { "details": "Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.", "params": { - "_jailDurationForTier2Threshold": "The number of blocks to jail a block producer when (s)he is slashed tier-2.", - "_slashAmountForTier2Threshold": "The amount of RON to deduct from self-staking of a block producer when (s)he is slashed tier-2.", - "_tier1Threshold": "The mining reward will be deprecated, if (s)he missed more than this threshold.", - "_tier2Threshold": "The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold." + "jailDurationForTier2Threshold": "The number of blocks to jail a block producer when (s)he is slashed tier-2.", + "slashAmountForTier2Threshold": "The amount of RON to deduct from self-staking of a block producer when (s)he is slashed tier-2.", + "tier1Threshold": "The mining reward will be deprecated, if (s)he missed more than this threshold.", + "tier2Threshold": "The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold." } }, - "slashBridgeVoting(address)": { - "details": "Slashes for bridge voter governance. Emits the event `Slashed`." - }, "slashDoubleSign(address,bytes,bytes)": { "details": "Slashes for double signing. Requirements: - The method caller is coinbase. Emits the event `Slashed` if the double signing evidence of the two headers valid." }, @@ -1389,10 +1185,7 @@ "details": "Slashes for fast finality. Requirements: - Only whitelisted addresses are allowed to call. Emits the event `Slashed` if the fast finality evidence of the two headers valid." }, "slashUnavailability(address)": { - "details": "Slashes for unavailability by increasing the counter of block producer `_consensusAddr`. Requirements: - The method caller is coinbase. Emits the event `Slashed` when the threshold is reached." - }, - "updateCreditScores(address[],uint256)": { - "details": "Updates the credit score for the validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`." + "details": "Slashes for unavailability by increasing the counter of block producer `consensusAddr`. Requirements: - The method caller is coinbase. Emits the event `Slashed` when the threshold is reached." } }, "version": 1 @@ -1405,7 +1198,7 @@ "storageLayout": { "storage": [ { - "astId": 8212, + "astId": 11044, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______deprecatedValidator", "offset": 0, @@ -1413,7 +1206,7 @@ "type": "t_address" }, { - "astId": 6841, + "astId": 9487, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_slashDoubleSignAmount", "offset": 0, @@ -1421,7 +1214,7 @@ "type": "t_uint256" }, { - "astId": 6844, + "astId": 9490, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_doubleSigningJailUntilBlock", "offset": 0, @@ -1429,7 +1222,7 @@ "type": "t_uint256" }, { - "astId": 6847, + "astId": 9493, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_doubleSigningOffsetLimitBlock", "offset": 0, @@ -1437,7 +1230,7 @@ "type": "t_uint256" }, { - "astId": 6852, + "astId": 9498, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_submittedEvidence", "offset": 0, @@ -1445,7 +1238,7 @@ "type": "t_mapping(t_bytes32,t_bool)" }, { - "astId": 6857, + "astId": 9503, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1453,7 +1246,7 @@ "type": "t_array(t_uint256)24_storage" }, { - "astId": 7042, + "astId": 9721, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_slashFastFinalityAmount", "offset": 0, @@ -1461,7 +1254,7 @@ "type": "t_uint256" }, { - "astId": 7045, + "astId": 9724, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_fastFinalityJailUntilBlock", "offset": 0, @@ -1469,7 +1262,7 @@ "type": "t_uint256" }, { - "astId": 7050, + "astId": 9729, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_processedEvidence", "offset": 0, @@ -1477,7 +1270,7 @@ "type": "t_mapping(t_bytes32,t_bool)" }, { - "astId": 7055, + "astId": 9734, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1485,7 +1278,7 @@ "type": "t_array(t_uint256)21_storage" }, { - "astId": 8224, + "astId": 11056, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______deprecatedTrustedOrg", "offset": 0, @@ -1493,7 +1286,7 @@ "type": "t_address" }, { - "astId": 8228, + "astId": 11060, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______deprecatedGovernanceAdmin", "offset": 0, @@ -1501,31 +1294,31 @@ "type": "t_address" }, { - "astId": 6659, + "astId": 9456, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_bridgeVotingSlashed", + "label": "__deprecatedBridgeVotingSlashed", "offset": 0, "slot": "55", "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 6662, + "astId": 9459, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_bridgeVotingThreshold", + "label": "__deprecatedBridgeVotingThreshold", "offset": 0, "slot": "56", "type": "t_uint256" }, { - "astId": 6665, + "astId": 9462, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_bridgeVotingSlashAmount", + "label": "__deprecatedBridgeVotingSlashAmount", "offset": 0, "slot": "57", "type": "t_uint256" }, { - "astId": 6670, + "astId": 9467, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1533,111 +1326,111 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 8220, + "astId": 9419, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "______deprecatedMaintenance", + "label": "____deprecatedMissingVotesRatioTier1", "offset": 0, "slot": "108", - "type": "t_address" + "type": "t_uint256" }, { - "astId": 6480, + "astId": 9422, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_missingVotesRatioTier1", + "label": "____deprecatedMissingVotesRatioTier2", "offset": 0, "slot": "109", "type": "t_uint256" }, { - "astId": 6483, + "astId": 9425, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_missingVotesRatioTier2", + "label": "____deprecatedJailDurationForMissingVotesRatioTier2", "offset": 0, "slot": "110", "type": "t_uint256" }, { - "astId": 6486, + "astId": 9428, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_jailDurationForMissingVotesRatioTier2", + "label": "____deprecatedSkipBridgeOperatorSlashingThreshold", "offset": 0, "slot": "111", "type": "t_uint256" }, { - "astId": 6489, - "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "_skipBridgeOperatorSlashingThreshold", - "offset": 0, - "slot": "112", - "type": "t_uint256" - }, - { - "astId": 6494, + "astId": 9433, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, - "slot": "113", + "slot": "112", "type": "t_array(t_uint256)50_storage" }, { - "astId": 7619, + "astId": 10345, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", - "label": "lastUnavailabilitySlashedBlock", + "label": "_lastUnavailabilitySlashedBlock", "offset": 0, - "slot": "163", + "slot": "162", "type": "t_uint256" }, { - "astId": 7626, + "astId": 10352, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_unavailabilityIndicator", "offset": 0, - "slot": "164", + "slot": "163", "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" }, { - "astId": 7629, + "astId": 10355, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_unavailabilityTier1Threshold", "offset": 0, - "slot": "165", + "slot": "164", "type": "t_uint256" }, { - "astId": 7632, + "astId": 10358, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_unavailabilityTier2Threshold", "offset": 0, - "slot": "166", + "slot": "165", "type": "t_uint256" }, { - "astId": 7635, + "astId": 10361, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_slashAmountForUnavailabilityTier2Threshold", "offset": 0, - "slot": "167", + "slot": "166", "type": "t_uint256" }, { - "astId": 7638, + "astId": 10364, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_jailDurationForUnavailabilityTier2Threshold", "offset": 0, - "slot": "168", + "slot": "167", "type": "t_uint256" }, { - "astId": 7643, + "astId": 10369, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, - "slot": "169", + "slot": "168", "type": "t_array(t_uint256)50_storage" }, { - "astId": 5911, + "astId": 11052, + "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", + "label": "______deprecatedMaintenance", + "offset": 0, + "slot": "218", + "type": "t_address" + }, + { + "astId": 8800, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_checkBailedOutAtPeriod", "offset": 0, @@ -1645,7 +1438,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 5916, + "astId": 8805, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_creditScore", "offset": 0, @@ -1653,7 +1446,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 5919, + "astId": 8808, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_gainCreditScore", "offset": 0, @@ -1661,7 +1454,7 @@ "type": "t_uint256" }, { - "astId": 5922, + "astId": 8811, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_maxCreditScore", "offset": 0, @@ -1669,7 +1462,7 @@ "type": "t_uint256" }, { - "astId": 5925, + "astId": 8814, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_bailOutCostMultiplier", "offset": 0, @@ -1677,7 +1470,7 @@ "type": "t_uint256" }, { - "astId": 5928, + "astId": 8817, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_cutOffPercentageAfterBailout", "offset": 0, @@ -1685,7 +1478,7 @@ "type": "t_uint256" }, { - "astId": 5933, + "astId": 8822, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, diff --git a/deployments/ronin-testnet/StakingLogic.json b/deployments/ronin-testnet/StakingLogic.json index 038e09b95..104ee9050 100644 --- a/deployments/ronin-testnet/StakingLogic.json +++ b/deployments/ronin-testnet/StakingLogic.json @@ -1,5 +1,5 @@ { - "address": "0x47FF1a3E1d8A43898Dd0BDd97e63Fe1B14087DdB", + "address": "0xEc7AC1cdda395094DCaC7711E6439c5E8caBcf2F", "abi": [ { "inputs": [], @@ -62,6 +62,11 @@ }, { "inputs": [ + { + "internalType": "TConsensus", + "name": "consensusAddr", + "type": "address" + }, { "internalType": "address", "name": "poolAddr", @@ -284,7 +289,7 @@ { "indexed": true, "internalType": "address", - "name": "consensuAddr", + "name": "poolId", "type": "address" }, { @@ -486,7 +491,7 @@ { "indexed": true, "internalType": "address", - "name": "consensuAddr", + "name": "poolId", "type": "address" }, { @@ -505,7 +510,7 @@ { "indexed": true, "internalType": "address", - "name": "validator", + "name": "poolId", "type": "address" }, { @@ -536,7 +541,7 @@ { "indexed": true, "internalType": "address", - "name": "validator", + "name": "poolId", "type": "address" }, { @@ -573,7 +578,7 @@ { "indexed": true, "internalType": "address", - "name": "consensuAddr", + "name": "poolId", "type": "address" }, { @@ -592,7 +597,7 @@ { "indexed": true, "internalType": "address", - "name": "consensuAddr", + "name": "poolId", "type": "address" }, { @@ -677,23 +682,28 @@ "inputs": [ { "internalType": "address", - "name": "_candidateAdmin", + "name": "candidateAdmin", "type": "address" }, { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "address payable", - "name": "_treasuryAddr", + "name": "treasuryAddr", "type": "address" }, { "internalType": "uint256", - "name": "_commissionRate", + "name": "commissionRate", "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" } ], "name": "applyValidatorCandidate", @@ -704,13 +714,13 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_consensusAddrs", + "internalType": "TConsensus[]", + "name": "consensusAddrs", "type": "address[]" }, { "internalType": "uint256[]", - "name": "_amounts", + "name": "amounts", "type": "uint256[]" } ], @@ -722,8 +732,8 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_consensusAddrList", + "internalType": "TConsensus[]", + "name": "consensusAddrList", "type": "address[]" } ], @@ -731,7 +741,7 @@ "outputs": [ { "internalType": "uint256", - "name": "_amount", + "name": "amount", "type": "uint256" } ], @@ -754,8 +764,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -767,13 +777,13 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_consensusAddrList", + "internalType": "TConsensus[]", + "name": "consensusAddrList", "type": "address[]" }, { - "internalType": "address", - "name": "_consensusAddrDst", + "internalType": "TConsensus", + "name": "consensusAddrDst", "type": "address" } ], @@ -781,7 +791,7 @@ "outputs": [ { "internalType": "uint256", - "name": "_amount", + "name": "amount", "type": "uint256" } ], @@ -792,12 +802,30 @@ "inputs": [ { "internalType": "address", - "name": "_consensusAddr", + "name": "poolAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "newAdminAddr", + "type": "address" + } + ], + "name": "execChangeAdminAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolId", "type": "address" }, { "internalType": "uint256", - "name": "_amount", + "name": "amount", "type": "uint256" } ], @@ -805,7 +833,7 @@ "outputs": [ { "internalType": "uint256", - "name": "_actualDeductingAmount", + "name": "actualDeductingAmount_", "type": "uint256" } ], @@ -816,12 +844,12 @@ "inputs": [ { "internalType": "address[]", - "name": "_pools", + "name": "poolIds", "type": "address[]" }, { "internalType": "uint256", - "name": "_newPeriod", + "name": "newPeriod", "type": "uint256" } ], @@ -834,17 +862,17 @@ "inputs": [ { "internalType": "address[]", - "name": "_consensusAddrs", + "name": "poolIds", "type": "address[]" }, { "internalType": "uint256[]", - "name": "_rewards", + "name": "rewards", "type": "uint256[]" }, { "internalType": "uint256", - "name": "_period", + "name": "period", "type": "uint256" } ], @@ -893,8 +921,8 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_pools", + "internalType": "TConsensus[]", + "name": "consensusAddrs", "type": "address[]" } ], @@ -902,7 +930,7 @@ "outputs": [ { "internalType": "uint256[]", - "name": "_selfStakings", + "name": "selfStakings_", "type": "uint256[]" } ], @@ -913,12 +941,31 @@ "inputs": [ { "internalType": "address[]", - "name": "_poolAddrs", + "name": "poolIds", + "type": "address[]" + } + ], + "name": "getManySelfStakingsById", + "outputs": [ + { + "internalType": "uint256[]", + "name": "selfStakings_", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus[]", + "name": "consensusAddrs", "type": "address[]" }, { "internalType": "address[]", - "name": "_userList", + "name": "userList", "type": "address[]" } ], @@ -926,7 +973,7 @@ "outputs": [ { "internalType": "uint256[]", - "name": "_stakingAmounts", + "name": "stakingAmounts", "type": "uint256[]" } ], @@ -937,7 +984,31 @@ "inputs": [ { "internalType": "address[]", - "name": "_poolList", + "name": "poolIds", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "userList", + "type": "address[]" + } + ], + "name": "getManyStakingAmountsById", + "outputs": [ + { + "internalType": "uint256[]", + "name": "stakingAmounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus[]", + "name": "consensusAddrs", "type": "address[]" } ], @@ -945,7 +1016,26 @@ "outputs": [ { "internalType": "uint256[]", - "name": "_stakingAmounts", + "name": "stakingAmounts_", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "poolIds", + "type": "address[]" + } + ], + "name": "getManyStakingTotalsById", + "outputs": [ + { + "internalType": "uint256[]", + "name": "stakingAmounts_", "type": "uint256[]" } ], @@ -956,7 +1046,7 @@ "inputs": [ { "internalType": "address", - "name": "_poolAdminAddr", + "name": "admin", "type": "address" } ], @@ -974,8 +1064,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_poolAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -983,17 +1073,17 @@ "outputs": [ { "internalType": "address", - "name": "_admin", + "name": "admin", "type": "address" }, { "internalType": "uint256", - "name": "_stakingAmount", + "name": "stakingAmount", "type": "uint256" }, { "internalType": "uint256", - "name": "_stakingTotal", + "name": "stakingTotal", "type": "uint256" } ], @@ -1004,12 +1094,41 @@ "inputs": [ { "internalType": "address", - "name": "_poolAddr", + "name": "poolId", + "type": "address" + } + ], + "name": "getPoolDetailById", + "outputs": [ + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "uint256", + "name": "stakingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakingTotal", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "address", - "name": "_user", + "name": "user", "type": "address" } ], @@ -1028,12 +1147,12 @@ "inputs": [ { "internalType": "address", - "name": "_user", + "name": "user", "type": "address" }, { - "internalType": "address[]", - "name": "_poolAddrList", + "internalType": "TConsensus[]", + "name": "consensusAddrs", "type": "address[]" } ], @@ -1041,7 +1160,7 @@ "outputs": [ { "internalType": "uint256[]", - "name": "_rewards", + "name": "rewards_", "type": "uint256[]" } ], @@ -1051,13 +1170,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_poolAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "address", - "name": "_user", + "name": "user", "type": "address" } ], @@ -1075,8 +1194,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_poolAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -1135,7 +1254,20 @@ "inputs": [ { "internalType": "address", - "name": "_poolAdminAddr", + "name": "__profileContract", + "type": "address" + } + ], + "name": "initializeV3", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "admin", "type": "address" } ], @@ -1166,18 +1298,18 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddrSrc", + "internalType": "TConsensus", + "name": "consensusAddrSrc", "type": "address" }, { - "internalType": "address", - "name": "_consensusAddrDst", + "internalType": "TConsensus", + "name": "consensusAddrDst", "type": "address" }, { "internalType": "uint256", - "name": "_amount", + "name": "amount", "type": "uint256" } ], @@ -1189,8 +1321,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -1202,8 +1334,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -1215,18 +1347,18 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "uint256", - "name": "_effectiveDaysOnwards", + "name": "effectiveDaysOnwards", "type": "uint256" }, { "internalType": "uint256", - "name": "_commissionRate", + "name": "commissionRate", "type": "uint256" } ], @@ -1239,12 +1371,12 @@ "inputs": [ { "internalType": "uint256", - "name": "_minRate", + "name": "minRate", "type": "uint256" }, { "internalType": "uint256", - "name": "_maxRate", + "name": "maxRate", "type": "uint256" } ], @@ -1275,7 +1407,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_cooldownSecs", + "name": "cooldownSecs", "type": "uint256" } ], @@ -1288,7 +1420,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_threshold", + "name": "threshold", "type": "uint256" } ], @@ -1301,7 +1433,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_secs", + "name": "secs", "type": "uint256" } ], @@ -1313,8 +1445,8 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" } ], @@ -1326,41 +1458,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_candidateAdmin", - "type": "address" - }, - { - "internalType": "address", - "name": "_consensusAddr", - "type": "address" - }, - { - "internalType": "address payable", - "name": "_treasuryAddr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_commissionRate", - "type": "uint256" - } - ], - "name": "tmp_re_applyValidatorCandidate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "uint256", - "name": "_amount", + "name": "amount", "type": "uint256" } ], @@ -1372,13 +1476,13 @@ { "inputs": [ { - "internalType": "address", - "name": "_consensusAddr", + "internalType": "TConsensus", + "name": "consensusAddr", "type": "address" }, { "internalType": "uint256", - "name": "_amount", + "name": "amount", "type": "uint256" } ], @@ -1405,41 +1509,41 @@ "type": "receive" } ], - "transactionHash": "0x9c95ad9583c78bef5b822aa7636bc78a2aaa9572e82e911ffe69b0949a7cbf3e", + "transactionHash": "0x4dbcd5a87880cfa9bcde73081061691507d7eb80f75ebfea66b01ea511d681d3", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x47FF1a3E1d8A43898Dd0BDd97e63Fe1B14087DdB", + "contractAddress": "0xEc7AC1cdda395094DCaC7711E6439c5E8caBcf2F", "transactionIndex": 0, - "gasUsed": "3282482", - "logsBloom": "0x00000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000002000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000", - "blockHash": "0xe17d483cd37c371e637ff64c780d24d5fd84ff4278a44ffea57e2011571e5320", - "transactionHash": "0x9c95ad9583c78bef5b822aa7636bc78a2aaa9572e82e911ffe69b0949a7cbf3e", + "gasUsed": "3766841", + "logsBloom": "0x00000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000", + "blockHash": "0xc60915f42c6e07518d5426fca4092f502e11fe06f9762195998be23f602f81ff", + "transactionHash": "0x4dbcd5a87880cfa9bcde73081061691507d7eb80f75ebfea66b01ea511d681d3", "logs": [ { "transactionIndex": 0, - "blockNumber": 19430066, - "transactionHash": "0x9c95ad9583c78bef5b822aa7636bc78a2aaa9572e82e911ffe69b0949a7cbf3e", - "address": "0x47FF1a3E1d8A43898Dd0BDd97e63Fe1B14087DdB", + "blockNumber": 21941090, + "transactionHash": "0x4dbcd5a87880cfa9bcde73081061691507d7eb80f75ebfea66b01ea511d681d3", + "address": "0xEc7AC1cdda395094DCaC7711E6439c5E8caBcf2F", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0xe17d483cd37c371e637ff64c780d24d5fd84ff4278a44ffea57e2011571e5320" + "blockHash": "0xc60915f42c6e07518d5426fca4092f502e11fe06f9762195998be23f602f81ff" } ], - "blockNumber": 19430066, - "cumulativeGasUsed": "3282482", + "blockNumber": 21941090, + "cumulativeGasUsed": "3766841", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 13, - "solcInputHash": "6da162a003a00b6a8800b1f2bcac773f", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"ErrAdminOfAnyActivePoolForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"extraInfo\",\"type\":\"string\"}],\"name\":\"ErrCannotInitTransferRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotTransferRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrDuplicated\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"}],\"name\":\"ErrInactivePool\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sendAmount\",\"type\":\"uint256\"}],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientDelegatingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientStakingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidArrays\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidPoolShare\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrOnlyPoolAdminAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrPoolAdminForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStakingAmountLeft\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeInteractionAddrsNotEqual\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateZeroAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroValue\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateRangeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minSecs\",\"type\":\"uint256\"}],\"name\":\"CooldownSecsToUndelegateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MinValidatorStakingAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"PoolApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PoolSharesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validator\",\"type\":\"address[]\"}],\"name\":\"PoolsDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"}],\"name\":\"PoolsUpdateConflicted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdateFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"aRps\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"shares\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountDeductFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Undelegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debited\",\"type\":\"uint256\"}],\"name\":\"UserRewardUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"WaitingSecsToRevokeUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"bulkUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"}],\"name\":\"claimRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToUndelegate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"}],\"name\":\"delegateRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"execDeductStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_actualDeductingAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"execDeprecatePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execRecordRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommissionRateRange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakings\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_selfStakings\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddrs\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmounts\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotals\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"getPoolAddressOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getPoolDetail\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_poolAddrList\",\"type\":\"address[]\"}],\"name\":\"getRewards\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getStakingTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__minValidatorStakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxCommissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__cooldownSecsToUndelegate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__waitingSecsToRevoke\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"isAdminOfActivePool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minValidatorStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddrSrc\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"redelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestRenounce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"requestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxRate\",\"type\":\"uint256\"}],\"name\":\"setCommissionRateRange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cooldownSecs\",\"type\":\"uint256\"}],\"name\":\"setCooldownSecsToUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"}],\"name\":\"setMinValidatorStakingAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_secs\",\"type\":\"uint256\"}],\"name\":\"setWaitingSecsToRevoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"tmp_re_applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"waitingSecsToRevoke\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAdminOfAnyActivePoolForbidden(address)\":[{\"details\":\"Error of admin of any active pool cannot delegate.\"}],\"ErrCannotInitTransferRON(address,string)\":[{\"details\":\"Error of cannot transfer RON to specified target.\"}],\"ErrCannotTransferRON()\":[{\"details\":\"Error of cannot transfer RON.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrDuplicated(bytes4)\":[{\"details\":\"Error thrown when a duplicated element is detected in an array.\",\"params\":{\"msgSig\":\"The function signature that invoke the error.\"}}],\"ErrInactivePool(address)\":[{\"details\":\"Error of querying inactive pool.\"}],\"ErrInsufficientBalance(bytes4,uint256,uint256)\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInsufficientDelegatingAmount()\":[{\"details\":\"Error of undelegating insufficient amount.\"}],\"ErrInsufficientStakingAmount()\":[{\"details\":\"Error of insufficient staking amount for unstaking.\"}],\"ErrInvalidArrays()\":[{\"details\":\"Error of length of input arrays are not of the same.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of setting commission rate exceeds max allowed.\"}],\"ErrInvalidPoolShare()\":[{\"details\":\"Error of invalid pool share.\"}],\"ErrOnlyPoolAdminAllowed()\":[{\"details\":\"Error of no one is allowed to call but the pool's admin.\"}],\"ErrPoolAdminForbidden()\":[{\"details\":\"Error of pool admin is not allowed to call.\"}],\"ErrRecipientRevert(bytes4)\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrStakingAmountLeft()\":[{\"details\":\"Error of invalid staking amount left after deducted.\"}],\"ErrThreeInteractionAddrsNotEqual()\":[{\"details\":\"Error of three interaction addresses must be of the same in applying for validator candidate.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUndelegateTooEarly()\":[{\"details\":\"Error of undelegating too early.\"}],\"ErrUndelegateZeroAmount()\":[{\"details\":\"Error of undelegating zero amount.\"}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrUnstakeTooEarly()\":[{\"details\":\"Error of unstaking too early.\"}],\"ErrUnstakeZeroAmount()\":[{\"details\":\"Error of unstaking zero amount.\"}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}],\"ErrZeroValue()\":[{\"details\":\"Error of receiving zero message value.\"}]},\"kind\":\"dev\",\"methods\":{\"applyValidatorCandidate(address,address,address,uint256)\":{\"details\":\"Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.\",\"params\":{\"_candidateAdmin\":\"the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance.\"}},\"bulkUndelegate(address[],uint256[])\":{\"details\":\"Bulk unstakes from a list of candidates. Requirements: - The method caller is not the pool admin. Emits the events `Undelegated`.\"},\"claimRewards(address[])\":{\"details\":\"Claims the reward of method caller. Emits the `RewardClaimed` event.\"},\"cooldownSecsToUndelegate()\":{\"details\":\"Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\"},\"delegate(address)\":{\"details\":\"Stakes for a validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is not the pool admin. Emits the `Delegated` event.\"},\"delegateRewards(address[],address)\":{\"details\":\"Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event.\"},\"execDeductStakingAmount(address,uint256)\":{\"details\":\"Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`.\"},\"execDeprecatePools(address[],uint256)\":{\"details\":\"Deprecates the pool. - Deduct self-staking amount of the pool admin to zero. - Transfer the deducted amount to the pool admin. - Deactivate the pool admin address in the mapping of active pool admins Requirements: - The method caller is validator contract. Emits the event `PoolsDeprecated` and `Unstaked` events. Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\"},\"execRecordRewards(address[],uint256[],uint256)\":{\"details\":\"Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending.\"},\"getCommissionRateRange()\":{\"details\":\"Returns the commission rate range that the candidate can set.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getManySelfStakings(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManyStakingAmounts(address[],address[])\":{\"details\":\"Returns the staking amounts of the users.\"},\"getManyStakingTotals(address[])\":{\"details\":\"Returns the total staking amounts of all users for the pools `_poolAddrs`.\"},\"getPoolAddressOf(address)\":{\"details\":\"Returns the consensus address corresponding to the pool admin.\"},\"getPoolDetail(address)\":{\"details\":\"Returns the staking pool detail.\"},\"getReward(address,address)\":{\"details\":\"Returns the reward amount that user claimable.\"},\"getRewards(address,address[])\":{\"details\":\"Returns the claimable reward of the user `_user`.\"},\"getStakingAmount(address,address)\":{\"details\":\"Returns the staking amount of an user.\"},\"getStakingTotal(address)\":{\"details\":\"Returns the total staking amount of all users for a pool.\"},\"initialize(address,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"isAdminOfActivePool(address)\":{\"details\":\"Returns whether the `_poolAdminAddr` is currently active.\"},\"minValidatorStakingAmount()\":{\"details\":\"Returns the minimum threshold for being a validator candidate.\"},\"redelegate(address,address,uint256)\":{\"details\":\"Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `Undelegated` event and the `Delegated` event.\"},\"requestEmergencyExit(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestRenounce(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`.\"},\"setCommissionRateRange(uint256,uint256)\":{\"details\":\"Sets the commission rate range that a candidate can set. Requirements: - The method caller is admin. Emits the `CommissionRateRangeUpdated` event.\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setCooldownSecsToUndelegate(uint256)\":{\"details\":\"Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`.\"},\"setMinValidatorStakingAmount(uint256)\":{\"details\":\"Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event.\"},\"setWaitingSecsToRevoke(uint256)\":{\"details\":\"Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`.\"},\"stake(address)\":{\"details\":\"Self-delegates to the validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`.\"},\"tmp_re_applyValidatorCandidate(address,address,address,uint256)\":{\"details\":\"This method only work on testnet, to hotfix the applied validator candidate that is failed. Should remove this method before deploying it on mainnet.\"},\"undelegate(address,uint256)\":{\"details\":\"Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event.\"},\"unstake(address,uint256)\":{\"details\":\"Unstakes from the validator candidate `_consensusAddr` for `_amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`.\"},\"waitingSecsToRevoke()\":{\"details\":\"Returns the number of seconds that a candidate must wait for the renounce request gets affected.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/staking/Staking.sol\":\"Staking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance(bytes4 msgSig, uint256 currentBalance, uint256 sendAmount);\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert(bytes4 msgSig);\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable recipient, uint256 amount) internal {\\n if (!_sendRON(recipient, amount)) revert ErrRecipientRevert(msg.sig);\\n }\\n\\n /**\\n * @dev Send `amount` RON to the address `recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable recipient, uint256 amount) internal returns (bool success) {\\n if (address(this).balance < amount) revert ErrInsufficientBalance(msg.sig, address(this).balance, amount);\\n return _unsafeSendRON(recipient, amount);\\n }\\n\\n /**\\n * @dev Unsafe send `amount` RON to the address `recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable recipient, uint256 amount) internal returns (bool success) {\\n (success, ) = recipient.call{ value: amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRONLimitGas(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRONLimitGas(\\n address payable recipient,\\n uint256 amount,\\n uint256 gas\\n ) internal returns (bool success) {\\n (success, ) = recipient.call{ value: amount, gas: gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xdece837caa8da00fe031b8139ada009330b8bef149af12b535913c021ab94d0e\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x06e5962713a77abf6d5ba646e1cc1cfb6f9c50e7d52520dd82a10bf309534187\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address) external view returns (address _admin, uint256 _stakingAmount, uint256 _stakingTotal);\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x90517268a0e31147d97772c9ae518caa5eb8c03efe3b369e3c6d5166422f5962\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x9bc6ba6d13f00d9928c0add35ee6406906e16ed86207d373460930c0a75e5938\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(address _consensusAddrSrc, address _consensusAddrDst, uint256 _amount) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(\\n address _user,\\n address[] calldata _poolAddrList\\n ) external view returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(\\n address[] calldata _consensusAddrList,\\n address _consensusAddrDst\\n ) external returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x6dd71bf0c17a65da0dee49b98e4b038c1dd0e74f5473d03570421ceebd5b7084\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(\\n address[] calldata _poolAddrs,\\n address[] calldata _userList\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x52349fecb897b3b8288d8732923551382822c0c5fb8db9c6b094d080a16a2129\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(\\n address _consensusAddr,\\n uint256 _amount\\n ) external returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xd302d4a78203e277fb95a89de7ae32a3102129d3fbd64fc75f92d18be0443408\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address ______deprecatedbridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address _consensusAddr, uint256 _effectiveTimestamp, uint256 _rate) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0x9ab205c736f1bcc9a3debe06e08d829f4857141d940e6f608236f136193a7f49\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x3fdfa86da33b889e5153075ffc028d6b0c607480a96b532fbbbc48ac7bbf27c9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n address _addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n address _addr,\\n uint256 _blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2b1846b05ca1d636299fb929c1bd7b392b236f5e3f7aa3e7eea2c6d57b8836fb\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /**\\n * @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n */\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x6213c188a1323b242a098394b91caf9481e257bd57a0804cb2aa890377a993ed\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\"},\"contracts/ronin/staking/BaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../../interfaces/staking/IBaseStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport \\\"./RewardCalculation.sol\\\";\\n\\nabstract contract BaseStaking is\\n RONTransferHelper,\\n ReentrancyGuard,\\n RewardCalculation,\\n HasContracts,\\n IBaseStaking,\\n HasValidatorDeprecated\\n{\\n /// @dev Mapping from pool address => staking pool detail\\n mapping(address => PoolDetail) internal _stakingPool;\\n\\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n uint256 internal _cooldownSecsToUndelegate;\\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\\n uint256 internal _waitingSecsToRevoke;\\n\\n /// @dev Mapping from admin address of an active pool => consensus address.\\n mapping(address => address) internal _adminOfActivePoolMapping;\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n modifier noEmptyValue() {\\n _requireValue();\\n _;\\n }\\n\\n modifier anyExceptPoolAdmin(PoolDetail storage _pool, address _delegator) {\\n _anyExceptPoolAdmin(_pool, _delegator);\\n _;\\n }\\n\\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\\n _requirePoolAdmin(_pool, _requester);\\n _;\\n }\\n\\n modifier poolIsActive(address _poolAddr) {\\n _poolIsActive(_poolAddr);\\n _;\\n }\\n\\n function _requireValue() private view {\\n if (msg.value == 0) revert ErrZeroValue();\\n }\\n\\n function _requirePoolAdmin(PoolDetail storage _pool, address _requester) private view {\\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\\n }\\n\\n function _anyExceptPoolAdmin(PoolDetail storage _pool, address _delegator) private view {\\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\\n }\\n\\n function _poolIsActive(address _poolAddr) private view {\\n if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isValidatorCandidate(_poolAddr))\\n revert ErrInactivePool(_poolAddr);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\\n return _adminOfActivePoolMapping[_poolAdminAddr];\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolDetail(\\n address _poolAddr\\n ) external view returns (address _admin, uint256 _stakingAmount, uint256 _stakingTotal) {\\n PoolDetail storage _pool = _stakingPool[_poolAddr];\\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\\n _selfStakings = new uint256[](_pools.length);\\n for (uint _i = 0; _i < _pools.length; ) {\\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].stakingTotal;\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotals(\\n address[] calldata _poolList\\n ) public view override returns (uint256[] memory _stakingAmounts) {\\n _stakingAmounts = new uint256[](_poolList.length);\\n for (uint _i = 0; _i < _poolList.length; ) {\\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].delegatingAmount[_user];\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingAmounts(\\n address[] calldata _poolAddrs,\\n address[] calldata _userList\\n ) external view override returns (uint256[] memory _stakingAmounts) {\\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\\n _stakingAmounts = new uint256[](_poolAddrs.length);\\n for (uint _i = 0; _i < _stakingAmounts.length; ) {\\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256) {\\n return _cooldownSecsToUndelegate;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function waitingSecsToRevoke() external view returns (uint256) {\\n return _waitingSecsToRevoke;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\\n _setCooldownSecsToUndelegate(_cooldownSecs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\\n _setWaitingSecsToRevoke(_secs);\\n }\\n\\n /**\\n * @dev Sets the minium number of seconds to undelegate.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\\n _cooldownSecsToUndelegate = _cooldownSecs;\\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\\n }\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\\n _waitingSecsToRevoke = _secs;\\n emit WaitingSecsToRevokeUpdated(_secs);\\n }\\n\\n /**\\n * @dev Changes the delegate amount.\\n */\\n function _changeDelegatingAmount(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _newDelegatingAmount,\\n uint256 _newStakingTotal\\n ) internal {\\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\\n _pool.stakingTotal = _newStakingTotal;\\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\\n }\\n}\\n\",\"keccak256\":\"0xa1a3e6edfc9d8da5c851de0647c58bc86b0ec2e4a1c041f1b2a73d91b3d69b8d\",\"license\":\"MIT\"},\"contracts/ronin/staking/CandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../../interfaces/staking/ICandidateStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\\n /// @dev The minimum threshold for being a validator candidate.\\n uint256 internal _minValidatorStakingAmount;\\n\\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _maxCommissionRate;\\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _minCommissionRate;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] ______gap;\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function minValidatorStakingAmount() public view override returns (uint256) {\\n return _minValidatorStakingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function getCommissionRateRange() external view override returns (uint256, uint256) {\\n return (_minCommissionRate, _maxCommissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\\n _setMinValidatorStakingAmount(_threshold);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\\n _setCommissionRateRange(_minRate, _maxRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external payable override nonReentrant {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n\\n uint256 _amount = msg.value;\\n address payable _poolAdmin = payable(msg.sender);\\n _applyValidatorCandidate({\\n _poolAdmin: _poolAdmin,\\n _candidateAdmin: _candidateAdmin,\\n _consensusAddr: _consensusAddr,\\n _treasuryAddr: _treasuryAddr,\\n _commissionRate: _commissionRate,\\n _amount: _amount\\n });\\n\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n _pool.admin = _poolAdmin;\\n _pool.addr = _consensusAddr;\\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\\n\\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\\n emit PoolApproved(_consensusAddr, _poolAdmin);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestUpdateCommissionRate(\\n _consensusAddr,\\n _effectiveDaysOnwards,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function execDeprecatePools(\\n address[] calldata _pools,\\n uint256 _newPeriod\\n ) external override onlyContract(ContractType.VALIDATOR) {\\n if (_pools.length == 0) {\\n return;\\n }\\n\\n for (uint _i = 0; _i < _pools.length; ) {\\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\\n // Deactivate the pool admin in the active mapping.\\n delete _adminOfActivePoolMapping[_pool.admin];\\n\\n // Deduct and transfer the self staking amount to the pool admin.\\n uint256 _deductingAmount = _pool.stakingAmount;\\n if (_deductingAmount > 0) {\\n _deductStakingAmount(_pool, _deductingAmount);\\n if (!_unsafeSendRONLimitGas(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\\n }\\n }\\n\\n // Settle the unclaimed reward and transfer to the pool admin.\\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\\n if (_lastRewardAmount > 0) {\\n _unsafeSendRONLimitGas(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\\n }\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n\\n emit PoolsDeprecated(_pools);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function unstake(\\n address _consensusAddr,\\n uint256 _amount\\n ) external override nonReentrant poolIsActive(_consensusAddr) {\\n if (_amount == 0) revert ErrUnstakeZeroAmount();\\n address _requester = msg.sender;\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n uint256 _remainAmount = _pool.stakingAmount - _amount;\\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\\n\\n _unstake(_pool, _requester, _amount);\\n if (!_unsafeSendRONLimitGas(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestRenounce(\\n address _consensusAddr\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestRenounceCandidate(\\n _consensusAddr,\\n _waitingSecsToRevoke\\n );\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestEmergencyExit(\\n address _consensusAddr\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-applyValidatorCandidate`\\n */\\n function _applyValidatorCandidate(\\n address payable _poolAdmin,\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate,\\n uint256 _amount\\n ) internal {\\n if (!_unsafeSendRONLimitGas(_poolAdmin, 0, DEFAULT_ADDITION_GAS))\\n revert ErrCannotInitTransferRON(_poolAdmin, \\\"pool admin\\\");\\n if (!_unsafeSendRONLimitGas(_treasuryAddr, 0, DEFAULT_ADDITION_GAS))\\n revert ErrCannotInitTransferRON(_treasuryAddr, \\\"treasury\\\");\\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\\n\\n {\\n address[] memory _diffAddrs = new address[](2);\\n _diffAddrs[0] = _poolAdmin;\\n _diffAddrs[1] = _consensusAddr;\\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate(\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-stake`\\n */\\n function _stake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n _pool.stakingAmount += _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\\n emit Staked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-unstake`\\n */\\n function _unstake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\\n revert ErrUnstakeTooEarly();\\n }\\n\\n _pool.stakingAmount -= _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\\n emit Unstaked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Emits the event `Unstaked`.\\n *\\n * @return The actual deducted amount\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\\n _minValidatorStakingAmount = _threshold;\\n emit MinValidatorStakingAmountUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\\n _maxCommissionRate = _maxRate;\\n _minCommissionRate = _minRate;\\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\\n }\\n}\\n\",\"keccak256\":\"0x4859f479e8659e7c1005ae9dad4e5efc80869e8a87ee0794e90de7bffdde7a2b\",\"license\":\"MIT\"},\"contracts/ronin/staking/DelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IDelegatorStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\\n address payable _delegator = payable(msg.sender);\\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\\n\\n address payable _delegator = payable(msg.sender);\\n uint256 _total;\\n\\n for (uint _i = 0; _i < _consensusAddrs.length; ) {\\n _total += _amounts[_i];\\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n\\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\\n address _delegator = msg.sender;\\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function claimRewards(\\n address[] calldata _consensusAddrList\\n ) external override nonReentrant returns (uint256 _amount) {\\n _amount = _claimRewards(msg.sender, _consensusAddrList);\\n _transferRON(payable(msg.sender), _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegateRewards(\\n address[] calldata _consensusAddrList,\\n address _consensusAddrDst\\n ) external override nonReentrant poolIsActive(_consensusAddrDst) returns (uint256 _amount) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function getRewards(\\n address _user,\\n address[] calldata _poolAddrList\\n ) external view returns (uint256[] memory _rewards) {\\n address _consensusAddr;\\n uint256 _period = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\\n _rewards = new uint256[](_poolAddrList.length);\\n\\n for (uint256 _i = 0; _i < _poolAddrList.length; ) {\\n _consensusAddr = _poolAddrList[_i];\\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Delegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n * Note: This function does not verify the `msg.value` with the amount.\\n *\\n */\\n function _delegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) internal anyExceptPoolAdmin(_pool, _delegator) {\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] + _amount,\\n _pool.stakingTotal + _amount\\n );\\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\\n emit Delegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Undelegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n * - The amount is larger than 0.\\n * - The delegating amount is larger than or equal to the undelegating amount.\\n *\\n * Emits the `Undelegated` event.\\n *\\n * Note: Consider transferring back the amount of RON after calling this function.\\n *\\n */\\n function _undelegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) private anyExceptPoolAdmin(_pool, _delegator) {\\n if (_amount == 0) revert ErrUndelegateZeroAmount();\\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\\n\\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n if (\\n _validatorContract.isValidatorCandidate(_pool.addr) &&\\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\\n ) revert ErrUndelegateTooEarly();\\n\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] - _amount,\\n _pool.stakingTotal - _amount\\n );\\n emit Undelegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Claims rewards from the pools `_poolAddrList`.\\n * Note: This function does not transfer reward to user.\\n */\\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\\n uint256 _period = _currentPeriod();\\n for (uint256 _i = 0; _i < _poolAddrList.length; ) {\\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\\n\\n unchecked {\\n ++_i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n */\\n function _delegateRewards(\\n address _user,\\n address[] calldata _poolAddrList,\\n address _poolAddrDst\\n ) internal returns (uint256 _amount) {\\n _amount = _claimRewards(_user, _poolAddrList);\\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x26d154ed736d57c1ecc6be99ac33274640039975374584bd4a12b8f53b68cb5e\",\"license\":\"MIT\"},\"contracts/ronin/staking/RewardCalculation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IRewardPool.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\n/**\\n * @title RewardCalculation contract\\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\\n */\\nabstract contract RewardCalculation is IRewardPool {\\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\\n /// @dev Mapping from the pool address => user address => the reward info of the user\\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\\n /// @dev Mapping from the pool address => reward pool fields\\n mapping(address => PoolFields) private _stakingPool;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function _getReward(\\n address _poolAddr,\\n address _user,\\n uint256 _latestPeriod,\\n uint256 _latestStakingAmount\\n ) internal view returns (uint256) {\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n\\n if (_reward.lastPeriod == _latestPeriod) {\\n return _reward.debited;\\n }\\n\\n uint256 _aRps;\\n uint256 _lastPeriodReward;\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\\n\\n if (_wrappedArps.lastPeriod > 0) {\\n // Calculates the last period reward if the aRps at the period is set\\n _aRps = _wrappedArps.inner;\\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\\n } else {\\n // Fallbacks to the previous aRps in case the aRps is not set\\n _aRps = _reward.aRps;\\n }\\n\\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\\n }\\n\\n /**\\n * @dev Syncs the user reward.\\n *\\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\\n *\\n * Note: The method should be called whenever the user's staking amount changes.\\n *\\n */\\n function _syncUserReward(address _poolAddr, address _user, uint256 _newStakingAmount) internal {\\n uint256 _period = _currentPeriod();\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n uint256 _lastShares = _pool.shares.inner;\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\\n }\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\\n\\n if (_reward.debited != _debited) {\\n _reward.debited = _debited;\\n emit UserRewardUpdated(_poolAddr, _user, _debited);\\n }\\n\\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\\n _reward.aRps = _pool.aRps;\\n _reward.lastPeriod = _period;\\n\\n if (_pool.shares.inner != _lastShares) {\\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\\n }\\n }\\n\\n /**\\n * @dev Syncs the minimum staking amount of an user in the current period.\\n */\\n function _syncMinStakingAmount(\\n PoolFields storage _pool,\\n UserRewardFields storage _reward,\\n uint256 _latestPeriod,\\n uint256 _newStakingAmount,\\n uint256 _currentStakingAmount\\n ) internal {\\n if (_reward.lastPeriod < _latestPeriod) {\\n _reward.lowestAmount = _currentStakingAmount;\\n }\\n\\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\\n if (_diffAmount > 0) {\\n _reward.lowestAmount = _lowestAmount;\\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\\n _pool.shares.inner -= _diffAmount;\\n }\\n }\\n\\n /**\\n * @dev Claims the settled reward for a specific user.\\n *\\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\\n *\\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\\n *\\n * Note: This method should be called before transferring rewards for the user.\\n *\\n */\\n function _claimReward(address _poolAddr, address _user, uint256 _lastPeriod) internal returns (uint256 _amount) {\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\\n emit RewardClaimed(_poolAddr, _user, _amount);\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n _reward.debited = 0;\\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\\n _reward.lastPeriod = _lastPeriod;\\n _reward.aRps = _stakingPool[_poolAddr].aRps;\\n emit UserRewardUpdated(_poolAddr, _user, 0);\\n }\\n\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function _recordRewards(address[] memory _poolAddrs, uint256[] calldata _rewards, uint256 _period) internal {\\n if (_poolAddrs.length != _rewards.length) {\\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\\n return;\\n }\\n\\n uint256 _rps;\\n uint256 _count;\\n address _poolAddr;\\n uint256 _stakingTotal;\\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\\n address[] memory _conflicted = new address[](_poolAddrs.length);\\n\\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\\n _poolAddr = _poolAddrs[_i];\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n _stakingTotal = getStakingTotal(_poolAddr);\\n\\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\\n unchecked {\\n _conflicted[_count++] = _poolAddr;\\n }\\n continue;\\n }\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\\n }\\n\\n // The rps is 0 if no one stakes for the pool\\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\\n _aRps[_i - _count] = _pool.aRps += _rps;\\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\\n _pool.shares.inner = _stakingTotal;\\n _shares[_i - _count] = _pool.shares.inner;\\n _poolAddrs[_i - _count] = _poolAddr;\\n }\\n\\n if (_count > 0) {\\n assembly {\\n mstore(_conflicted, _count)\\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\\n }\\n emit PoolsUpdateConflicted(_period, _conflicted);\\n }\\n\\n if (_poolAddrs.length > 0) {\\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\\n }\\n }\\n\\n /**\\n * @dev Returns the current period.\\n */\\n function _currentPeriod() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x98f330685911b18730cf85223ecf30f4da2ec19dda5608b5d82c6b5e4f222fa1\",\"license\":\"MIT\"},\"contracts/ronin/staking/Staking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CandidateStaking.sol\\\";\\nimport \\\"./DelegatorStaking.sol\\\";\\n\\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n receive() external payable onlyContract(ContractType.VALIDATOR) {}\\n\\n fallback() external payable onlyContract(ContractType.VALIDATOR) {}\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __minValidatorStakingAmount,\\n uint256 __maxCommissionRate,\\n uint256 __cooldownSecsToUndelegate,\\n uint256 __waitingSecsToRevoke\\n ) external initializer {\\n _setContract(ContractType.VALIDATOR, __validatorContract);\\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\\n _setCommissionRateRange(0, __maxCommissionRate);\\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\\n }\\n\\n function initializeV2() external reinitializer(2) {\\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\\n delete ______deprecatedValidator;\\n }\\n\\n /**\\n * @dev This method only work on testnet, to hotfix the applied validator candidate that is failed.\\n * Should remove this method before deploying it on mainnet.\\n */\\n function tmp_re_applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n uint256 _commissionRate\\n ) external {\\n require(block.chainid == 2021, \\\"E1\\\");\\n require(msg.sender == 0x57832A94810E18c84a5A5E2c4dD67D012ade574F, \\\"E2\\\");\\n\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate(\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable override onlyContract(ContractType.VALIDATOR) {\\n _recordRewards(_consensusAddrs, _rewards, _period);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execDeductStakingAmount(\\n address _consensusAddr,\\n uint256 _amount\\n ) external override onlyContract(ContractType.VALIDATOR) returns (uint256 _actualDeductingAmount) {\\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\\n address payable _validatorContractAddr = payable(msg.sender);\\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\\n emit StakingAmountDeductFailed(\\n _consensusAddr,\\n _validatorContractAddr,\\n _actualDeductingAmount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @inheritdoc RewardCalculation\\n */\\n function _currentPeriod() internal view virtual override returns (uint256) {\\n return IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\\n }\\n\\n /**\\n * @inheritdoc CandidateStaking\\n */\\n function _deductStakingAmount(\\n PoolDetail storage _pool,\\n uint256 _amount\\n ) internal override returns (uint256 _actualDeductingAmount) {\\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\\n\\n _pool.stakingAmount -= _actualDeductingAmount;\\n _changeDelegatingAmount(\\n _pool,\\n _pool.admin,\\n _pool.stakingAmount,\\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\\n );\\n emit Unstaked(_pool.addr, _actualDeductingAmount);\\n }\\n}\\n\",\"keccak256\":\"0x41e527efa72cfde0b60112adc6bbc631539521370d1cc9a12a7d17336ddf3829\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\",\"keccak256\":\"0x3914292a405307cba9e93085edcaf5f1203ca2d55abf998bf1d2af1e86f5a4c6\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD\\n}\\n\",\"keccak256\":\"0xf72feff9afafcb5cadc1b05c6e0b998ea5d66c7ece57c3e482e560d0a1bb4079\",\"license\":\"MIT\"},\"contracts/utils/DeprecatedSlots.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Deprecated Contracts\\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\\n * They provide functionality related to various aspects of a smart contract but have been marked\\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\\n */\\ncontract HasSlashIndicatorDeprecated {\\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\\n address internal ______deprecatedSlashIndicator;\\n}\\n\\ncontract HasStakingVestingDeprecated {\\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\\n address internal ______deprecatedStakingVesting;\\n}\\n\\ncontract HasBridgeDeprecated {\\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\\n address internal ______deprecatedBridge;\\n}\\n\\ncontract HasValidatorDeprecated {\\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\\n address internal ______deprecatedValidator;\\n}\\n\\ncontract HasStakingDeprecated {\\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\\n address internal ______deprecatedStakingContract;\\n}\\n\\ncontract HasMaintenanceDeprecated {\\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\\n address internal ______deprecatedMaintenance;\\n}\\n\\ncontract HasTrustedOrgDeprecated {\\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\\n address internal ______deprecatedTrustedOrg;\\n}\\n\\ncontract HasGovernanceAdminDeprecated {\\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\\n address internal ______deprecatedGovernanceAdmin;\\n}\\n\\ncontract HasBridgeTrackingDeprecated {\\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\\n address internal ______deprecatedBridgeTracking;\\n}\\n\",\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE\\n}\\n\",\"keccak256\":\"0xa98cec38c640c4e37f475debbcd366226f1188c3f5ea6e29de768bd33e021873\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b5060016000556200002162000027565b620000e9565b60d154610100900460ff1615620000945760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60d15460ff9081161015620000e75760d1805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61398f80620000f96000396000f3fe60806040526004361061023f5760003560e01c80636bd8f8041161012e578063aa15a6fd116100ab578063d01b8eed1161006f578063d01b8eed146106e6578063de981f1b14610757578063e22d1c9d14610777578063f92ad21914610797578063f9f031df146107b757610251565b8063aa15a6fd1461062d578063acd79c461461064d578063af24542914610660578063c2a672e014610675578063c50870031461069557610251565b8063909791dd116100f2578063909791dd1461059857806391f8723f146105ad578063924f081e146105cd5780639488e4e9146105ed578063969ffc141461060d57610251565b80636bd8f804146104df57806376664b65146104ff578063865e6fd31461051f578063888b9ae91461053f578063895ab7421461055f57610251565b806342e0c408116101bc5780635c19a95c116101805780635c19a95c146104605780635cd8a76b146104735780636558954f14610488578063679a6e431461049f5780636b091695146104bf57610251565b806342e0c4081461038d57806342ef3c34146103d85780634530d202146103f85780634d99dd1614610420578063574734471461044057610251565b80631658c86e116102035780631658c86e1461030757806326476204146103275780632715805e1461033a5780632baae1251461035a5780633d8e846e1461036d57610251565b8063038278841461025c5780630682e8fa14610285578063095f64751461029a578063097e4a9d146102c75780630dccaf46146102e757610251565b3661025157600861024f816107d7565b005b600861024f816107d7565b34801561026857600080fd5b506102726104b081565b6040519081526020015b60405180910390f35b34801561029157600080fd5b50603854610272565b3480156102a657600080fd5b506102ba6102b5366004613102565b61082f565b60405161027c91906131a8565b3480156102d357600080fd5b506102726102e23660046131d0565b610967565b3480156102f357600080fd5b5061024f610302366004613226565b6109ed565b34801561031357600080fd5b5061024f610322366004613277565b610af0565b61024f610335366004613277565b610b60565b34801561034657600080fd5b5061027261035536600461329b565b610b99565b61024f610368366004613226565b610c2a565b34801561037957600080fd5b506102ba6103883660046132c7565b610d78565b34801561039957600080fd5b506103c86103a8366004613277565b6001600160a01b039081166000908152603a602052604090205416151590565b604051901515815260200161027c565b3480156103e457600080fd5b506102ba6103f336600461331b565b610ea6565b34801561040457600080fd5b50606e54606d546040805192835260208301919091520161027c565b34801561042c57600080fd5b5061024f61043b36600461329b565b610f72565b34801561044c57600080fd5b5061024f61045b36600461335c565b610fee565b61024f61046e366004613277565b611000565b34801561047f57600080fd5b5061024f61106e565b34801561049457600080fd5b506102726201518081565b3480156104ab57600080fd5b5061024f6104ba36600461337e565b61112d565b3480156104cb57600080fd5b506102726104da366004613397565b61113e565b3480156104eb57600080fd5b5061024f6104fa3660046133d0565b611160565b34801561050b57600080fd5b5061027261051a366004613397565b6111e5565b34801561052b57600080fd5b5061024f61053a366004613420565b611214565b34801561054b57600080fd5b5061024f61055a36600461337e565b61122f565b34801561056b57600080fd5b5061027261057a366004613277565b6001600160a01b031660009081526037602052604090206003015490565b3480156105a457600080fd5b50606c54610272565b3480156105b957600080fd5b506102ba6105c836600461331b565b611240565b3480156105d957600080fd5b5061024f6105e836600461343c565b6112e0565b3480156105f957600080fd5b5061024f610608366004613102565b6113ba565b34801561061957600080fd5b5061024f61062836600461337e565b6114e9565b34801561063957600080fd5b5061024f610648366004613277565b6114fa565b61024f61065b366004613471565b61156a565b34801561066c57600080fd5b50603954610272565b34801561068157600080fd5b5061024f61069036600461329b565b6115be565b3480156106a157600080fd5b506106ce6106b0366004613277565b6001600160a01b039081166000908152603a60205260409020541690565b6040516001600160a01b03909116815260200161027c565b3480156106f257600080fd5b50610732610701366004613277565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604080516001600160a01b03909416845260208401929092529082015260600161027c565b34801561076357600080fd5b506106ce6107723660046134e4565b611678565b34801561078357600080fd5b5061024f6107923660046134ff565b6116f3565b3480156107a357600080fd5b5061024f6107b236600461354a565b6118b7565b3480156107c357600080fd5b506102726107d236600461331b565b6119ae565b6107e081611678565b6001600160a01b0316336001600160a01b03161461082c576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610823939291906135b8565b60405180910390fd5b50565b6060838214610851576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b03811115610869576108696135ef565b604051908082528060200260200182016040528015610892578160200160208202803683370190505b50905060005b815181101561095e57603760008787848181106108b7576108b7613605565b90506020020160208101906108cc9190613277565b6001600160a01b03166001600160a01b03168152602001908152602001600020600401600085858481811061090357610903613605565b90506020020160208101906109189190613277565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061094b5761094b613605565b6020908102919091010152600101610898565b50949350505050565b600060026000540361098b5760405162461bcd60e51b81526004016108239061361b565b60026000558161099a81611a2e565b336000908152603a60205260409020546001600160a01b0316156109d357604051632fc6bfb160e21b8152336004820152602401610823565b6109df33868686611acc565b600160005595945050505050565b466107e514610a235760405162461bcd60e51b8152602060048201526002602482015261453160f01b6044820152606401610823565b7357832a94810e18c84a5a5e2c4dd67d012ade574f3314610a6b5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610823565b610a756008611678565b60405163f883afaf60e01b81526001600160a01b0386811660048301528581166024830152848116604483015260648201849052919091169063f883afaf906084015b600060405180830381600087803b158015610ad257600080fd5b505af1158015610ae6573d6000803e3d6000fd5b5050505050505050565b80610afa81611a2e565b6001600160a01b038216600090815260376020526040902033610b1d8282611b39565b610b276008611678565b60395460405163dd716ad360e01b81526001600160a01b038781166004830152602482019290925291169063dd716ad390604401610ab8565b610b68611b69565b80610b7281611a2e565b6001600160a01b0382166000908152603760205260409020610b95903334611b8c565b5050565b60006008610ba6816107d7565b6001600160a01b0384166000908152603760205260409020610bc89084611c37565b915033610bd58184611cd4565b610c2257604080518481524760208201526001600160a01b0380841692908816917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b505092915050565b600260005403610c4c5760405162461bcd60e51b81526004016108239061361b565b60026000908155338152603a60205260409020546001600160a01b031615610c8957604051632fc6bfb160e21b8152336004820152602401610823565b606d54811180610c9a5750606e5481105b15610cb857604051631b8454a360e21b815260040160405180910390fd5b3433610cc8818787878787611d30565b6001600160a01b0380861660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052610d2a818385611b8c565b816001600160a01b0316866001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a3505060016000555050505050565b6060600080610d876008611678565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de89190613652565b9050836001600160401b03811115610e0257610e026135ef565b604051908082528060200260200182016040528015610e2b578160200160208202803683370190505b50925060005b84811015610e9c57858582818110610e4b57610e4b613605565b9050602002016020810190610e609190613277565b9250610e77838884610e72878c6111e5565b611f64565b848281518110610e8957610e89613605565b6020908102919091010152600101610e31565b5050509392505050565b6060816001600160401b03811115610ec057610ec06135ef565b604051908082528060200260200182016040528015610ee9578160200160208202803683370190505b50905060005b82811015610f6b5760376000858584818110610f0d57610f0d613605565b9050602002016020810190610f229190613277565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610f5857610f58613605565b6020908102919091010152600101610eef565b5092915050565b600260005403610f945760405162461bcd60e51b81526004016108239061361b565b600260009081556001600160a01b03831681526037602052604090203390610fbd908284612060565b610fc78183612298565b610fe457604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b610ff66122e0565b610b95828261233a565b611008611b69565b8061101281611a2e565b336000908152603a60205260409020546001600160a01b03161561104b57604051632fc6bfb160e21b8152336004820152602401610823565b6001600160a01b0382166000908152603760205260409020610b959033346123ae565b60d154600290610100900460ff16158015611090575060d15460ff8083169116105b6110ac5760405162461bcd60e51b81526004016108239061366b565b60d1805461ffff191660ff8316176101001790556036546110d8906008906001600160a01b031661245d565b603680546001600160a01b031916905560d1805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b6111356122e0565b61082c81612501565b6000611157838361114d612536565b610e7287876111e5565b90505b92915050565b6002600054036111825760405162461bcd60e51b81526004016108239061361b565b60026000558161119181611a2e565b6001600160a01b038416600090815260376020526040902033906111b6908285612060565b6001600160a01b03841660009081526037602052604090206111d99082856123ae565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b61121c6122e0565b611225816125a8565b610b95828261245d565b6112376122e0565b61082c816125de565b6060816001600160401b0381111561125a5761125a6135ef565b604051908082528060200260200182016040528015611283578160200160208202803683370190505b50905060005b82811015610f6b576112bb8484838181106112a6576112a6613605565b905060200201602081019061057a9190613277565b8282815181106112cd576112cd613605565b6020908102919091010152600101611289565b826112ea81611a2e565b6001600160a01b03841660009081526037602052604090203361130d8282611b39565b606d5484118061131e5750606e5484105b1561133c57604051631b8454a360e21b815260040160405180910390fd5b6113466008611678565b60405163e5125a1d60e01b81526001600160a01b0388811660048301526024820188905260448201879052919091169063e5125a1d906064015b600060405180830381600087803b15801561139a57600080fd5b505af11580156113ae573d6000803e3d6000fd5b50505050505050505050565b6002600054036113dc5760405162461bcd60e51b81526004016108239061361b565b60026000558215806113ee5750828114155b1561140c576040516376081a7b60e11b815260040160405180910390fd5b336000805b858110156114b45784848281811061142b5761142b613605565b905060200201358261143d91906136cf565b91506114ac6037600089898581811061145857611458613605565b905060200201602081019061146d9190613277565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106114a0576114a0613605565b90506020020135612060565b600101611411565b506114bf8282612298565b6114dc57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b6114f16122e0565b61082c81612613565b8061150481611a2e565b6001600160a01b0382166000908152603760205260409020336115278282611b39565b6115316008611678565b60395460405163a7c2f11960e01b81526001600160a01b038781166004830152602482019290925291169063a7c2f11990604401610ab8565b6008611575816107d7565b6115b6868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250879150869050612648565b505050505050565b6002600054036115e05760405162461bcd60e51b81526004016108239061361b565b6002600055816115ef81611a2e565b81600003611610576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260408120600281015433929061163b9086906136e2565b9050606c548110156116605760405163ef0a995760e01b815260040160405180910390fd5b61166b828487612a76565b6114bf83866104b0612b62565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600d8111156116af576116af61358e565b60ff1681526020810191909152604001600020546001600160a01b03169050806116ee578160405163409140df60e11b815260040161082391906136f5565b919050565b60086116fe816107d7565b82156118b15760005b838110156118765760006037600087878581811061172757611727613605565b905060200201602081019061173c9190613277565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b031916905560028101549091508015611803576117938282611c37565b5060018201546117af906001600160a01b0316826104b0612b62565b6118035760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b600061184388888681811061181a5761181a613605565b905060200201602081019061182f9190613277565b60018501546001600160a01b031688612bc2565b90508015611868576001830154611866906001600160a01b0316826104b0612b62565b505b836001019350505050611707565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d884846040516118a8929190613703565b60405180910390a15b50505050565b60d154610100900460ff16158080156118d7575060d154600160ff909116105b806118f15750303b1580156118f1575060d15460ff166001145b61190d5760405162461bcd60e51b81526004016108239061366b565b60d1805460ff1916600117905580156119305760d1805461ff0019166101001790555b61193b60088761245d565b61194485612501565b61194f60008561233a565b611958836125de565b61196182612613565b80156115b65760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b60006002600054036119d25760405162461bcd60e51b81526004016108239061361b565b6002600081905550611a1733848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612cd492505050565b9050611a233382612d25565b600160005592915050565b611a386008611678565b604051635061f96960e11b81526001600160a01b038381166004830152919091169063a0c3f2d290602401602060405180830381865afa158015611a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa49190613751565b61082c57604051630fd0c64560e11b81526001600160a01b0382166004820152602401610823565b6000611b0b85858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612cd492505050565b6001600160a01b0383166000908152603760205260409020909150611b319086836123ae565b949350505050565b60018201546001600160a01b03828116911614610b9557604051637bc65bd760e11b815260040160405180910390fd5b34600003611b8a57604051636dfcbde560e11b815260040160405180910390fd5b565b8282611b988282611b39565b82856002016000828254611bac91906136cf565b92505081905550611bd285858760020154868960030154611bcd91906136cf565b612d5a565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611c289086815260200190565b60405180910390a25050505050565b6000611c47836002015483612d95565b905080836002016000828254611c5d91906136e2565b9091555050600183015460028401546003850154611c8d9286926001600160a01b0390911691611bcd9086612dab565b82546040518281526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611d21576040519150601f19603f3d011682016040523d82523d6000602084013e611d26565b606091505b5090949350505050565b611d3e8660006104b0612b62565b611d89576040805163338f030160e01b81526001600160a01b03881660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610823565b611d978360006104b0612b62565b611de0576040805163338f030160e01b81526001600160a01b038516600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610823565b606c54811015611e0357604051630a8d7fa760e21b815260040160405180910390fd5b846001600160a01b0316866001600160a01b0316141580611e365750826001600160a01b0316856001600160a01b031614155b15611e545760405163dc1d04ff60e01b815260040160405180910390fd5b6040805160028082526060820183526000926020830190803683370190505090508681600081518110611e8957611e89613605565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110611ebd57611ebd613605565b60200260200101906001600160a01b031690816001600160a01b031681525050611ee681612dc5565b15611f1257604051630d697db160e11b81526001600160e01b0319600035166004820152602401610823565b50611f1d6008611678565b60405163f883afaf60e01b81526001600160a01b0387811660048301528681166024830152858116604483015260648201859052919091169063f883afaf90608401611380565b6001600160a01b03808516600090815260026020908152604080832093871683529290529081206003810154849003611f9f57549050611b31565b6001600160a01b0386166000908152600360208181526040808420600180845282862094870154865293909252832091820154839290156120045780546001860154909450611fee90856136e2565b8560020154611ffd9190613773565b925061200c565b846001015493505b815460009061201c9086906136e2565b6120269089613773565b9050670de0b6b3a764000061203b82866136cf565b612045919061378a565b865461205191906136cf565b9b9a5050505050505050505050565b828261206c8282612e64565b8260000361208d57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020548311156120c857604051630695534560e31b815260040160405180910390fd5b60006120d46008611678565b8654604051635061f96960e11b81526001600160a01b03918216600482015291925082169063a0c3f2d290602401602060405180830381865afa15801561211f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121439190613751565b80156121bd575085546040516328bde1e160e01b81526001600160a01b039182166004820152908216906328bde1e19060240160e060405180830381865afa158015612193573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b791906137b7565b60a00151155b80156121f057506038546001600160a01b038616600090815260058801602052604090205442916121ed916136cf565b10155b1561220e5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b038516600090815260048701602052604090205461224c908790879061223c9088906136e2565b878a60030154611bcd91906136e2565b85546040518581526001600160a01b03918216918716907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c9060200160405180910390a3505050505050565b6000814710156122d6576040516302631c4f60e61b81526001600160e01b031960003516600482015247602482015260448101839052606401610823565b6111578383611cd4565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611b8a576000356001600160e01b0319166001604051620f948f60ea1b8152600401610823929190613862565b61271081118061234957508082115b1561236757604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c14910160405180910390a15050565b82826123ba8282612e64565b6001600160a01b03841660009081526004860160205260409020546123f890869086906123e89087906136cf565b868960030154611bcd91906136cf565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b9061244e9087815260200190565b60405180910390a35050505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600d8111156124935761249361358e565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600d8111156124d4576124d461358e565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be290602001611122565b60006125426008611678565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa15801561257f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a39190613652565b905090565b806001600160a01b03163b60000361082c57604051630bfc64a360e21b81526001600160a01b0382166004820152602401610823565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a90602001611122565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c67890602001611122565b8351821461269157807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a5858585604051612684939291906138c9565b60405180910390a26118b1565b600080600080600088516001600160401b038111156126b2576126b26135ef565b6040519080825280602002602001820160405280156126db578160200160208202803683370190505b509050600089516001600160401b038111156126f9576126f96135ef565b604051908082528060200260200182016040528015612722578160200160208202803683370190505b50905060008a516001600160401b03811115612740576127406135ef565b604051908082528060200260200182016040528015612769578160200160208202803683370190505b50905060005b8b518110156129dc578b818151811061278a5761278a613605565b6020908102919091018101516001600160a01b038116600090815260038084526040808320603790955290912001549097506001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a900361282b57868389806001019a508151811061280557612805613605565b60200260200101906001600160a01b031690816001600160a01b031681525050506129ca565b60028101548a111561285957604080518082019091528681526020018a905260018101869055600281018a90555b6001810154156128a35760018101548c8c8481811061287a5761287a613605565b90506020020135670de0b6b3a76400006128949190613773565b61289e919061378a565b6128a6565b60005b9850888160000160008282546128bc91906136cf565b91829055509050856128ce8a856136e2565b815181106128de576128de613605565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461297191906136e2565b8151811061298157612981613605565b6020908102919091010152868d6129988a856136e2565b815181106129a8576129a8613605565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806129d481613913565b91505061276f565b508515612a2557858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a382604051612a1c919061392c565b60405180910390a25b8a5115612a6957877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c8585604051612a609392919061393f565b60405180910390a25b5050505050505050505050565b8282612a828282611b39565b8460020154831115612aa757604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612ad0916136cf565b1115612aef576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612b0391906136e2565b92505081905550612b2485858760020154868960030154611bcd91906136e2565b84546040518481526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7590602001611c28565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612bb2576040519150601f19603f3d011682016040523d82523d6000602084013e612bb7565b606091505b509095945050505050565b600080612bcf85856111e5565b9050612bdd85858584611f64565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612c2491815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612c6e9082868580612e94565b60038181018590556001600160a01b03878116600081815260209384526040808220546001870155519081529188169290917faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad910160405180910390a350509392505050565b600080612cdf612536565b905060005b8351811015610c2257612d11848281518110612d0257612d02613605565b60200260200101518684612bc2565b612d1b90846136cf565b9250600101612ce4565b612d2f8282612298565b610b95576040516303b97b7760e41b81526001600160e01b0319600035166004820152602401610823565b8354612d70906001600160a01b03168484612f26565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b6000818310612da45781611157565b5090919050565b6000818311612dbb576000611157565b61115782846136e2565b60008151600003612dd857506000919050565b60005b6001835103811015612e5b57600181015b8351811015612e5257838181518110612e0757612e07613605565b60200260200101516001600160a01b0316848381518110612e2a57612e2a613605565b60200260200101516001600160a01b031603612e4a575060019392505050565b600101612dec565b50600101612ddb565b50600092915050565b60018201546001600160a01b03808316911603610b9557604051639feb934760e01b815260040160405180910390fd5b8284600301541015612ea857600284018190555b6000612eb8856002015484612d95565b90506000818660020154612ecc91906136e2565b90508015612f1d57600286018290556001870154811115612f00576040516352e521bf60e11b815260040160405180910390fd5b80876001016000016000828254612f1791906136e2565b90915550505b50505050505050565b6000612f30612536565b6001600160a01b0385166000908152600360205260409020600181015460028201549293509091831115612fa4576040518060400160405280612f8b886001600160a01b031660009081526037602052604090206003015490565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090612fd688886111e5565b90506000612fe689898885611f64565b83549091508114613038578083556040518181526001600160a01b0389811691908b16907faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad9060200160405180910390a35b6130458584888a86612e94565b84546001808501919091556003840187905585015484146130ac57886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516130a391815260200190565b60405180910390a35b505050505050505050565b60008083601f8401126130c957600080fd5b5081356001600160401b038111156130e057600080fd5b6020830191508360208260051b85010111156130fb57600080fd5b9250929050565b6000806000806040858703121561311857600080fd5b84356001600160401b038082111561312f57600080fd5b61313b888389016130b7565b9096509450602087013591508082111561315457600080fd5b50613161878288016130b7565b95989497509550505050565b600081518084526020808501945080840160005b8381101561319d57815187529582019590820190600101613181565b509495945050505050565b602081526000611157602083018461316d565b6001600160a01b038116811461082c57600080fd5b6000806000604084860312156131e557600080fd5b83356001600160401b038111156131fb57600080fd5b613207868287016130b7565b909450925050602084013561321b816131bb565b809150509250925092565b6000806000806080858703121561323c57600080fd5b8435613247816131bb565b93506020850135613257816131bb565b92506040850135613267816131bb565b9396929550929360600135925050565b60006020828403121561328957600080fd5b8135613294816131bb565b9392505050565b600080604083850312156132ae57600080fd5b82356132b9816131bb565b946020939093013593505050565b6000806000604084860312156132dc57600080fd5b83356132e7816131bb565b925060208401356001600160401b0381111561330257600080fd5b61330e868287016130b7565b9497909650939450505050565b6000806020838503121561332e57600080fd5b82356001600160401b0381111561334457600080fd5b613350858286016130b7565b90969095509350505050565b6000806040838503121561336f57600080fd5b50508035926020909101359150565b60006020828403121561339057600080fd5b5035919050565b600080604083850312156133aa57600080fd5b82356133b5816131bb565b915060208301356133c5816131bb565b809150509250929050565b6000806000606084860312156133e557600080fd5b83356133f0816131bb565b92506020840135613400816131bb565b929592945050506040919091013590565b8035600e81106116ee57600080fd5b6000806040838503121561343357600080fd5b6133b583613411565b60008060006060848603121561345157600080fd5b833561345c816131bb565b95602085013595506040909401359392505050565b60008060008060006060868803121561348957600080fd5b85356001600160401b03808211156134a057600080fd5b6134ac89838a016130b7565b909750955060208801359150808211156134c557600080fd5b506134d2888289016130b7565b96999598509660400135949350505050565b6000602082840312156134f657600080fd5b61115782613411565b60008060006040848603121561351457600080fd5b83356001600160401b0381111561352a57600080fd5b613536868287016130b7565b909790965060209590950135949350505050565b600080600080600060a0868803121561356257600080fd5b853561356d816131bb565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052602160045260246000fd5b600e81106135b4576135b461358e565b9052565b6001600160e01b031984168152606081016135d660208301856135a4565b6001600160a01b03929092166040919091015292915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561366457600080fd5b5051919050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561115a5761115a6136b9565b8181038181111561115a5761115a6136b9565b6020810161115a82846135a4565b60208082528181018390526000908460408401835b8681101561374657823561372b816131bb565b6001600160a01b031682529183019190830190600101613718565b509695505050505050565b60006020828403121561376357600080fd5b8151801515811461329457600080fd5b808202811582820484141761115a5761115a6136b9565b6000826137a757634e487b7160e01b600052601260045260246000fd5b500490565b80516116ee816131bb565b600060e082840312156137c957600080fd5b60405160e081018181106001600160401b03821117156137f957634e487b7160e01b600052604160045260246000fd5b604052613805836137ac565b8152613813602084016137ac565b6020820152613824604084016137ac565b6040820152613835606084016137ac565b60608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b6001600160e01b03198316815260408101600983106138835761388361358e565b8260208301529392505050565b600081518084526020808501945080840160005b8381101561319d5781516001600160a01b0316875295820195908201906001016138a4565b6040815260006138dc6040830186613890565b82810360208401528381526001600160fb1b038411156138fb57600080fd5b8360051b808660208401370160200195945050505050565b600060018201613925576139256136b9565b5060010190565b6020815260006111576020830184613890565b6060815260006139526060830186613890565b8281036020840152613964818661316d565b90508281036040840152613978818561316d565b969550505050505056fea164736f6c6343000811000a", - "deployedBytecode": "0x60806040526004361061023f5760003560e01c80636bd8f8041161012e578063aa15a6fd116100ab578063d01b8eed1161006f578063d01b8eed146106e6578063de981f1b14610757578063e22d1c9d14610777578063f92ad21914610797578063f9f031df146107b757610251565b8063aa15a6fd1461062d578063acd79c461461064d578063af24542914610660578063c2a672e014610675578063c50870031461069557610251565b8063909791dd116100f2578063909791dd1461059857806391f8723f146105ad578063924f081e146105cd5780639488e4e9146105ed578063969ffc141461060d57610251565b80636bd8f804146104df57806376664b65146104ff578063865e6fd31461051f578063888b9ae91461053f578063895ab7421461055f57610251565b806342e0c408116101bc5780635c19a95c116101805780635c19a95c146104605780635cd8a76b146104735780636558954f14610488578063679a6e431461049f5780636b091695146104bf57610251565b806342e0c4081461038d57806342ef3c34146103d85780634530d202146103f85780634d99dd1614610420578063574734471461044057610251565b80631658c86e116102035780631658c86e1461030757806326476204146103275780632715805e1461033a5780632baae1251461035a5780633d8e846e1461036d57610251565b8063038278841461025c5780630682e8fa14610285578063095f64751461029a578063097e4a9d146102c75780630dccaf46146102e757610251565b3661025157600861024f816107d7565b005b600861024f816107d7565b34801561026857600080fd5b506102726104b081565b6040519081526020015b60405180910390f35b34801561029157600080fd5b50603854610272565b3480156102a657600080fd5b506102ba6102b5366004613102565b61082f565b60405161027c91906131a8565b3480156102d357600080fd5b506102726102e23660046131d0565b610967565b3480156102f357600080fd5b5061024f610302366004613226565b6109ed565b34801561031357600080fd5b5061024f610322366004613277565b610af0565b61024f610335366004613277565b610b60565b34801561034657600080fd5b5061027261035536600461329b565b610b99565b61024f610368366004613226565b610c2a565b34801561037957600080fd5b506102ba6103883660046132c7565b610d78565b34801561039957600080fd5b506103c86103a8366004613277565b6001600160a01b039081166000908152603a602052604090205416151590565b604051901515815260200161027c565b3480156103e457600080fd5b506102ba6103f336600461331b565b610ea6565b34801561040457600080fd5b50606e54606d546040805192835260208301919091520161027c565b34801561042c57600080fd5b5061024f61043b36600461329b565b610f72565b34801561044c57600080fd5b5061024f61045b36600461335c565b610fee565b61024f61046e366004613277565b611000565b34801561047f57600080fd5b5061024f61106e565b34801561049457600080fd5b506102726201518081565b3480156104ab57600080fd5b5061024f6104ba36600461337e565b61112d565b3480156104cb57600080fd5b506102726104da366004613397565b61113e565b3480156104eb57600080fd5b5061024f6104fa3660046133d0565b611160565b34801561050b57600080fd5b5061027261051a366004613397565b6111e5565b34801561052b57600080fd5b5061024f61053a366004613420565b611214565b34801561054b57600080fd5b5061024f61055a36600461337e565b61122f565b34801561056b57600080fd5b5061027261057a366004613277565b6001600160a01b031660009081526037602052604090206003015490565b3480156105a457600080fd5b50606c54610272565b3480156105b957600080fd5b506102ba6105c836600461331b565b611240565b3480156105d957600080fd5b5061024f6105e836600461343c565b6112e0565b3480156105f957600080fd5b5061024f610608366004613102565b6113ba565b34801561061957600080fd5b5061024f61062836600461337e565b6114e9565b34801561063957600080fd5b5061024f610648366004613277565b6114fa565b61024f61065b366004613471565b61156a565b34801561066c57600080fd5b50603954610272565b34801561068157600080fd5b5061024f61069036600461329b565b6115be565b3480156106a157600080fd5b506106ce6106b0366004613277565b6001600160a01b039081166000908152603a60205260409020541690565b6040516001600160a01b03909116815260200161027c565b3480156106f257600080fd5b50610732610701366004613277565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604080516001600160a01b03909416845260208401929092529082015260600161027c565b34801561076357600080fd5b506106ce6107723660046134e4565b611678565b34801561078357600080fd5b5061024f6107923660046134ff565b6116f3565b3480156107a357600080fd5b5061024f6107b236600461354a565b6118b7565b3480156107c357600080fd5b506102726107d236600461331b565b6119ae565b6107e081611678565b6001600160a01b0316336001600160a01b03161461082c576000356001600160e01b03191681336040516320e0f98d60e21b8152600401610823939291906135b8565b60405180910390fd5b50565b6060838214610851576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b03811115610869576108696135ef565b604051908082528060200260200182016040528015610892578160200160208202803683370190505b50905060005b815181101561095e57603760008787848181106108b7576108b7613605565b90506020020160208101906108cc9190613277565b6001600160a01b03166001600160a01b03168152602001908152602001600020600401600085858481811061090357610903613605565b90506020020160208101906109189190613277565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061094b5761094b613605565b6020908102919091010152600101610898565b50949350505050565b600060026000540361098b5760405162461bcd60e51b81526004016108239061361b565b60026000558161099a81611a2e565b336000908152603a60205260409020546001600160a01b0316156109d357604051632fc6bfb160e21b8152336004820152602401610823565b6109df33868686611acc565b600160005595945050505050565b466107e514610a235760405162461bcd60e51b8152602060048201526002602482015261453160f01b6044820152606401610823565b7357832a94810e18c84a5a5e2c4dd67d012ade574f3314610a6b5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610823565b610a756008611678565b60405163f883afaf60e01b81526001600160a01b0386811660048301528581166024830152848116604483015260648201849052919091169063f883afaf906084015b600060405180830381600087803b158015610ad257600080fd5b505af1158015610ae6573d6000803e3d6000fd5b5050505050505050565b80610afa81611a2e565b6001600160a01b038216600090815260376020526040902033610b1d8282611b39565b610b276008611678565b60395460405163dd716ad360e01b81526001600160a01b038781166004830152602482019290925291169063dd716ad390604401610ab8565b610b68611b69565b80610b7281611a2e565b6001600160a01b0382166000908152603760205260409020610b95903334611b8c565b5050565b60006008610ba6816107d7565b6001600160a01b0384166000908152603760205260409020610bc89084611c37565b915033610bd58184611cd4565b610c2257604080518481524760208201526001600160a01b0380841692908816917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b505092915050565b600260005403610c4c5760405162461bcd60e51b81526004016108239061361b565b60026000908155338152603a60205260409020546001600160a01b031615610c8957604051632fc6bfb160e21b8152336004820152602401610823565b606d54811180610c9a5750606e5481105b15610cb857604051631b8454a360e21b815260040160405180910390fd5b3433610cc8818787878787611d30565b6001600160a01b0380861660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052610d2a818385611b8c565b816001600160a01b0316866001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a3505060016000555050505050565b6060600080610d876008611678565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de89190613652565b9050836001600160401b03811115610e0257610e026135ef565b604051908082528060200260200182016040528015610e2b578160200160208202803683370190505b50925060005b84811015610e9c57858582818110610e4b57610e4b613605565b9050602002016020810190610e609190613277565b9250610e77838884610e72878c6111e5565b611f64565b848281518110610e8957610e89613605565b6020908102919091010152600101610e31565b5050509392505050565b6060816001600160401b03811115610ec057610ec06135ef565b604051908082528060200260200182016040528015610ee9578160200160208202803683370190505b50905060005b82811015610f6b5760376000858584818110610f0d57610f0d613605565b9050602002016020810190610f229190613277565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610f5857610f58613605565b6020908102919091010152600101610eef565b5092915050565b600260005403610f945760405162461bcd60e51b81526004016108239061361b565b600260009081556001600160a01b03831681526037602052604090203390610fbd908284612060565b610fc78183612298565b610fe457604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b610ff66122e0565b610b95828261233a565b611008611b69565b8061101281611a2e565b336000908152603a60205260409020546001600160a01b03161561104b57604051632fc6bfb160e21b8152336004820152602401610823565b6001600160a01b0382166000908152603760205260409020610b959033346123ae565b60d154600290610100900460ff16158015611090575060d15460ff8083169116105b6110ac5760405162461bcd60e51b81526004016108239061366b565b60d1805461ffff191660ff8316176101001790556036546110d8906008906001600160a01b031661245d565b603680546001600160a01b031916905560d1805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b6111356122e0565b61082c81612501565b6000611157838361114d612536565b610e7287876111e5565b90505b92915050565b6002600054036111825760405162461bcd60e51b81526004016108239061361b565b60026000558161119181611a2e565b6001600160a01b038416600090815260376020526040902033906111b6908285612060565b6001600160a01b03841660009081526037602052604090206111d99082856123ae565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b61121c6122e0565b611225816125a8565b610b95828261245d565b6112376122e0565b61082c816125de565b6060816001600160401b0381111561125a5761125a6135ef565b604051908082528060200260200182016040528015611283578160200160208202803683370190505b50905060005b82811015610f6b576112bb8484838181106112a6576112a6613605565b905060200201602081019061057a9190613277565b8282815181106112cd576112cd613605565b6020908102919091010152600101611289565b826112ea81611a2e565b6001600160a01b03841660009081526037602052604090203361130d8282611b39565b606d5484118061131e5750606e5484105b1561133c57604051631b8454a360e21b815260040160405180910390fd5b6113466008611678565b60405163e5125a1d60e01b81526001600160a01b0388811660048301526024820188905260448201879052919091169063e5125a1d906064015b600060405180830381600087803b15801561139a57600080fd5b505af11580156113ae573d6000803e3d6000fd5b50505050505050505050565b6002600054036113dc5760405162461bcd60e51b81526004016108239061361b565b60026000558215806113ee5750828114155b1561140c576040516376081a7b60e11b815260040160405180910390fd5b336000805b858110156114b45784848281811061142b5761142b613605565b905060200201358261143d91906136cf565b91506114ac6037600089898581811061145857611458613605565b905060200201602081019061146d9190613277565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106114a0576114a0613605565b90506020020135612060565b600101611411565b506114bf8282612298565b6114dc57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b6114f16122e0565b61082c81612613565b8061150481611a2e565b6001600160a01b0382166000908152603760205260409020336115278282611b39565b6115316008611678565b60395460405163a7c2f11960e01b81526001600160a01b038781166004830152602482019290925291169063a7c2f11990604401610ab8565b6008611575816107d7565b6115b6868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250879150869050612648565b505050505050565b6002600054036115e05760405162461bcd60e51b81526004016108239061361b565b6002600055816115ef81611a2e565b81600003611610576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260408120600281015433929061163b9086906136e2565b9050606c548110156116605760405163ef0a995760e01b815260040160405180910390fd5b61166b828487612a76565b6114bf83866104b0612b62565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600d8111156116af576116af61358e565b60ff1681526020810191909152604001600020546001600160a01b03169050806116ee578160405163409140df60e11b815260040161082391906136f5565b919050565b60086116fe816107d7565b82156118b15760005b838110156118765760006037600087878581811061172757611727613605565b905060200201602081019061173c9190613277565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b031916905560028101549091508015611803576117938282611c37565b5060018201546117af906001600160a01b0316826104b0612b62565b6118035760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b600061184388888681811061181a5761181a613605565b905060200201602081019061182f9190613277565b60018501546001600160a01b031688612bc2565b90508015611868576001830154611866906001600160a01b0316826104b0612b62565b505b836001019350505050611707565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d884846040516118a8929190613703565b60405180910390a15b50505050565b60d154610100900460ff16158080156118d7575060d154600160ff909116105b806118f15750303b1580156118f1575060d15460ff166001145b61190d5760405162461bcd60e51b81526004016108239061366b565b60d1805460ff1916600117905580156119305760d1805461ff0019166101001790555b61193b60088761245d565b61194485612501565b61194f60008561233a565b611958836125de565b61196182612613565b80156115b65760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b60006002600054036119d25760405162461bcd60e51b81526004016108239061361b565b6002600081905550611a1733848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612cd492505050565b9050611a233382612d25565b600160005592915050565b611a386008611678565b604051635061f96960e11b81526001600160a01b038381166004830152919091169063a0c3f2d290602401602060405180830381865afa158015611a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa49190613751565b61082c57604051630fd0c64560e11b81526001600160a01b0382166004820152602401610823565b6000611b0b85858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612cd492505050565b6001600160a01b0383166000908152603760205260409020909150611b319086836123ae565b949350505050565b60018201546001600160a01b03828116911614610b9557604051637bc65bd760e11b815260040160405180910390fd5b34600003611b8a57604051636dfcbde560e11b815260040160405180910390fd5b565b8282611b988282611b39565b82856002016000828254611bac91906136cf565b92505081905550611bd285858760020154868960030154611bcd91906136cf565b612d5a565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611c289086815260200190565b60405180910390a25050505050565b6000611c47836002015483612d95565b905080836002016000828254611c5d91906136e2565b9091555050600183015460028401546003850154611c8d9286926001600160a01b0390911691611bcd9086612dab565b82546040518281526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611d21576040519150601f19603f3d011682016040523d82523d6000602084013e611d26565b606091505b5090949350505050565b611d3e8660006104b0612b62565b611d89576040805163338f030160e01b81526001600160a01b03881660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610823565b611d978360006104b0612b62565b611de0576040805163338f030160e01b81526001600160a01b038516600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610823565b606c54811015611e0357604051630a8d7fa760e21b815260040160405180910390fd5b846001600160a01b0316866001600160a01b0316141580611e365750826001600160a01b0316856001600160a01b031614155b15611e545760405163dc1d04ff60e01b815260040160405180910390fd5b6040805160028082526060820183526000926020830190803683370190505090508681600081518110611e8957611e89613605565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110611ebd57611ebd613605565b60200260200101906001600160a01b031690816001600160a01b031681525050611ee681612dc5565b15611f1257604051630d697db160e11b81526001600160e01b0319600035166004820152602401610823565b50611f1d6008611678565b60405163f883afaf60e01b81526001600160a01b0387811660048301528681166024830152858116604483015260648201859052919091169063f883afaf90608401611380565b6001600160a01b03808516600090815260026020908152604080832093871683529290529081206003810154849003611f9f57549050611b31565b6001600160a01b0386166000908152600360208181526040808420600180845282862094870154865293909252832091820154839290156120045780546001860154909450611fee90856136e2565b8560020154611ffd9190613773565b925061200c565b846001015493505b815460009061201c9086906136e2565b6120269089613773565b9050670de0b6b3a764000061203b82866136cf565b612045919061378a565b865461205191906136cf565b9b9a5050505050505050505050565b828261206c8282612e64565b8260000361208d57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020548311156120c857604051630695534560e31b815260040160405180910390fd5b60006120d46008611678565b8654604051635061f96960e11b81526001600160a01b03918216600482015291925082169063a0c3f2d290602401602060405180830381865afa15801561211f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121439190613751565b80156121bd575085546040516328bde1e160e01b81526001600160a01b039182166004820152908216906328bde1e19060240160e060405180830381865afa158015612193573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b791906137b7565b60a00151155b80156121f057506038546001600160a01b038616600090815260058801602052604090205442916121ed916136cf565b10155b1561220e5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b038516600090815260048701602052604090205461224c908790879061223c9088906136e2565b878a60030154611bcd91906136e2565b85546040518581526001600160a01b03918216918716907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c9060200160405180910390a3505050505050565b6000814710156122d6576040516302631c4f60e61b81526001600160e01b031960003516600482015247602482015260448101839052606401610823565b6111578383611cd4565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314611b8a576000356001600160e01b0319166001604051620f948f60ea1b8152600401610823929190613862565b61271081118061234957508082115b1561236757604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c14910160405180910390a15050565b82826123ba8282612e64565b6001600160a01b03841660009081526004860160205260409020546123f890869086906123e89087906136cf565b868960030154611bcd91906136cf565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b9061244e9087815260200190565b60405180910390a35050505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600d8111156124935761249361358e565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600d8111156124d4576124d461358e565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be290602001611122565b60006125426008611678565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa15801561257f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a39190613652565b905090565b806001600160a01b03163b60000361082c57604051630bfc64a360e21b81526001600160a01b0382166004820152602401610823565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a90602001611122565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c67890602001611122565b8351821461269157807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a5858585604051612684939291906138c9565b60405180910390a26118b1565b600080600080600088516001600160401b038111156126b2576126b26135ef565b6040519080825280602002602001820160405280156126db578160200160208202803683370190505b509050600089516001600160401b038111156126f9576126f96135ef565b604051908082528060200260200182016040528015612722578160200160208202803683370190505b50905060008a516001600160401b03811115612740576127406135ef565b604051908082528060200260200182016040528015612769578160200160208202803683370190505b50905060005b8b518110156129dc578b818151811061278a5761278a613605565b6020908102919091018101516001600160a01b038116600090815260038084526040808320603790955290912001549097506001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a900361282b57868389806001019a508151811061280557612805613605565b60200260200101906001600160a01b031690816001600160a01b031681525050506129ca565b60028101548a111561285957604080518082019091528681526020018a905260018101869055600281018a90555b6001810154156128a35760018101548c8c8481811061287a5761287a613605565b90506020020135670de0b6b3a76400006128949190613773565b61289e919061378a565b6128a6565b60005b9850888160000160008282546128bc91906136cf565b91829055509050856128ce8a856136e2565b815181106128de576128de613605565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461297191906136e2565b8151811061298157612981613605565b6020908102919091010152868d6129988a856136e2565b815181106129a8576129a8613605565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806129d481613913565b91505061276f565b508515612a2557858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a382604051612a1c919061392c565b60405180910390a25b8a5115612a6957877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c8585604051612a609392919061393f565b60405180910390a25b5050505050505050505050565b8282612a828282611b39565b8460020154831115612aa757604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612ad0916136cf565b1115612aef576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612b0391906136e2565b92505081905550612b2485858760020154868960030154611bcd91906136e2565b84546040518481526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7590602001611c28565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612bb2576040519150601f19603f3d011682016040523d82523d6000602084013e612bb7565b606091505b509095945050505050565b600080612bcf85856111e5565b9050612bdd85858584611f64565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612c2491815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612c6e9082868580612e94565b60038181018590556001600160a01b03878116600081815260209384526040808220546001870155519081529188169290917faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad910160405180910390a350509392505050565b600080612cdf612536565b905060005b8351811015610c2257612d11848281518110612d0257612d02613605565b60200260200101518684612bc2565b612d1b90846136cf565b9250600101612ce4565b612d2f8282612298565b610b95576040516303b97b7760e41b81526001600160e01b0319600035166004820152602401610823565b8354612d70906001600160a01b03168484612f26565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b6000818310612da45781611157565b5090919050565b6000818311612dbb576000611157565b61115782846136e2565b60008151600003612dd857506000919050565b60005b6001835103811015612e5b57600181015b8351811015612e5257838181518110612e0757612e07613605565b60200260200101516001600160a01b0316848381518110612e2a57612e2a613605565b60200260200101516001600160a01b031603612e4a575060019392505050565b600101612dec565b50600101612ddb565b50600092915050565b60018201546001600160a01b03808316911603610b9557604051639feb934760e01b815260040160405180910390fd5b8284600301541015612ea857600284018190555b6000612eb8856002015484612d95565b90506000818660020154612ecc91906136e2565b90508015612f1d57600286018290556001870154811115612f00576040516352e521bf60e11b815260040160405180910390fd5b80876001016000016000828254612f1791906136e2565b90915550505b50505050505050565b6000612f30612536565b6001600160a01b0385166000908152600360205260409020600181015460028201549293509091831115612fa4576040518060400160405280612f8b886001600160a01b031660009081526037602052604090206003015490565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090612fd688886111e5565b90506000612fe689898885611f64565b83549091508114613038578083556040518181526001600160a01b0389811691908b16907faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad9060200160405180910390a35b6130458584888a86612e94565b84546001808501919091556003840187905585015484146130ac57886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516130a391815260200190565b60405180910390a35b505050505050505050565b60008083601f8401126130c957600080fd5b5081356001600160401b038111156130e057600080fd5b6020830191508360208260051b85010111156130fb57600080fd5b9250929050565b6000806000806040858703121561311857600080fd5b84356001600160401b038082111561312f57600080fd5b61313b888389016130b7565b9096509450602087013591508082111561315457600080fd5b50613161878288016130b7565b95989497509550505050565b600081518084526020808501945080840160005b8381101561319d57815187529582019590820190600101613181565b509495945050505050565b602081526000611157602083018461316d565b6001600160a01b038116811461082c57600080fd5b6000806000604084860312156131e557600080fd5b83356001600160401b038111156131fb57600080fd5b613207868287016130b7565b909450925050602084013561321b816131bb565b809150509250925092565b6000806000806080858703121561323c57600080fd5b8435613247816131bb565b93506020850135613257816131bb565b92506040850135613267816131bb565b9396929550929360600135925050565b60006020828403121561328957600080fd5b8135613294816131bb565b9392505050565b600080604083850312156132ae57600080fd5b82356132b9816131bb565b946020939093013593505050565b6000806000604084860312156132dc57600080fd5b83356132e7816131bb565b925060208401356001600160401b0381111561330257600080fd5b61330e868287016130b7565b9497909650939450505050565b6000806020838503121561332e57600080fd5b82356001600160401b0381111561334457600080fd5b613350858286016130b7565b90969095509350505050565b6000806040838503121561336f57600080fd5b50508035926020909101359150565b60006020828403121561339057600080fd5b5035919050565b600080604083850312156133aa57600080fd5b82356133b5816131bb565b915060208301356133c5816131bb565b809150509250929050565b6000806000606084860312156133e557600080fd5b83356133f0816131bb565b92506020840135613400816131bb565b929592945050506040919091013590565b8035600e81106116ee57600080fd5b6000806040838503121561343357600080fd5b6133b583613411565b60008060006060848603121561345157600080fd5b833561345c816131bb565b95602085013595506040909401359392505050565b60008060008060006060868803121561348957600080fd5b85356001600160401b03808211156134a057600080fd5b6134ac89838a016130b7565b909750955060208801359150808211156134c557600080fd5b506134d2888289016130b7565b96999598509660400135949350505050565b6000602082840312156134f657600080fd5b61115782613411565b60008060006040848603121561351457600080fd5b83356001600160401b0381111561352a57600080fd5b613536868287016130b7565b909790965060209590950135949350505050565b600080600080600060a0868803121561356257600080fd5b853561356d816131bb565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052602160045260246000fd5b600e81106135b4576135b461358e565b9052565b6001600160e01b031984168152606081016135d660208301856135a4565b6001600160a01b03929092166040919091015292915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561366457600080fd5b5051919050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561115a5761115a6136b9565b8181038181111561115a5761115a6136b9565b6020810161115a82846135a4565b60208082528181018390526000908460408401835b8681101561374657823561372b816131bb565b6001600160a01b031682529183019190830190600101613718565b509695505050505050565b60006020828403121561376357600080fd5b8151801515811461329457600080fd5b808202811582820484141761115a5761115a6136b9565b6000826137a757634e487b7160e01b600052601260045260246000fd5b500490565b80516116ee816131bb565b600060e082840312156137c957600080fd5b60405160e081018181106001600160401b03821117156137f957634e487b7160e01b600052604160045260246000fd5b604052613805836137ac565b8152613813602084016137ac565b6020820152613824604084016137ac565b6040820152613835606084016137ac565b60608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b6001600160e01b03198316815260408101600983106138835761388361358e565b8260208301529392505050565b600081518084526020808501945080840160005b8381101561319d5781516001600160a01b0316875295820195908201906001016138a4565b6040815260006138dc6040830186613890565b82810360208401528381526001600160fb1b038411156138fb57600080fd5b8360051b808660208401370160200195945050505050565b600060018201613925576139256136b9565b5060010190565b6020815260006111576020830184613890565b6060815260006139526060830186613890565b8281036020840152613964818661316d565b90508281036040840152613978818561316d565b969550505050505056fea164736f6c6343000811000a", + "numDeployments": 14, + "solcInputHash": "b469203c60a069be0ec276c20622629d", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"ErrAdminOfAnyActivePoolForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"extraInfo\",\"type\":\"string\"}],\"name\":\"ErrCannotInitTransferRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotTransferRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"ErrContractTypeNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrDuplicated\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"}],\"name\":\"ErrInactivePool\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sendAmount\",\"type\":\"uint256\"}],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientDelegatingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientStakingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidArrays\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidPoolShare\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrOnlyPoolAdminAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrPoolAdminForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"}],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStakingAmountLeft\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeInteractionAddrsNotEqual\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum RoleAccess\",\"name\":\"expectedRole\",\"type\":\"uint8\"}],\"name\":\"ErrUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateZeroAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"msgSig\",\"type\":\"bytes4\"},{\"internalType\":\"enum ContractType\",\"name\":\"expectedContractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"actual\",\"type\":\"address\"}],\"name\":\"ErrUnexpectedInternalCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroValue\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateRangeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"ContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minSecs\",\"type\":\"uint256\"}],\"name\":\"CooldownSecsToUndelegateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MinValidatorStakingAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"PoolApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PoolSharesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validator\",\"type\":\"address[]\"}],\"name\":\"PoolsDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"}],\"name\":\"PoolsUpdateConflicted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdateFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"aRps\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"shares\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountDeductFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Undelegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debited\",\"type\":\"uint256\"}],\"name\":\"UserRewardUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"WaitingSecsToRevokeUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"pubkey\",\"type\":\"bytes\"}],\"name\":\"applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"bulkUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrList\",\"type\":\"address[]\"}],\"name\":\"claimRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToUndelegate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrList\",\"type\":\"address[]\"},{\"internalType\":\"TConsensus\",\"name\":\"consensusAddrDst\",\"type\":\"address\"}],\"name\":\"delegateRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newAdminAddr\",\"type\":\"address\"}],\"name\":\"execChangeAdminAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"execDeductStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"actualDeductingAmount_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"poolIds\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"newPeriod\",\"type\":\"uint256\"}],\"name\":\"execDeprecatePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"poolIds\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"execRecordRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommissionRateRange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"contract_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakings\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"selfStakings_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"poolIds\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakingsById\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"selfStakings_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmounts\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"poolIds\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmountsById\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotals\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"stakingAmounts_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"poolIds\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotalsById\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"stakingAmounts_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"getPoolAddressOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"getPoolDetail\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolId\",\"type\":\"address\"}],\"name\":\"getPoolDetailById\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"TConsensus[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"getRewards\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"rewards_\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"getStakingTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__minValidatorStakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxCommissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__cooldownSecsToUndelegate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__waitingSecsToRevoke\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initializeV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__profileContract\",\"type\":\"address\"}],\"name\":\"initializeV3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"isAdminOfActivePool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minValidatorStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddrSrc\",\"type\":\"address\"},{\"internalType\":\"TConsensus\",\"name\":\"consensusAddrDst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"redelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"requestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"requestRenounce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"name\":\"requestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"setCommissionRateRange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ContractType\",\"name\":\"contractType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"cooldownSecs\",\"type\":\"uint256\"}],\"name\":\"setCooldownSecsToUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"setMinValidatorStakingAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"setWaitingSecsToRevoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"TConsensus\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"waitingSecsToRevoke\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAdminOfAnyActivePoolForbidden(address)\":[{\"details\":\"Error of admin of any active pool cannot delegate.\"}],\"ErrCannotInitTransferRON(address,string)\":[{\"details\":\"Error of cannot transfer RON to specified target.\"}],\"ErrCannotTransferRON()\":[{\"details\":\"Error of cannot transfer RON.\"}],\"ErrContractTypeNotFound(uint8)\":[{\"details\":\"Error of invalid role.\"}],\"ErrDuplicated(bytes4)\":[{\"details\":\"Error thrown when a duplicated element is detected in an array.\",\"params\":{\"msgSig\":\"The function signature that invoke the error.\"}}],\"ErrInactivePool(address,address)\":[{\"details\":\"Error of querying inactive pool.\"}],\"ErrInsufficientBalance(bytes4,uint256,uint256)\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInsufficientDelegatingAmount()\":[{\"details\":\"Error of undelegating insufficient amount.\"}],\"ErrInsufficientStakingAmount()\":[{\"details\":\"Error of insufficient staking amount for unstaking.\"}],\"ErrInvalidArrays()\":[{\"details\":\"Error of length of input arrays are not of the same.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of setting commission rate exceeds max allowed.\"}],\"ErrInvalidPoolShare()\":[{\"details\":\"Error of invalid pool share.\"}],\"ErrOnlyPoolAdminAllowed()\":[{\"details\":\"Error of no one is allowed to call but the pool's admin.\"}],\"ErrPoolAdminForbidden()\":[{\"details\":\"Error of pool admin is not allowed to call.\"}],\"ErrRecipientRevert(bytes4)\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrStakingAmountLeft()\":[{\"details\":\"Error of invalid staking amount left after deducted.\"}],\"ErrThreeInteractionAddrsNotEqual()\":[{\"details\":\"Error of three interaction addresses must be of the same in applying for validator candidate.\"}],\"ErrUnauthorized(bytes4,uint8)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"expectedRole\":\"The role required to perform the function.\",\"msgSig\":\"The function signature (bytes4) that the caller is unauthorized to perform.\"}}],\"ErrUndelegateTooEarly()\":[{\"details\":\"Error of undelegating too early.\"}],\"ErrUndelegateZeroAmount()\":[{\"details\":\"Error of undelegating zero amount.\"}],\"ErrUnexpectedInternalCall(bytes4,uint8,address)\":[{\"details\":\"Error indicating that the caller is unauthorized to perform a specific function.\",\"params\":{\"actual\":\"The actual address that called to the function.\",\"expectedContractType\":\"The contract type required to perform the function.\",\"msgSig\":\"The function signature (bytes4).\"}}],\"ErrUnstakeTooEarly()\":[{\"details\":\"Error of unstaking too early.\"}],\"ErrUnstakeZeroAmount()\":[{\"details\":\"Error of unstaking zero amount.\"}],\"ErrZeroCodeContract(address)\":[{\"details\":\"Error of set to non-contract.\"}],\"ErrZeroValue()\":[{\"details\":\"Error of receiving zero message value.\"}]},\"events\":{\"CommissionRateRangeUpdated(uint256,uint256)\":{\"details\":\"Emitted when the commission rate range is updated.\"},\"ContractUpdated(uint8,address)\":{\"details\":\"Emitted when a contract is updated.\"},\"CooldownSecsToUndelegateUpdated(uint256)\":{\"details\":\"Emitted when the minium number of seconds to undelegate is updated.\"},\"Delegated(address,address,uint256)\":{\"details\":\"Emitted when the delegator staked for a validator candidate.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"MinValidatorStakingAmountUpdated(uint256)\":{\"details\":\"Emitted when the minimum staking amount for being a validator is updated.\"},\"PoolApproved(address,address)\":{\"details\":\"Emitted when the validator pool is approved.\"},\"PoolSharesUpdated(uint256,address,uint256)\":{\"details\":\"Emitted when the pool shares are updated\"},\"PoolsDeprecated(address[])\":{\"details\":\"Emitted when the validator pool is deprecated.\"},\"PoolsUpdateConflicted(uint256,address[])\":{\"details\":\"Emitted when the contract fails when updating the pools that already set\"},\"PoolsUpdateFailed(uint256,address[],uint256[])\":{\"details\":\"Emitted when the contract fails when updating the pools\"},\"PoolsUpdated(uint256,address[],uint256[],uint256[])\":{\"details\":\"Emitted when the pools are updated\"},\"RewardClaimed(address,address,uint256)\":{\"details\":\"Emitted when the user claimed their reward\"},\"Staked(address,uint256)\":{\"details\":\"Emitted when the pool admin staked for themself.\"},\"StakingAmountDeductFailed(address,address,uint256,uint256)\":{\"details\":\"Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\"},\"StakingAmountTransferFailed(address,address,uint256,uint256)\":{\"details\":\"Emitted when the staking amount transfer failed.\"},\"Undelegated(address,address,uint256)\":{\"details\":\"Emitted when the delegator unstaked from a validator candidate.\"},\"Unstaked(address,uint256)\":{\"details\":\"Emitted when the pool admin unstaked the amount of RON from themself.\"},\"UserRewardUpdated(address,address,uint256)\":{\"details\":\"Emitted when the fields to calculate pending reward for the user is updated.\"},\"WaitingSecsToRevokeUpdated(uint256)\":{\"details\":\"Emitted when the number of seconds that a candidate must wait to be revoked.\"}},\"kind\":\"dev\",\"methods\":{\"applyValidatorCandidate(address,address,address,uint256,bytes)\":{\"details\":\"Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.\",\"params\":{\"candidateAdmin\":\"the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance.\"}},\"bulkUndelegate(address[],uint256[])\":{\"details\":\"Bulk unstakes from a list of candidates. Requirements: - The method caller is not the pool admin. Emits the events `Undelegated`.\"},\"claimRewards(address[])\":{\"details\":\"Claims the reward of method caller. Emits the `RewardClaimed` event.\"},\"cooldownSecsToUndelegate()\":{\"details\":\"Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\"},\"delegate(address)\":{\"details\":\"Stakes for a validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is not the pool admin. Emits the `Delegated` event.\"},\"delegateRewards(address[],address)\":{\"details\":\"Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event.\"},\"execChangeAdminAddress(address,address)\":{\"details\":\"Requirements: - Only Profile contract can call this method.\"},\"execDeductStakingAmount(address,uint256)\":{\"details\":\"Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`.\"},\"execDeprecatePools(address[],uint256)\":{\"details\":\"Deprecates the pool. - Deduct self-staking amount of the pool admin to zero. - Transfer the deducted amount to the pool admin. - Deactivate the pool admin address in the mapping of active pool admins Requirements: - The method caller is validator contract. Emits the event `PoolsDeprecated` and `Unstaked` events. Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\"},\"execRecordRewards(address[],uint256[],uint256)\":{\"details\":\"Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending.\"},\"getCommissionRateRange()\":{\"details\":\"Returns the commission rate range that the candidate can set.\"},\"getContract(uint8)\":{\"details\":\"Returns the address of a contract with a specific role. Throws an error if no contract is set for the specified role.\",\"params\":{\"contractType\":\"The role of the contract to retrieve.\"},\"returns\":{\"contract_\":\"The address of the contract with the specified role.\"}},\"getManySelfStakings(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManySelfStakingsById(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManyStakingAmounts(address[],address[])\":{\"details\":\"Returns the staking amounts of the users.\"},\"getManyStakingTotals(address[])\":{\"details\":\"Returns the total staking amounts of all users for the pools `_poolAddrs`.\"},\"getPoolAddressOf(address)\":{\"details\":\"Returns the consensus address corresponding to the pool admin.\"},\"getPoolDetail(address)\":{\"details\":\"Returns the staking pool details.\"},\"getReward(address,address)\":{\"details\":\"Returns the reward amount that user claimable.\"},\"getRewards(address,address[])\":{\"details\":\"Returns the claimable reward of the user `_user`.\"},\"getStakingAmount(address,address)\":{\"details\":\"Returns the staking amount of an user.\"},\"getStakingTotal(address)\":{\"details\":\"Returns the total staking amount of all users for a pool.\"},\"initialize(address,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"initializeV2()\":{\"details\":\"Initializes the contract storage V2.\"},\"initializeV3(address)\":{\"details\":\"Initializes the contract storage V3.\"},\"isAdminOfActivePool(address)\":{\"details\":\"Returns whether the `admin` is currently active.\"},\"minValidatorStakingAmount()\":{\"details\":\"Returns the minimum threshold for being a validator candidate.\"},\"redelegate(address,address,uint256)\":{\"details\":\"Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `Undelegated` event and the `Delegated` event.\"},\"requestEmergencyExit(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestRenounce(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`.\"},\"setCommissionRateRange(uint256,uint256)\":{\"details\":\"Sets the commission rate range that a candidate can set. Requirements: - The method caller is admin. Emits the `CommissionRateRangeUpdated` event.\"},\"setContract(uint8,address)\":{\"details\":\"Sets the address of a contract with a specific role. Emits the event {ContractUpdated}.\",\"params\":{\"addr\":\"The address of the contract to set.\",\"contractType\":\"The role of the contract to set.\"}},\"setCooldownSecsToUndelegate(uint256)\":{\"details\":\"Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`.\"},\"setMinValidatorStakingAmount(uint256)\":{\"details\":\"Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event.\"},\"setWaitingSecsToRevoke(uint256)\":{\"details\":\"Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`.\"},\"stake(address)\":{\"details\":\"Self-delegates to the validator candidate `consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`.\"},\"undelegate(address,uint256)\":{\"details\":\"Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event.\"},\"unstake(address,uint256)\":{\"details\":\"Unstakes from the validator candidate `consensusAddr` for `amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`.\"},\"waitingSecsToRevoke()\":{\"details\":\"Returns the number of seconds that a candidate must wait for the renounce request gets affected.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/staking/Staking.sol\":\"Staking\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance(bytes4 msgSig, uint256 currentBalance, uint256 sendAmount);\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert(bytes4 msgSig);\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable recipient, uint256 amount) internal {\\n if (!_sendRON(recipient, amount)) revert ErrRecipientRevert(msg.sig);\\n }\\n\\n /**\\n * @dev Send `amount` RON to the address `recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable recipient, uint256 amount) internal returns (bool success) {\\n if (address(this).balance < amount) revert ErrInsufficientBalance(msg.sig, address(this).balance, amount);\\n return _unsafeSendRON(recipient, amount);\\n }\\n\\n /**\\n * @dev Unsafe send `amount` RON to the address `recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable recipient, uint256 amount) internal returns (bool success) {\\n (success, ) = recipient.call{ value: amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRONLimitGas(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRONLimitGas(\\n address payable recipient,\\n uint256 amount,\\n uint256 gas\\n ) internal returns (bool success) {\\n (success, ) = recipient.call{ value: amount, gas: gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xdece837caa8da00fe031b8139ada009330b8bef149af12b535913c021ab94d0e\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { HasProxyAdmin } from \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasContracts.sol\\\";\\nimport { IdentityGuard } from \\\"../../utils/IdentityGuard.sol\\\";\\nimport { ErrUnexpectedInternalCall } from \\\"../../utils/CommonErrors.sol\\\";\\n\\n/**\\n * @title HasContracts\\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\\n */\\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\\n /// @dev value is equal to keccak256(\\\"@ronin.dpos.collections.HasContracts.slot\\\") - 1\\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\\n\\n /**\\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\\n * @param contractType The contract type that allowed to call\\n */\\n modifier onlyContract(ContractType contractType) virtual {\\n _requireContract(contractType);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\\n _requireHasCode(addr);\\n _setContract(contractType, addr);\\n }\\n\\n /**\\n * @inheritdoc IHasContracts\\n */\\n function getContract(ContractType contractType) public view returns (address contract_) {\\n contract_ = _getContractMap()[uint8(contractType)];\\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\\n }\\n\\n /**\\n * @dev Internal function to set the address of a contract with a specific role.\\n * @param contractType The contract type of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function _setContract(ContractType contractType, address addr) internal virtual {\\n _getContractMap()[uint8(contractType)] = addr;\\n emit ContractUpdated(contractType, addr);\\n }\\n\\n /**\\n * @dev Internal function to access the mapping of contract addresses with roles.\\n * @return contracts_ The mapping of contract addresses with roles.\\n */\\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\\n assembly {\\n contracts_.slot := _STORAGE_SLOT\\n }\\n }\\n\\n /**\\n * @dev Internal function to check if the calling contract has a specific role.\\n * @param contractType The contract type that the calling contract must have.\\n * @dev Throws an error if the calling contract does not have the specified role.\\n */\\n function _requireContract(ContractType contractType) private view {\\n if (msg.sender != getContract(contractType)) {\\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9e1dceb68827adfb8c8184662f29ab5fe14e292a632878150e3b0b6c61bc1dce\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\nimport \\\"../../utils/CommonErrors.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n _requireAdmin();\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view virtual returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n function _requireAdmin() internal view {\\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\\n }\\n}\\n\",\"keccak256\":\"0x0916021d04ea0c93c54978dc2fd46575fd2bd867369fbf9ce49f316939ddaf25\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IProfile.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../udvts/Types.sol\\\";\\nimport \\\"../utils/RoleAccess.sol\\\";\\n\\ninterface IProfile {\\n struct CandidateProfile {\\n /**\\n * @dev Primary key of the profile, use for backward querying.\\n *\\n * {Staking} Contract: index of pool\\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\\n *\\n */\\n address id;\\n /// @dev Consensus address.\\n TConsensus consensus;\\n /// @dev Pool admin address.\\n address admin;\\n /// @dev Treasury address.\\n address payable treasury;\\n /// @dev Address to voting proposal.\\n address __reservedGovernor;\\n /// @dev Public key for fast finality.\\n bytes pubkey;\\n }\\n\\n /// @dev Event emitted when a profile with `id` is added.\\n event ProfileAdded(address indexed id);\\n /// @dev Event emitted when a address in a profile is changed.\\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\\n /// @dev Event emitted when the pubkey of the `id` is changed.\\n event PubkeyChanged(address indexed id, bytes pubkey);\\n\\n /// @dev Error of already existed profile.\\n error ErrExistentProfile();\\n /// @dev Error of non existed profile.\\n error ErrNonExistentProfile();\\n /// @dev Error when create a new profile whose id and consensus are not identical.\\n error ErrIdAndConsensusDiffer();\\n /**\\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\\n * and with value type of `infoType`.\\n */\\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\\n error ErrDuplicatedPubkey(bytes pubkey);\\n error ErrZeroAddress(RoleAccess infoType);\\n error ErrZeroPubkey();\\n\\n /// @dev Getter to query full `profile` from `id` address.\\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\\n\\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\\n\\n /// @dev Getter to backward query from `consensus` address to `id` address.\\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\\n\\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\\n\\n /**\\n * @notice Add a new profile.\\n *\\n * @dev Requirements:\\n * - The profile must not be existent before.\\n * - Only contract admin can call this method.\\n */\\n function addNewProfile(CandidateProfile memory profile) external;\\n\\n /**\\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\\n * applying for candidate role.\\n *\\n * Requirements:\\n * - Only `stakingContract` can call this method.\\n */\\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\\n\\n /**\\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\\n *\\n * Emit an {ProfileAddressChanged}.\\n */\\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\\n\\n /**\\n * @notice The candidate admin changes the public key.\\n *\\n * @dev Requirements:\\n * - The profile must be existed.\\n * - Only user with candidate admin role can call this method.\\n * - New public key must not be duplicated.\\n */\\n\\n function changePubkey(address id, bytes memory pubkey) external;\\n}\\n\",\"keccak256\":\"0x14dfb3198bf21724f5315198e1b23564902821ef56730c7db49e3d1165a36d36\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContracts.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { ContractType } from \\\"../../utils/ContractType.sol\\\";\\n\\ninterface IHasContracts {\\n /// @dev Error of invalid role.\\n error ErrContractTypeNotFound(ContractType contractType);\\n\\n /// @dev Emitted when a contract is updated.\\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\\n\\n /**\\n * @dev Returns the address of a contract with a specific role.\\n * Throws an error if no contract is set for the specified role.\\n *\\n * @param contractType The role of the contract to retrieve.\\n * @return contract_ The address of the contract with the specified role.\\n */\\n function getContract(ContractType contractType) external view returns (address contract_);\\n\\n /**\\n * @dev Sets the address of a contract with a specific role.\\n * Emits the event {ContractUpdated}.\\n * @param contractType The role of the contract to set.\\n * @param addr The address of the contract to set.\\n */\\n function setContract(ContractType contractType, address addr) external;\\n}\\n\",\"keccak256\":\"0x99d8213d857e30d367155abd15dc42730afdfbbac3a22dfb3b95ffea2083a92e\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId, TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n /**\\n * @dev Address of the pool.\\n * @custom non-volatile-storage Permanently set to the first consensus address of the candidate.\\n */\\n address pid;\\n\\n /**\\n * @dev The address of the pool admin.\\n * @custom shadowed-storage This storage slot is always kept in sync with the admin in `Profile-CandidateProfile`.\\n */\\n address __shadowedPoolAdmin;\\n\\n /// @dev Self-staking amount\\n uint256 stakingAmount;\\n\\n /// @dev Total number of RON staking for the pool\\n uint256 stakingTotal;\\n\\n /// @dev Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n\\n /// @dev Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(TConsensus consensusAddr, address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `admin` is currently active.\\n */\\n function isAdminOfActivePool(address admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address admin) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool details.\\n */\\n function getPoolDetail(\\n TConsensus consensusAddr\\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\\n\\n function getPoolDetailById(\\n address poolId\\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 secs) external;\\n}\\n\",\"keccak256\":\"0xadaec16c22c590a42070d5e41fcc83c9fa89a4134528dd2159b5946ecbc64253\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed poolId, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed poolId, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed poolId,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed poolId,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 minRange, uint256 maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address candidateAdmin,\\n TConsensus consensusAddr,\\n address payable treasuryAddr,\\n uint256 commissionRate,\\n bytes calldata pubkey\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata pools, uint256 period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(TConsensus consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `consensusAddr` for `amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(TConsensus consensusAddr, uint256 amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n TConsensus consensusAddr,\\n uint256 effectiveDaysOnwards,\\n uint256 commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(TConsensus consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(TConsensus consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x8880174d4be9ceeed98a1f1cda5e833ce2afe8ee8b0e5921088a796a9a9bc69d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed poolId, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed poolId, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(TConsensus consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(TConsensus consensusAddr, uint256 amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(TConsensus consensusAddrSrc, TConsensus consensusAddrDst, uint256 amount) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(\\n address user,\\n TConsensus[] calldata consensusAddrList\\n ) external view returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(TConsensus[] calldata consensusAddrList) external returns (uint256 amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(\\n TConsensus[] calldata consensusAddrList,\\n TConsensus consensusAddrDst\\n ) external returns (uint256 amount);\\n}\\n\",\"keccak256\":\"0xe8a650a7348d45b2614ece66083f140801e8375bb8b733addf02209073991ef3\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\nimport { TPoolId, TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(TConsensus consensusAddr, address user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(\\n TConsensus[] calldata consensusAddrs,\\n address[] calldata userList\\n ) external view returns (uint256[] memory);\\n\\n function getManyStakingAmountsById(\\n address[] calldata poolIds,\\n address[] calldata userList\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(TConsensus consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\\n\\n function getManyStakingTotalsById(\\n address[] calldata poolIds\\n ) external view returns (uint256[] memory stakingAmounts_);\\n}\\n\",\"keccak256\":\"0x69626097d76dde60ce9fc73c6f8823ad7e8a5b6ff23ec3f20b9e1499f700d1b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./IStakingCallback.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking, IStakingCallback {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards, uint256 period) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address poolId, uint256 amount) external returns (uint256 actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xaa2491ed5276434d2a894ece749ad15835ff2791fa614d3cf3b58c0bdd418881\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStakingCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TPoolId } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface IStakingCallback {\\n /**\\n * @dev Requirements:\\n * - Only Profile contract can call this method.\\n */\\n function execChangeAdminAddress(address poolAddr, address newAdminAddr) external;\\n}\\n\",\"keccak256\":\"0x64e1659e4fb15498be8956f696e72e4c7370cc7439ab5395c94f24e85b92e85b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n /**\\n * @dev The address of the candidate admin.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\\n */\\n address __shadowedAdmin;\\n /**\\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\\n */\\n TConsensus __shadowedConsensus;\\n /**\\n * @dev Address that receives mining reward of the validator\\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\\n */\\n address payable __shadowedTreasury;\\n /// @dev Address of the bridge operator corresponding to the candidate\\n address ____deprecatedBridgeOperatorAddr;\\n /**\\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\\n * Values in range [0; 100_00] stands for 0-100%\\n */\\n uint256 commissionRate;\\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnward() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xd797160208b17456231633415848fffa0a5ba7e9ab7f81b241d1bd89c74c2c83\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManagerCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport { TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\ninterface ICandidateManagerCallback {\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address candidateAdmin,\\n address cid,\\n address payable treasuryAddr,\\n uint256 commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\\n * This updates the shadow storage slot of \\\"shadowedAdmin\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeAdminAddress(address cid, address newAdmin) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\\n * This updates the shadow storage slot of \\\"shadowedConsensus\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\\n\\n /**\\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\\n * This updates the shadow storage slot of \\\"shadowedTreasury\\\" for candidate id `id` to `newAdmin`.\\n *\\n * Requirements:\\n * - The caller must be the Profile contract.\\n */\\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\\n}\\n\",\"keccak256\":\"0x0f241310c7f284374c26792fe73230a3b2cabc709d04f28a7b366292821f96dc\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the fast finality reward is distributed.\\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\\n event FastFinalityRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x22f546add63b1b6e62929bdd4052fa032af55ebf50981dc22d208fe53ad1b0a3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n /// @dev Error thrown when the info of releasing locked fund not exist.\\n error ErrLockedFundReleaseInfoNotFound(address cid);\\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\\n error ErrLockedFundMightBeRecycled(address cid);\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x98caa14d1e6dc6a9ab6d09c864a32790014890f9e2ad7951b77ff5658e0f7c8b\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./ICandidateManagerCallback.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManagerCallback,\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0xf4f96a624e7c77bbce044c67e3f4b406e65871debc19e7bfab663c1fcfcbc7b0\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed cid,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed cid, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address cid, uint256 period) external;\\n}\\n\",\"keccak256\":\"0xbf540beae3c94d2b42e7bbb74f921086c23613fa4db43a5ca5310cb179b46d5e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfoV2.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xb63c6a5edcc82cc04af534e8398eee9a805bb9cb179f3e00750e6ff92354bed9\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(TConsensus) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(\\n TConsensus addr\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(\\n TConsensus addr,\\n uint256 blockNum\\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\\n\\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x27afa712094804b997f55e8f8d320760e07d7260ab33aeb8fb61c39849f09bf3\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport { TConsensus } from \\\"../../../udvts/Types.sol\\\";\\n\\ninterface IValidatorInfoV2 {\\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory _validatorList);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducer() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x45ba68ae461f9c8ecde0fb3c7db78d6d9f44a4a6cc0f03e7b8edad0cced55643\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Error thrown when a duplicated element is detected in an array.\\n * @param msgSig The function signature that invoke the error.\\n */\\n error ErrDuplicated(bytes4 msgSig);\\n\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n unchecked {\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\\n // Hashing two arrays and compare their hash\\n assembly {\\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n yes_ := eq(_thisHash, _otherHash)\\n }\\n }\\n\\n /**\\n * @dev Return the concatenated array from a and b.\\n */\\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\\n uint256 lengthA = a.length;\\n uint256 lengthB = b.length;\\n unchecked {\\n c = new address[](lengthA + lengthB);\\n }\\n uint256 i;\\n for (; i < lengthA; ) {\\n c[i] = a[i];\\n unchecked {\\n ++i;\\n }\\n }\\n for (uint256 j; j < lengthB; ) {\\n c[i] = b[j];\\n unchecked {\\n ++i;\\n ++j;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaf760162653a85d6e1b24df4d33c74076f778470112f421a02050fb981242001\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n DeprecatedBridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa712f0d1a323ee39f23eb3ee3278b4ec25fe2e536b1ccc629578c66f277c088d\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xd73170f448c644a47024c7dbcf4afc3cc7ad27f61737c6ea4c3b543ec5cdb7e9\",\"license\":\"UNLICENSED\"},\"contracts/ronin/staking/BaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../extensions/collections/HasContracts.sol\\\";\\nimport \\\"../../interfaces/staking/IBaseStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport { HasValidatorDeprecated } from \\\"../../utils/DeprecatedSlots.sol\\\";\\nimport \\\"./RewardCalculation.sol\\\";\\nimport { TPoolId, TConsensus } from \\\"../../udvts/Types.sol\\\";\\n\\nabstract contract BaseStaking is\\n RONTransferHelper,\\n ReentrancyGuard,\\n RewardCalculation,\\n HasContracts,\\n IBaseStaking,\\n HasValidatorDeprecated\\n{\\n /// @dev Mapping from pool address (i.e. validator id) => staking pool detail\\n mapping(address => PoolDetail) internal _poolDetail;\\n\\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n uint256 internal _cooldownSecsToUndelegate;\\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\\n uint256 internal _waitingSecsToRevoke;\\n\\n /// @dev Mapping from \\\"admin address of an active pool\\\" => \\\"pool id\\\".\\n mapping(address => address) internal _adminOfActivePoolMapping;\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n modifier noEmptyValue() {\\n _requireValue();\\n _;\\n }\\n\\n modifier anyExceptPoolAdmin(PoolDetail storage _pool, address delegator) {\\n _anyExceptPoolAdmin(_pool, delegator);\\n _;\\n }\\n\\n modifier onlyPoolAdmin(PoolDetail storage _pool, address requester) {\\n _requirePoolAdmin(_pool, requester);\\n _;\\n }\\n\\n modifier poolOfConsensusIsActive(TConsensus consensusAddr) {\\n _poolOfConsensusIsActive(consensusAddr);\\n _;\\n }\\n\\n function _requireValue() private view {\\n if (msg.value == 0) revert ErrZeroValue();\\n }\\n\\n function _requirePoolAdmin(PoolDetail storage _pool, address requester) private view {\\n if (_pool.__shadowedPoolAdmin != requester) revert ErrOnlyPoolAdminAllowed();\\n }\\n\\n function _anyExceptPoolAdmin(PoolDetail storage _pool, address delegator) private view {\\n if (_pool.__shadowedPoolAdmin == delegator) revert ErrPoolAdminForbidden();\\n }\\n\\n function _poolOfConsensusIsActive(TConsensus consensusAddr) private view {\\n if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isValidatorCandidate(consensusAddr))\\n revert ErrInactivePool(consensusAddr, __css2cid(consensusAddr));\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function isAdminOfActivePool(address admin) public view override returns (bool) {\\n return _adminOfActivePoolMapping[admin] != address(0);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolAddressOf(address admin) external view override returns (address) {\\n return _adminOfActivePoolMapping[admin];\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolDetail(\\n TConsensus consensusAddr\\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) {\\n address poolId = __css2cid(consensusAddr);\\n return _getPoolDetailById(poolId);\\n }\\n\\n function getPoolDetailById(\\n address poolId\\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) {\\n return _getPoolDetailById(poolId);\\n }\\n\\n function _getPoolDetailById(\\n address poolId\\n ) internal view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) {\\n PoolDetail storage _pool = _poolDetail[poolId];\\n return (_pool.__shadowedPoolAdmin, _pool.stakingAmount, _pool.stakingTotal);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakings(\\n TConsensus[] calldata consensusAddrs\\n ) external view returns (uint256[] memory selfStakings_) {\\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\\n return _getManySelfStakingsById(poolIds);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory selfStakings_) {\\n return _getManySelfStakingsById(poolIds);\\n }\\n\\n /**\\n * @dev Query many self staking amount by list `poolIds`.\\n */\\n function _getManySelfStakingsById(address[] memory poolIds) internal view returns (uint256[] memory selfStakings_) {\\n selfStakings_ = new uint256[](poolIds.length);\\n for (uint i = 0; i < poolIds.length; ) {\\n selfStakings_[i] = _poolDetail[poolIds[i]].stakingAmount;\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(TConsensus consensusAddr) external view override returns (uint256) {\\n address poolId = __css2cid(consensusAddr);\\n return _getStakingTotal(poolId);\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotals(\\n TConsensus[] calldata consensusAddrs\\n ) external view override returns (uint256[] memory stakingAmounts_) {\\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\\n return _getManyStakingTotalsById(poolIds);\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotalsById(\\n address[] calldata poolIds\\n ) external view override returns (uint256[] memory stakingAmounts_) {\\n return _getManyStakingTotalsById(poolIds);\\n }\\n\\n function _getManyStakingTotalsById(\\n address[] memory poolIds\\n ) internal view returns (uint256[] memory stakingAmounts_) {\\n stakingAmounts_ = new uint256[](poolIds.length);\\n for (uint i = 0; i < poolIds.length; ) {\\n stakingAmounts_[i] = _getStakingTotal(poolIds[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _getStakingTotal(address poolId) internal view override returns (uint256) {\\n return _poolDetail[poolId].stakingTotal;\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(TConsensus consensusAddr, address user) external view override returns (uint256) {\\n address poolId = __css2cid(consensusAddr);\\n return _getStakingAmount(poolId, user);\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingAmounts(\\n TConsensus[] calldata consensusAddrs,\\n address[] calldata userList\\n ) external view override returns (uint256[] memory stakingAmounts) {\\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\\n return _getManyStakingAmountsById(poolIds, userList);\\n }\\n\\n function getManyStakingAmountsById(\\n address[] calldata poolIds,\\n address[] calldata userList\\n ) external view returns (uint256[] memory stakingAmounts) {\\n return _getManyStakingAmountsById(poolIds, userList);\\n }\\n\\n function _getManyStakingAmountsById(\\n address[] memory poolIds,\\n address[] memory userList\\n ) internal view returns (uint256[] memory stakingAmounts) {\\n if (poolIds.length != userList.length) revert ErrInvalidArrays();\\n stakingAmounts = new uint256[](poolIds.length);\\n for (uint i = 0; i < stakingAmounts.length; ) {\\n stakingAmounts[i] = _getStakingAmount(poolIds[i], userList[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _getStakingAmount(address poolId, address user) internal view override returns (uint256) {\\n return _poolDetail[poolId].delegatingAmount[user];\\n }\\n\\n function __css2cid(TConsensus consensusAddr) internal view returns (address) {\\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\\n }\\n\\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view returns (address[] memory) {\\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256) {\\n return _cooldownSecsToUndelegate;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function waitingSecsToRevoke() external view returns (uint256) {\\n return _waitingSecsToRevoke;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external override onlyAdmin {\\n _setCooldownSecsToUndelegate(cooldownSecs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setWaitingSecsToRevoke(uint256 secs) external override onlyAdmin {\\n _setWaitingSecsToRevoke(secs);\\n }\\n\\n /**\\n * @dev Sets the minium number of seconds to undelegate.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function _setCooldownSecsToUndelegate(uint256 cooldownSecs) internal {\\n _cooldownSecsToUndelegate = cooldownSecs;\\n emit CooldownSecsToUndelegateUpdated(cooldownSecs);\\n }\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function _setWaitingSecsToRevoke(uint256 secs) internal {\\n _waitingSecsToRevoke = secs;\\n emit WaitingSecsToRevokeUpdated(secs);\\n }\\n\\n /**\\n * @dev Changes the delegate amount.\\n */\\n function _changeDelegatingAmount(\\n PoolDetail storage _pool,\\n address delegator,\\n uint256 newDelegatingAmount,\\n uint256 newStakingTotal\\n ) internal {\\n _syncUserReward(_pool.pid, delegator, newDelegatingAmount);\\n _pool.stakingTotal = newStakingTotal;\\n _pool.delegatingAmount[delegator] = newDelegatingAmount;\\n }\\n}\\n\",\"keccak256\":\"0xf5bb01ddb183a1ebd63bc91c8f87ee6c6ccf2ed9123fe2b26c9f3bbb704aef39\",\"license\":\"MIT\"},\"contracts/ronin/staking/CandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../../interfaces/staking/ICandidateStaking.sol\\\";\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\\n /// @dev The minimum threshold for being a validator candidate.\\n uint256 internal _minValidatorStakingAmount;\\n\\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _maxCommissionRate;\\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _minCommissionRate;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] ______gap;\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function minValidatorStakingAmount() public view override returns (uint256) {\\n return _minValidatorStakingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function getCommissionRateRange() external view override returns (uint256, uint256) {\\n return (_minCommissionRate, _maxCommissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMinValidatorStakingAmount(uint256 threshold) external override onlyAdmin {\\n _setMinValidatorStakingAmount(threshold);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external override onlyAdmin {\\n _setCommissionRateRange(minRate, maxRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function applyValidatorCandidate(\\n address candidateAdmin,\\n TConsensus consensusAddr,\\n address payable treasuryAddr,\\n uint256 commissionRate,\\n bytes calldata pubkey\\n ) external payable override nonReentrant {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n if (commissionRate > _maxCommissionRate || commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n\\n uint256 amount = msg.value;\\n address payable poolAdmin = payable(msg.sender);\\n address poolId = TConsensus.unwrap(consensusAddr);\\n\\n _applyValidatorCandidate({\\n poolAdmin: poolAdmin,\\n candidateAdmin: candidateAdmin,\\n poolId: poolId,\\n treasuryAddr: treasuryAddr,\\n pubkey: pubkey,\\n commissionRate: commissionRate,\\n amount: amount\\n });\\n\\n PoolDetail storage _pool = _poolDetail[poolId];\\n _pool.__shadowedPoolAdmin = poolAdmin;\\n _pool.pid = poolId;\\n _adminOfActivePoolMapping[poolAdmin] = poolId;\\n\\n _stake(_poolDetail[poolId], poolAdmin, amount);\\n emit PoolApproved(poolId, poolAdmin);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestUpdateCommissionRate(\\n TConsensus consensusAddr,\\n uint256 effectiveDaysOnwards,\\n uint256 commissionRate\\n )\\n external\\n override\\n poolOfConsensusIsActive(consensusAddr)\\n onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender)\\n {\\n if (commissionRate > _maxCommissionRate || commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestUpdateCommissionRate(\\n __css2cid(consensusAddr),\\n effectiveDaysOnwards,\\n commissionRate\\n );\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function execDeprecatePools(\\n address[] calldata poolIds,\\n uint256 newPeriod\\n ) external override onlyContract(ContractType.VALIDATOR) {\\n if (poolIds.length == 0) {\\n return;\\n }\\n\\n for (uint i = 0; i < poolIds.length; ) {\\n address poolId = poolIds[i];\\n PoolDetail storage _pool = _poolDetail[poolId];\\n // Deactivate the pool admin in the active mapping.\\n delete _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin];\\n\\n // Deduct and transfer the self staking amount to the pool admin.\\n uint256 deductingAmount = _pool.stakingAmount;\\n if (deductingAmount > 0) {\\n _deductStakingAmount(_pool, deductingAmount);\\n if (!_unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), deductingAmount, DEFAULT_ADDITION_GAS)) {\\n emit StakingAmountTransferFailed(\\n _pool.pid,\\n _pool.__shadowedPoolAdmin,\\n deductingAmount,\\n address(this).balance\\n );\\n }\\n }\\n\\n // Settle the unclaimed reward and transfer to the pool admin.\\n uint256 lastRewardAmount = _claimReward(poolId, _pool.__shadowedPoolAdmin, newPeriod);\\n if (lastRewardAmount > 0) {\\n _unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), lastRewardAmount, DEFAULT_ADDITION_GAS);\\n }\\n\\n unchecked {\\n ++i;\\n }\\n }\\n\\n emit PoolsDeprecated(poolIds);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function stake(\\n TConsensus consensusAddr\\n ) external payable override noEmptyValue poolOfConsensusIsActive(consensusAddr) {\\n address poolId = __css2cid(consensusAddr);\\n _stake(_poolDetail[poolId], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function unstake(\\n TConsensus consensusAddr,\\n uint256 amount\\n ) external override nonReentrant poolOfConsensusIsActive(consensusAddr) {\\n if (amount == 0) revert ErrUnstakeZeroAmount();\\n address requester = msg.sender;\\n address poolId = __css2cid(consensusAddr);\\n PoolDetail storage _pool = _poolDetail[poolId];\\n uint256 remainAmount = _pool.stakingAmount - amount;\\n if (remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\\n\\n _unstake(_pool, requester, amount);\\n if (!_unsafeSendRONLimitGas(payable(requester), amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestRenounce(\\n TConsensus consensusAddr\\n )\\n external\\n override\\n poolOfConsensusIsActive(consensusAddr)\\n onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender)\\n {\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestRenounceCandidate(\\n __css2cid(consensusAddr),\\n _waitingSecsToRevoke\\n );\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestEmergencyExit(\\n TConsensus consensusAddr\\n )\\n external\\n override\\n poolOfConsensusIsActive(consensusAddr)\\n onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender)\\n {\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestEmergencyExit(\\n __css2cid(consensusAddr),\\n _waitingSecsToRevoke\\n );\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-applyValidatorCandidate`\\n */\\n function _applyValidatorCandidate(\\n address payable poolAdmin,\\n address candidateAdmin,\\n address poolId,\\n address payable treasuryAddr,\\n bytes memory pubkey,\\n uint256 commissionRate,\\n uint256 amount\\n ) internal {\\n if (!_unsafeSendRONLimitGas(poolAdmin, 0, DEFAULT_ADDITION_GAS)) {\\n revert ErrCannotInitTransferRON(poolAdmin, \\\"pool admin\\\");\\n }\\n if (!_unsafeSendRONLimitGas(treasuryAddr, 0, DEFAULT_ADDITION_GAS)) {\\n revert ErrCannotInitTransferRON(treasuryAddr, \\\"treasury\\\");\\n }\\n if (amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\\n if (poolAdmin != candidateAdmin || candidateAdmin != treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\\n\\n {\\n address[] memory diffAddrs = new address[](3);\\n diffAddrs[0] = poolAdmin;\\n diffAddrs[1] = poolId;\\n if (AddressArrayUtils.hasDuplicate(diffAddrs)) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate({\\n candidateAdmin: candidateAdmin,\\n cid: poolId,\\n treasuryAddr: treasuryAddr,\\n commissionRate: commissionRate\\n });\\n\\n IProfile profileContract = IProfile(getContract(ContractType.PROFILE));\\n profileContract.execApplyValidatorCandidate(candidateAdmin, poolId, treasuryAddr, pubkey);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-stake`\\n */\\n function _stake(\\n PoolDetail storage _pool,\\n address requester,\\n uint256 amount\\n ) internal onlyPoolAdmin(_pool, requester) {\\n _pool.stakingAmount += amount;\\n _changeDelegatingAmount(_pool, requester, _pool.stakingAmount, _pool.stakingTotal + amount);\\n _pool.lastDelegatingTimestamp[requester] = block.timestamp;\\n emit Staked(_pool.pid, amount);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-unstake`\\n */\\n function _unstake(\\n PoolDetail storage _pool,\\n address requester,\\n uint256 amount\\n ) internal onlyPoolAdmin(_pool, requester) {\\n if (amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\\n if (_pool.lastDelegatingTimestamp[requester] + _cooldownSecsToUndelegate > block.timestamp) {\\n revert ErrUnstakeTooEarly();\\n }\\n\\n _pool.stakingAmount -= amount;\\n _changeDelegatingAmount(_pool, requester, _pool.stakingAmount, _pool.stakingTotal - amount);\\n emit Unstaked(_pool.pid, amount);\\n }\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Emits the event `Unstaked`.\\n *\\n * @return The actual deducted amount\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 amount) internal virtual returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function _setMinValidatorStakingAmount(uint256 threshold) internal {\\n _minValidatorStakingAmount = threshold;\\n emit MinValidatorStakingAmountUpdated(threshold);\\n }\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function _setCommissionRateRange(uint256 minRate, uint256 maxRate) internal {\\n if (maxRate > _MAX_PERCENTAGE || minRate > maxRate) revert ErrInvalidCommissionRate();\\n _maxCommissionRate = maxRate;\\n _minCommissionRate = minRate;\\n emit CommissionRateRangeUpdated(minRate, maxRate);\\n }\\n}\\n\",\"keccak256\":\"0x87c6fe61162e737eced9b604d9f90ac29dea407b8eaf6b1dbc3f7f16d1d7f83e\",\"license\":\"MIT\"},\"contracts/ronin/staking/DelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IDelegatorStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegate(TConsensus consensusAddr) external payable noEmptyValue poolOfConsensusIsActive(consensusAddr) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n _delegate(_poolDetail[__css2cid(consensusAddr)], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function undelegate(TConsensus consensusAddr, uint256 amount) external nonReentrant {\\n address payable delegator = payable(msg.sender);\\n _undelegate(consensusAddr, _poolDetail[__css2cid(consensusAddr)], delegator, amount);\\n if (!_sendRON(delegator, amount)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external nonReentrant {\\n if (consensusAddrs.length == 0 || consensusAddrs.length != amounts.length) revert ErrInvalidArrays();\\n\\n address payable delegator = payable(msg.sender);\\n uint256 total;\\n\\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\\n for (uint i = 0; i < poolIds.length; ) {\\n total += amounts[i];\\n _undelegate(consensusAddrs[i], _poolDetail[poolIds[i]], delegator, amounts[i]);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n\\n if (!_sendRON(delegator, total)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function redelegate(\\n TConsensus consensusAddrSrc,\\n TConsensus consensusAddrDst,\\n uint256 amount\\n ) external nonReentrant poolOfConsensusIsActive(consensusAddrDst) {\\n address delegator = msg.sender;\\n _undelegate(consensusAddrSrc, _poolDetail[__css2cid(consensusAddrSrc)], delegator, amount);\\n _delegate(_poolDetail[__css2cid(consensusAddrDst)], delegator, amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function claimRewards(\\n TConsensus[] calldata consensusAddrList\\n ) external override nonReentrant returns (uint256 amount) {\\n amount = _claimRewards(msg.sender, __css2cidBatch(consensusAddrList));\\n _transferRON(payable(msg.sender), amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegateRewards(\\n TConsensus[] calldata consensusAddrList,\\n TConsensus consensusAddrDst\\n ) external override nonReentrant poolOfConsensusIsActive(consensusAddrDst) returns (uint256 amount) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n address[] memory poolIds = __css2cidBatch(consensusAddrList);\\n address poolIdDst = __css2cid(consensusAddrDst);\\n return _delegateRewards(msg.sender, poolIds, poolIdDst);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function getRewards(\\n address user,\\n TConsensus[] calldata consensusAddrs\\n ) external view returns (uint256[] memory rewards_) {\\n uint256 period = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\\n rewards_ = new uint256[](consensusAddrs.length);\\n\\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\\n for (uint256 i = 0; i < consensusAddrs.length; ) {\\n address poolId = poolIds[i];\\n rewards_[i] = _getReward(poolId, user, period, _getStakingAmount(poolId, user));\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Delegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n * Note: This function does not verify the `msg.value` with the amount.\\n *\\n */\\n function _delegate(\\n PoolDetail storage _pool,\\n address delegator,\\n uint256 amount\\n ) internal anyExceptPoolAdmin(_pool, delegator) {\\n _changeDelegatingAmount(_pool, delegator, _pool.delegatingAmount[delegator] + amount, _pool.stakingTotal + amount);\\n _pool.lastDelegatingTimestamp[delegator] = block.timestamp;\\n emit Delegated(delegator, _pool.pid, amount);\\n }\\n\\n /**\\n * @dev Undelegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n * - The amount is larger than 0.\\n * - The delegating amount is larger than or equal to the undelegating amount.\\n *\\n * Emits the `Undelegated` event.\\n *\\n * Note: Consider transferring back the amount of RON after calling this function.\\n *\\n */\\n function _undelegate(\\n TConsensus consensusAddr,\\n PoolDetail storage _pool,\\n address delegator,\\n uint256 amount\\n ) private anyExceptPoolAdmin(_pool, delegator) {\\n if (amount == 0) revert ErrUndelegateZeroAmount();\\n if (_pool.delegatingAmount[delegator] < amount) revert ErrInsufficientDelegatingAmount();\\n\\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\\n if (\\n validatorContract.isValidatorCandidate(consensusAddr) &&\\n validatorContract.getCandidateInfo(consensusAddr).revokingTimestamp == 0 && // if candidate is not on renunciation\\n _pool.lastDelegatingTimestamp[delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\\n ) revert ErrUndelegateTooEarly();\\n\\n _changeDelegatingAmount(_pool, delegator, _pool.delegatingAmount[delegator] - amount, _pool.stakingTotal - amount);\\n emit Undelegated(delegator, _pool.pid, amount);\\n }\\n\\n /**\\n * @dev Claims rewards from the pools `_poolAddrList`.\\n * Note: This function does not transfer reward to user.\\n */\\n function _claimRewards(address user, address[] memory poolIds) internal returns (uint256 amount) {\\n uint256 period = _currentPeriod();\\n for (uint256 i = 0; i < poolIds.length; ) {\\n amount += _claimReward(poolIds[i], user, period);\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n */\\n function _delegateRewards(\\n address user,\\n address[] memory poolIds,\\n address poolIdDst\\n ) internal returns (uint256 amount) {\\n amount = _claimRewards(user, poolIds);\\n _delegate(_poolDetail[poolIdDst], user, amount);\\n }\\n}\\n\",\"keccak256\":\"0xa0281f4fea9f20747dfffdaca61853e663206b8ac83b67576e8cd405d4a117a4\",\"license\":\"MIT\"},\"contracts/ronin/staking/RewardCalculation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IRewardPool.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport { TPoolId } from \\\"../../udvts/Types.sol\\\";\\n\\n/**\\n * @title RewardCalculation contract\\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\\n */\\nabstract contract RewardCalculation is IRewardPool {\\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\\n /// @dev Mapping from the pool address => user address => the reward info of the user\\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\\n /// @dev Mapping from the pool address => reward pool fields\\n mapping(address => PoolFields) private _stakingPool;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256) {\\n address poolId = TConsensus.unwrap(consensusAddr);\\n return _getReward(poolId, user, _currentPeriod(), _getStakingAmount(poolId, user));\\n }\\n\\n /**\\n * @dev See {IRewardPool-getStakingAmount}\\n */\\n function _getStakingAmount(address poolId, address user) internal view virtual returns (uint256);\\n\\n /**\\n * @dev See {IRewardPool-getStakingTotal}\\n */\\n function _getStakingTotal(address poolId) internal view virtual returns (uint256);\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function _getReward(\\n address poolId,\\n address user,\\n uint256 latestPeriod,\\n uint256 latestStakingAmount\\n ) internal view returns (uint256) {\\n UserRewardFields storage _reward = _userReward[poolId][user];\\n\\n if (_reward.lastPeriod == latestPeriod) {\\n return _reward.debited;\\n }\\n\\n uint256 aRps;\\n uint256 lastPeriodReward;\\n PoolFields storage _pool = _stakingPool[poolId];\\n PeriodWrapper storage _wrappedArps = _accumulatedRps[poolId][_reward.lastPeriod];\\n\\n if (_wrappedArps.lastPeriod > 0) {\\n // Calculates the last period reward if the aRps at the period is set\\n aRps = _wrappedArps.inner;\\n lastPeriodReward = _reward.lowestAmount * (aRps - _reward.aRps);\\n } else {\\n // Fallbacks to the previous aRps in case the aRps is not set\\n aRps = _reward.aRps;\\n }\\n\\n uint256 newPeriodsReward = latestStakingAmount * (_pool.aRps - aRps);\\n return _reward.debited + (lastPeriodReward + newPeriodsReward) / 1e18;\\n }\\n\\n /**\\n * @dev Syncs the user reward.\\n *\\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\\n *\\n * Note: The method should be called whenever the user's staking amount changes.\\n *\\n */\\n function _syncUserReward(address poolId, address user, uint256 newStakingAmount) internal {\\n uint256 period = _currentPeriod();\\n PoolFields storage _pool = _stakingPool[poolId];\\n uint256 lastShares = _pool.shares.inner;\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < period) {\\n _pool.shares = PeriodWrapper(_getStakingTotal(poolId), period);\\n }\\n\\n UserRewardFields storage _reward = _userReward[poolId][user];\\n uint256 currentStakingAmount = _getStakingAmount(poolId, user);\\n uint256 debited = _getReward(poolId, user, period, currentStakingAmount);\\n\\n if (_reward.debited != debited) {\\n _reward.debited = debited;\\n emit UserRewardUpdated(poolId, user, debited);\\n }\\n\\n _syncMinStakingAmount(_pool, _reward, period, newStakingAmount, currentStakingAmount);\\n _reward.aRps = _pool.aRps;\\n _reward.lastPeriod = period;\\n\\n if (_pool.shares.inner != lastShares) {\\n emit PoolSharesUpdated(period, poolId, _pool.shares.inner);\\n }\\n }\\n\\n /**\\n * @dev Syncs the minimum staking amount of an user in the current period.\\n */\\n function _syncMinStakingAmount(\\n PoolFields storage _pool,\\n UserRewardFields storage _reward,\\n uint256 latestPeriod,\\n uint256 newStakingAmount,\\n uint256 currentStakingAmount\\n ) internal {\\n if (_reward.lastPeriod < latestPeriod) {\\n _reward.lowestAmount = currentStakingAmount;\\n }\\n\\n uint256 lowestAmount = Math.min(_reward.lowestAmount, newStakingAmount);\\n uint256 diffAmount = _reward.lowestAmount - lowestAmount;\\n if (diffAmount > 0) {\\n _reward.lowestAmount = lowestAmount;\\n if (_pool.shares.inner < diffAmount) revert ErrInvalidPoolShare();\\n _pool.shares.inner -= diffAmount;\\n }\\n }\\n\\n /**\\n * @dev Claims the settled reward for a specific user.\\n *\\n * @param lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\\n *\\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\\n *\\n * Note: This method should be called before transferring rewards for the user.\\n *\\n */\\n function _claimReward(address poolId, address user, uint256 lastPeriod) internal returns (uint256 amount) {\\n uint256 currentStakingAmount = _getStakingAmount(poolId, user);\\n amount = _getReward(poolId, user, lastPeriod, currentStakingAmount);\\n emit RewardClaimed(poolId, user, amount);\\n\\n UserRewardFields storage _reward = _userReward[poolId][user];\\n _reward.debited = 0;\\n _syncMinStakingAmount(_stakingPool[poolId], _reward, lastPeriod, currentStakingAmount, currentStakingAmount);\\n _reward.lastPeriod = lastPeriod;\\n _reward.aRps = _stakingPool[poolId].aRps;\\n emit UserRewardUpdated(poolId, user, 0);\\n }\\n\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `poolIds`.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function _recordRewards(address[] memory poolIds, uint256[] calldata rewards, uint256 period) internal {\\n if (poolIds.length != rewards.length) {\\n emit PoolsUpdateFailed(period, poolIds, rewards);\\n return;\\n }\\n\\n uint256 rps;\\n uint256 count;\\n address poolId;\\n uint256 stakingTotal;\\n uint256[] memory aRps = new uint256[](poolIds.length);\\n uint256[] memory shares = new uint256[](poolIds.length);\\n address[] memory conflicted = new address[](poolIds.length);\\n\\n for (uint i = 0; i < poolIds.length; i++) {\\n poolId = poolIds[i];\\n PoolFields storage _pool = _stakingPool[poolId];\\n stakingTotal = _getStakingTotal(poolId);\\n\\n if (_accumulatedRps[poolId][period].lastPeriod == period) {\\n unchecked {\\n conflicted[count++] = poolId;\\n }\\n continue;\\n }\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < period) {\\n _pool.shares = PeriodWrapper(stakingTotal, period);\\n }\\n\\n // The rps is 0 if no one stakes for the pool\\n rps = _pool.shares.inner == 0 ? 0 : (rewards[i] * 1e18) / _pool.shares.inner;\\n aRps[i - count] = _pool.aRps += rps;\\n _accumulatedRps[poolId][period] = PeriodWrapper(_pool.aRps, period);\\n _pool.shares.inner = stakingTotal;\\n shares[i - count] = _pool.shares.inner;\\n poolIds[i - count] = poolId;\\n }\\n\\n if (count > 0) {\\n assembly {\\n mstore(conflicted, count)\\n mstore(poolIds, sub(mload(poolIds), count))\\n }\\n emit PoolsUpdateConflicted(period, conflicted);\\n }\\n\\n if (poolIds.length > 0) {\\n emit PoolsUpdated(period, poolIds, aRps, shares);\\n }\\n }\\n\\n /**\\n * @dev Returns the current period.\\n */\\n function _currentPeriod() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0xfc401852211d7546d72981f8367d716aa154bf048fbeedeb7582643eb7b39ed6\",\"license\":\"MIT\"},\"contracts/ronin/staking/Staking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./StakingCallback.sol\\\";\\n\\ncontract Staking is IStaking, StakingCallback, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n receive() external payable onlyContract(ContractType.VALIDATOR) {}\\n\\n fallback() external payable onlyContract(ContractType.VALIDATOR) {}\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __minValidatorStakingAmount,\\n uint256 __maxCommissionRate,\\n uint256 __cooldownSecsToUndelegate,\\n uint256 __waitingSecsToRevoke\\n ) external initializer {\\n _setContract(ContractType.VALIDATOR, __validatorContract);\\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\\n _setCommissionRateRange(0, __maxCommissionRate);\\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\\n }\\n\\n /**\\n * @dev Initializes the contract storage V2.\\n */\\n function initializeV2() external reinitializer(2) {\\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\\n delete ______deprecatedValidator;\\n }\\n\\n /**\\n * @dev Initializes the contract storage V3.\\n */\\n function initializeV3(address __profileContract) external reinitializer(3) {\\n _setContract(ContractType.PROFILE, __profileContract);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execRecordRewards(\\n address[] calldata poolIds,\\n uint256[] calldata rewards,\\n uint256 period\\n ) external payable override onlyContract(ContractType.VALIDATOR) {\\n _recordRewards(poolIds, rewards, period);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execDeductStakingAmount(\\n address poolId,\\n uint256 amount\\n ) external override onlyContract(ContractType.VALIDATOR) returns (uint256 actualDeductingAmount_) {\\n actualDeductingAmount_ = _deductStakingAmount(_poolDetail[poolId], amount);\\n address payable validatorContractAddr = payable(msg.sender);\\n if (!_unsafeSendRON(validatorContractAddr, actualDeductingAmount_)) {\\n emit StakingAmountDeductFailed(poolId, validatorContractAddr, actualDeductingAmount_, address(this).balance);\\n }\\n }\\n\\n /**\\n * @inheritdoc RewardCalculation\\n */\\n function _currentPeriod() internal view virtual override returns (uint256) {\\n return IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\\n }\\n\\n /**\\n * @inheritdoc CandidateStaking\\n */\\n function _deductStakingAmount(\\n PoolDetail storage _pool,\\n uint256 amount\\n ) internal override returns (uint256 actualDeductingAmount_) {\\n actualDeductingAmount_ = Math.min(_pool.stakingAmount, amount);\\n\\n _pool.stakingAmount -= actualDeductingAmount_;\\n _changeDelegatingAmount(\\n _pool,\\n _pool.__shadowedPoolAdmin,\\n _pool.stakingAmount,\\n Math.subNonNegative(_pool.stakingTotal, actualDeductingAmount_)\\n );\\n emit Unstaked(_pool.pid, actualDeductingAmount_);\\n }\\n}\\n\",\"keccak256\":\"0x8879826b414931b8c783c16cea4bddabc8c28bb18cfe22b3e03a107a7175a5e7\",\"license\":\"MIT\"},\"contracts/ronin/staking/StakingCallback.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\nimport \\\"../../interfaces/IProfile.sol\\\";\\nimport \\\"../../interfaces/staking/IStakingCallback.sol\\\";\\nimport \\\"./CandidateStaking.sol\\\";\\nimport \\\"./DelegatorStaking.sol\\\";\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract StakingCallback is CandidateStaking, DelegatorStaking, IStakingCallback {\\n /**\\n * @dev Requirements:\\n * - Only Profile contract can call this method.\\n */\\n function execChangeAdminAddress(\\n address poolAddr,\\n address newAdminAddr\\n ) external override onlyContract(ContractType.PROFILE) {\\n PoolDetail storage _pool = _poolDetail[poolAddr];\\n\\n _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin] = address(0);\\n _pool.__shadowedPoolAdmin = newAdminAddr;\\n _adminOfActivePoolMapping[newAdminAddr] = poolAddr;\\n }\\n}\\n\",\"keccak256\":\"0xee1b68fbdfe999a377a59356fe28251ca4686b1efcb60e8f4c5b0165e5f212a1\",\"license\":\"MIT\"},\"contracts/udvts/Types.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ntype TPoolId is address;\\ntype TConsensus is address;\\n\\nusing { TPoolIdEq as == } for TPoolId global;\\nusing { TConsensusEq as == } for TConsensus global;\\n\\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\\n}\\n\\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\\n}\\n\",\"keccak256\":\"0x3017524670c86eaf3930447e482b6f372ae091bb5f8eb89570924599fa626ed7\",\"license\":\"MIT\"},\"contracts/utils/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { ContractType } from \\\"./ContractType.sol\\\";\\nimport { RoleAccess } from \\\"./RoleAccess.sol\\\";\\n\\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\\n\\n/**\\n * @dev Error raised when a bridge operator update operation fails.\\n * @param bridgeOperator The address of the bridge operator that failed to update.\\n */\\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\\n\\n/**\\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\\n */\\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\\n\\n/**\\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\\n */\\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\\n\\n/**\\n * @dev The error indicating an unsupported interface.\\n * @param interfaceId The bytes4 interface identifier that is not supported.\\n * @param addr The address where the unsupported interface was encountered.\\n */\\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\\n\\n/**\\n * @dev Error thrown when the return data from a callback function is invalid.\\n * @param callbackFnSig The signature of the callback function that returned invalid data.\\n * @param register The address of the register where the callback function was invoked.\\n * @param returnData The invalid return data received from the callback function.\\n */\\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\\n\\n/**\\n * @dev Error of set to non-contract.\\n */\\nerror ErrZeroCodeContract(address addr);\\n\\n/**\\n * @dev Error indicating that arguments are invalid.\\n */\\nerror ErrInvalidArguments(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that given address is null when it should not.\\n */\\nerror ErrZeroAddress(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\\n */\\nerror ErrInvalidThreshold(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a function can only be called by the contract itself.\\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\\n */\\nerror ErrOnlySelfCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n * @param expectedRole The role required to perform the function.\\n */\\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\\n */\\nerror ErrUnauthorizedCall(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\\n * @param msgSig The function signature (bytes4).\\n * @param expectedContractType The contract type required to perform the function.\\n * @param actual The actual address that called to the function.\\n */\\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\\n\\n/**\\n * @dev Error indicating that an array is empty when it should contain elements.\\n */\\nerror ErrEmptyArray();\\n\\n/**\\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\\n * @param msgSig The function signature (bytes4) that has a length mismatch.\\n */\\nerror ErrLengthMismatch(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a proxy call to an external contract has failed.\\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\\n */\\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\\n\\n/**\\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\\n */\\nerror ErrCallPrecompiled(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a native token transfer has failed.\\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\\n */\\nerror ErrNativeTransferFailed(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that an order is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\\n */\\nerror ErrInvalidOrder(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the chain ID is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\\n * @param actual Current chain ID that executing function.\\n * @param expected Expected chain ID required for the tx to success.\\n */\\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\\n\\n/**\\n * @dev Error indicating that a vote type is not supported.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\\n */\\nerror ErrUnsupportedVoteType(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that the proposal nonce is invalid.\\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\\n */\\nerror ErrInvalidProposalNonce(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a voter has already voted.\\n * @param voter The address of the voter who has already voted.\\n */\\nerror ErrAlreadyVoted(address voter);\\n\\n/**\\n * @dev Error indicating that a signature is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\\n */\\nerror ErrInvalidSignatures(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a relay call has failed.\\n * @param msgSig The function signature (bytes4) of the relay call that failed.\\n */\\nerror ErrRelayFailed(bytes4 msgSig);\\n/**\\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\\n */\\nerror ErrInvalidVoteWeight(bytes4 msgSig);\\n\\n/**\\n * @dev Error indicating that a query was made for an outdated bridge operator set.\\n */\\nerror ErrQueryForOutdatedBridgeOperatorSet();\\n\\n/**\\n * @dev Error indicating that a request is invalid.\\n */\\nerror ErrInvalidRequest();\\n\\n/**\\n * @dev Error indicating that a token standard is invalid.\\n */\\nerror ErrInvalidTokenStandard();\\n\\n/**\\n * @dev Error indicating that a token is not supported.\\n */\\nerror ErrUnsupportedToken();\\n\\n/**\\n * @dev Error indicating that a receipt kind is invalid.\\n */\\nerror ErrInvalidReceiptKind();\\n\\n/**\\n * @dev Error indicating that a receipt is invalid.\\n */\\nerror ErrInvalidReceipt();\\n\\n/**\\n * @dev Error indicating that an address is not payable.\\n */\\nerror ErrNonpayableAddress(address);\\n\\n/**\\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\\n */\\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\\n\\n/**\\n * @dev Error thrown when an invalid vote hash is provided.\\n */\\nerror ErrInvalidVoteHash();\\n\\n/**\\n * @dev Error thrown when querying for an empty vote.\\n */\\nerror ErrQueryForEmptyVote();\\n\\n/**\\n * @dev Error thrown when querying for an expired vote.\\n */\\nerror ErrQueryForExpiredVote();\\n\\n/**\\n * @dev Error thrown when querying for a non-existent vote.\\n */\\nerror ErrQueryForNonExistentVote();\\n\\n/**\\n * @dev Error indicating that the method is only called once per block.\\n */\\nerror ErrOncePerBlock();\\n\\n/**\\n * @dev Error of method caller must be coinbase\\n */\\nerror ErrCallerMustBeCoinbase();\\n\",\"keccak256\":\"0x7e228d0dbe377086fb2f7438b1e79b4e30b4eeb0225036b90a33effc5af06197\",\"license\":\"MIT\"},\"contracts/utils/ContractType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum ContractType {\\n /* 0 */ UNKNOWN,\\n /* 1 */ PAUSE_ENFORCER,\\n /* 2 */ BRIDGE,\\n /* 3 */ BRIDGE_TRACKING,\\n /* 4 */ GOVERNANCE_ADMIN,\\n /* 5 */ MAINTENANCE,\\n /* 6 */ SLASH_INDICATOR,\\n /* 7 */ STAKING_VESTING,\\n /* 8 */ VALIDATOR,\\n /* 9 */ STAKING,\\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\\n /* 11 */ BRIDGE_MANAGER,\\n /* 12 */ BRIDGE_SLASH,\\n /* 13 */ BRIDGE_REWARD,\\n /* 14 */ FAST_FINALITY_TRACKING,\\n /* 15 */ PROFILE\\n}\\n\",\"keccak256\":\"0x7f547a44265f4c4b03d8971f7fc5eaa2e6064ea8cd509c1b761108f9800dab68\",\"license\":\"MIT\"},\"contracts/utils/DeprecatedSlots.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Deprecated Contracts\\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\\n * They provide functionality related to various aspects of a smart contract but have been marked\\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\\n */\\ncontract HasSlashIndicatorDeprecated {\\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\\n address internal ______deprecatedSlashIndicator;\\n}\\n\\ncontract HasStakingVestingDeprecated {\\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\\n address internal ______deprecatedStakingVesting;\\n}\\n\\ncontract HasBridgeDeprecated {\\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\\n address internal ______deprecatedBridge;\\n}\\n\\ncontract HasValidatorDeprecated {\\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\\n address internal ______deprecatedValidator;\\n}\\n\\ncontract HasStakingDeprecated {\\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\\n address internal ______deprecatedStakingContract;\\n}\\n\\ncontract HasMaintenanceDeprecated {\\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\\n address internal ______deprecatedMaintenance;\\n}\\n\\ncontract HasTrustedOrgDeprecated {\\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\\n address internal ______deprecatedTrustedOrg;\\n}\\n\\ncontract HasGovernanceAdminDeprecated {\\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\\n address internal ______deprecatedGovernanceAdmin;\\n}\\n\\ncontract HasBridgeTrackingDeprecated {\\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\\n address internal ______deprecatedBridgeTracking;\\n}\\n\",\"keccak256\":\"0xe93504aed9f67a6d399475c7162560f2ac4f793fab5b67fe504fc694ac9a2892\",\"license\":\"MIT\"},\"contracts/utils/IdentityGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport { AddressArrayUtils } from \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport { IERC165 } from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport { TransparentUpgradeableProxyV2 } from \\\"../extensions/TransparentUpgradeableProxyV2.sol\\\";\\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \\\"./CommonErrors.sol\\\";\\n\\nabstract contract IdentityGuard {\\n using AddressArrayUtils for address[];\\n\\n /// @dev value is equal to keccak256(abi.encode())\\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n\\n /**\\n * @dev Modifier to restrict functions to only be called by this contract.\\n * @dev Reverts if the caller is not this contract.\\n */\\n modifier onlySelfCall() virtual {\\n _requireSelfCall();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\\n *\\n * Requirements:\\n * - The elements in the `arr` array must not contain any duplicates.\\n */\\n modifier nonDuplicate(address[] memory arr) virtual {\\n _requireNonDuplicate(arr);\\n _;\\n }\\n\\n /**\\n * @dev Internal method to check the method caller.\\n * @dev Reverts if the method caller is not this contract.\\n */\\n function _requireSelfCall() internal view virtual {\\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to check if a contract address has code.\\n * @param addr The address of the contract to check.\\n * @dev Throws an error if the contract address has no code.\\n */\\n function _requireHasCode(address addr) internal view {\\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\\n }\\n\\n /**\\n * @dev Checks if an address is zero and reverts if it is.\\n * @param addr The address to check.\\n */\\n function _requireNonZeroAddress(address addr) internal pure {\\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\\n }\\n\\n /**\\n * @dev Check if arr is empty and revert if it is.\\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\\n * @param arr The array of addresses to check.\\n */\\n function _requireNonDuplicate(address[] memory arr) internal pure {\\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\\n }\\n\\n /**\\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\\n * @notice This method only works with non-state EOA accounts\\n */\\n function _requireCreatedEOA(address addr) internal view {\\n _requireNonZeroAddress(addr);\\n bytes32 codehash = addr.codehash;\\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\\n }\\n\\n /**\\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\\n *\\n * @param contractAddr The address of the contract to check for interface support.\\n * @param interfaceId The interface ID to check for support.\\n */\\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\\n if (!success) {\\n (success, returnOrRevertData) = contractAddr.staticcall(\\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\\n );\\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\\n }\\n}\\n\",\"keccak256\":\"0x2d0dfcef3636945bc1785c1fa5a05f5203c79cbb81b2eee92a3ac6a2378c2ce5\",\"license\":\"MIT\"},\"contracts/utils/RoleAccess.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nenum RoleAccess {\\n /* 0 */ UNKNOWN,\\n /* 1 */ ADMIN,\\n /* 2 */ COINBASE,\\n /* 3 */ GOVERNOR,\\n /* 4 */ CANDIDATE_ADMIN,\\n /* 5 */ WITHDRAWAL_MIGRATOR,\\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\\n /* 7 */ BLOCK_PRODUCER,\\n /* 8 */ VALIDATOR_CANDIDATE,\\n /* 9 */ CONSENSUS,\\n /* 10 */ TREASURY\\n}\\n\",\"keccak256\":\"0x7da4631824b53be17e246102ad59458f91f2395710561ac9bface18d35fb2502\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060016000556200002162000027565b620000e9565b60d154610100900460ff1615620000945760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60d15460ff9081161015620000e75760d1805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61425380620000f96000396000f3fe6080604052600436106102765760003560e01c80636b0916951161014f578063aa15a6fd116100c1578063de981f1b1161007a578063de981f1b146107a9578063e22d1c9d146107c9578063ea80d67d146107e9578063ef9aa66514610809578063f92ad21914610829578063f9f031df1461084957610288565b8063aa15a6fd146106ab578063acd79c46146106cb578063af245429146106de578063c2a672e0146106f3578063c508700314610713578063d01b8eed1461076457610288565b8063895ab74211610113578063895ab742146105f6578063909791dd1461061657806391f8723f1461062b578063924f081e1461064b5780639488e4e91461066b578063969ffc141461068b57610288565b80636b091695146105565780636bd8f8041461057657806376664b6514610596578063865e6fd3146105b6578063888b9ae9146105d657610288565b806342ef3c34116101e857806357473447116101ac57806357473447146104b75780635a2ac073146104d75780635c19a95c146104f75780635cd8a76b1461050a5780636558954f1461051f578063679a6e431461053657610288565b806342ef3c341461040f578063435628ba1461042f578063446850a11461044f5780634530d2021461046f5780634d99dd161461049757610288565b806318a749a71161023a57806318a749a71461033e57806326476204146103515780632715805e146103645780633101cfcb146103845780633d8e846e146103a457806342e0c408146103c457610288565b806303827884146102935780630682e8fa146102bc578063095f6475146102d1578063097e4a9d146102fe5780631658c86e1461031e57610288565b3661028857600861028681610869565b005b600861028681610869565b34801561029f57600080fd5b506102a96104b081565b6040519081526020015b60405180910390f35b3480156102c857600080fd5b506038546102a9565b3480156102dd57600080fd5b506102f16102ec36600461379e565b6108c1565b6040516102b39190613844565b34801561030a57600080fd5b506102a961031936600461386c565b61094c565b34801561032a57600080fd5b506102866103393660046138c2565b610a20565b61028661034c3660046138df565b610aea565b61028661035f3660046138c2565b610c81565b34801561037057600080fd5b506102a961037f366004613991565b610cc9565b34801561039057600080fd5b5061028661039f3660046138c2565b610d5a565b3480156103b057600080fd5b506102f16103bf3660046139bd565b610dfd565b3480156103d057600080fd5b506103ff6103df3660046138c2565b6001600160a01b039081166000908152603a602052604090205416151590565b60405190151581526020016102b3565b34801561041b57600080fd5b506102f161042a366004613a11565b610f60565b34801561043b57600080fd5b506102f161044a36600461379e565b610fb5565b34801561045b57600080fd5b506102f161046a366004613a11565b61102d565b34801561047b57600080fd5b50606e54606d54604080519283526020830191909152016102b3565b3480156104a357600080fd5b506102866104b2366004613991565b611072565b3480156104c357600080fd5b506102866104d2366004613a52565b611107565b3480156104e357600080fd5b506102f16104f2366004613a11565b61111d565b6102866105053660046138c2565b61115b565b34801561051657600080fd5b506102866111dd565b34801561052b57600080fd5b506102a96201518081565b34801561054257600080fd5b50610286610551366004613a74565b61129c565b34801561056257600080fd5b506102a9610571366004613a8d565b6112ad565b34801561058257600080fd5b50610286610591366004613ac6565b6112c7565b3480156105a257600080fd5b506102a96105b1366004613a8d565b611374565b3480156105c257600080fd5b506102866105d1366004613b16565b61138c565b3480156105e257600080fd5b506102866105f1366004613a74565b6113a7565b34801561060257600080fd5b506102a96106113660046138c2565b6113b8565b34801561062257600080fd5b50606c546102a9565b34801561063757600080fd5b506102f1610646366004613a11565b6113e8565b34801561065757600080fd5b50610286610666366004613b32565b611433565b34801561067757600080fd5b5061028661068636600461379e565b611534565b34801561069757600080fd5b506102866106a6366004613a74565b6116c3565b3480156106b757600080fd5b506102866106c63660046138c2565b6116d4565b6102866106d9366004613b67565b611737565b3480156106ea57600080fd5b506039546102a9565b3480156106ff57600080fd5b5061028661070e366004613991565b61178b565b34801561071f57600080fd5b5061074c61072e3660046138c2565b6001600160a01b039081166000908152603a60205260409020541690565b6040516001600160a01b0390911681526020016102b3565b34801561077057600080fd5b5061078461077f3660046138c2565b611852565b604080516001600160a01b0390941684526020840192909252908201526060016102b3565b3480156107b557600080fd5b5061074c6107c4366004613bda565b611899565b3480156107d557600080fd5b506102866107e4366004613bf5565b611914565b3480156107f557600080fd5b50610286610804366004613a8d565b611aaf565b34801561081557600080fd5b506107846108243660046138c2565b611b18565b34801561083557600080fd5b50610286610844366004613c40565b611b5f565b34801561085557600080fd5b506102a9610864366004613a11565b611c56565b61087281611899565b6001600160a01b0316336001600160a01b0316146108be576000356001600160e01b03191681336040516320e0f98d60e21b81526004016108b593929190613cae565b60405180910390fd5b50565b60606000610901868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b905061094081858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611d5a92505050565b9150505b949350505050565b60006002600054036109705760405162461bcd60e51b81526004016108b590613ce5565b60026000558161097f81611e37565b336000908152603a60205260409020546001600160a01b0316156109b857604051632fc6bfb160e21b81523360048201526024016108b5565b60006109f6868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b90506000610a0385611ee7565b9050610a10338383611f5f565b6001600055979650505050505050565b80610a2a81611e37565b60376000610a3784611ee7565b6001600160a01b03166001600160a01b0316815260200190815260200160002033610a628282611f91565b610a6c6008611899565b6001600160a01b031663dd716ad3610a8386611ee7565b6039546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610acc57600080fd5b505af1158015610ae0573d6000803e3d6000fd5b5050505050505050565b600260005403610b0c5760405162461bcd60e51b81526004016108b590613ce5565b60026000908155338152603a60205260409020546001600160a01b031615610b4957604051632fc6bfb160e21b81523360048201526024016108b5565b606d54831180610b5a5750606e5483105b15610b7857604051631b8454a360e21b815260040160405180910390fd5b600034905060003390506000879050610bce828a838a89898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508e92508b9150611fc19050565b6001600160a01b038082166000818152603760208181526040808420600181018054978a166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052610c308184866122a1565b826001600160a01b0316826001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a3505060016000555050505050505050565b610c8961234c565b80610c9381611e37565b6000610c9e83611ee7565b6001600160a01b0381166000908152603760205260409020909150610cc49033346122a1565b505050565b60006008610cd681610869565b6001600160a01b0384166000908152603760205260409020610cf8908461236f565b915033610d05818461240c565b610d5257604080518481524760208201526001600160a01b0380841692908816917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b505092915050565b60d154600390610100900460ff16158015610d7c575060d15460ff8083169116105b610d985760405162461bcd60e51b81526004016108b590613d1c565b60d1805461ffff191660ff831617610100179055610db7600f83612468565b60d1805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b60606000610e0b6008611899565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6c9190613d6a565b9050826001600160401b03811115610e8657610e86613d83565b604051908082528060200260200182016040528015610eaf578160200160208202803683370190505b5091506000610ef0858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b905060005b84811015610f56576000828281518110610f1157610f11613d99565b60200260200101519050610f30818986610f2b858d61250c565b61253b565b858381518110610f4257610f42613d99565b602090810291909101015250600101610ef5565b5050509392505050565b60606000610fa0848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b9050610fab81612637565b9150505b92915050565b606061102485858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250611d5a92505050565b95945050505050565b606061106b83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061263792505050565b9392505050565b6002600054036110945760405162461bcd60e51b81526004016108b590613ce5565b6002600090815533906110d69084906037906110af83611ee7565b6001600160a01b03166001600160a01b0316815260200190815260200160002083856126f7565b6110e0818361292c565b6110fd57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b61110f612974565b61111982826129ce565b5050565b606061106b838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612a3b92505050565b61116361234c565b8061116d81611e37565b336000908152603a60205260409020546001600160a01b0316156111a657604051632fc6bfb160e21b81523360048201526024016108b5565b611119603760006111b685611ee7565b6001600160a01b03166001600160a01b031681526020019081526020016000203334612aee565b60d154600290610100900460ff161580156111ff575060d15460ff8083169116105b61121b5760405162461bcd60e51b81526004016108b590613d1c565b60d1805461ffff191660ff831617610100179055603654611247906008906001600160a01b0316612468565b603680546001600160a01b031916905560d1805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b6112a4612974565b6108be81612b9d565b600082610fab81846112bd612bd2565b610f2b858861250c565b6002600054036112e95760405162461bcd60e51b81526004016108b590613ce5565b6002600055816112f881611e37565b33611331856037600061130a83611ee7565b6001600160a01b03166001600160a01b0316815260200190815260200160002083866126f7565b6113686037600061134187611ee7565b6001600160a01b03166001600160a01b031681526020019081526020016000208285612aee565b50506001600055505050565b60008061138084611ee7565b9050610fab818461250c565b611394612974565b61139d81612c44565b6111198282612468565b6113af612974565b6108be81612c7a565b6000806113c483611ee7565b905061106b816001600160a01b031660009081526037602052604090206003015490565b60606000611428848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b9050610fab81612a3b565b8261143d81611e37565b6037600061144a86611ee7565b6001600160a01b03166001600160a01b03168152602001908152602001600020336114758282611f91565b606d548411806114865750606e5484105b156114a457604051631b8454a360e21b815260040160405180910390fd5b6114ae6008611899565b6001600160a01b031663e5125a1d6114c588611ee7565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810188905260448101879052606401600060405180830381600087803b15801561151457600080fd5b505af1158015611528573d6000803e3d6000fd5b50505050505050505050565b6002600054036115565760405162461bcd60e51b81526004016108b590613ce5565b60026000558215806115685750828114155b15611586576040516376081a7b60e11b815260040160405180910390fd5b60003390506000806115ca878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b905060005b815181101561168d578585828181106115ea576115ea613d99565b90506020020135836115fc9190613dc5565b925061168588888381811061161357611613613d99565b905060200201602081019061162891906138c2565b6037600085858151811061163e5761163e613d99565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208689898681811061167957611679613d99565b905060200201356126f7565b6001016115cf565b50611698838361292c565b6116b557604051635ff7115760e11b815260040160405180910390fd5b505060016000555050505050565b6116cb612974565b6108be81612caf565b806116de81611e37565b603760006116eb84611ee7565b6001600160a01b03166001600160a01b03168152602001908152602001600020336117168282611f91565b6117206008611899565b6001600160a01b031663cdaa4e81610a8386611ee7565b600861174281610869565b611783868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250879150869050612ce4565b505050505050565b6002600054036117ad5760405162461bcd60e51b81526004016108b590613ce5565b6002600055816117bc81611e37565b816000036117dd576040516331d9f7d760e01b815260040160405180910390fd5b3360006117e985611ee7565b6001600160a01b0381166000908152603760205260408120600281015492935091611815908790613dd8565b9050606c5481101561183a5760405163ef0a995760e01b815260040160405180910390fd5b611845828588613112565b61169884876104b06131fe565b60008060008061186185611ee7565b6001600160a01b0390811660009081526037602052604090206001810154600282015460039092015492169790965090945092505050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f8111156118d0576118d0613c84565b60ff1681526020810191909152604001600020546001600160a01b031690508061190f578160405163409140df60e11b81526004016108b59190613deb565b919050565b600861191f81610869565b8215611aa95760005b83811015611a6e57600085858381811061194457611944613d99565b905060200201602081019061195991906138c2565b6001600160a01b03808216600090815260376020908152604080832060018101549094168352603a909152902080546001600160a01b03191690556002810154919250908015611a1d576119ad828261236f565b5060018201546119c9906001600160a01b0316826104b06131fe565b611a1d5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6001820154600090611a3a9085906001600160a01b03168961325e565b90508015611a5f576001830154611a5d906001600160a01b0316826104b06131fe565b505b84600101945050505050611928565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88484604051611aa0929190613df9565b60405180910390a15b50505050565b600f611aba81610869565b506001600160a01b039182166000818152603760209081526040808320600101805487168452603a90925280832080546001600160a01b03199081169091558254959096169486168517909155928152919091208054909216179055565b6000806000611b52846001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b9250925092509193909250565b60d154610100900460ff1615808015611b7f575060d154600160ff909116105b80611b995750303b158015611b99575060d15460ff166001145b611bb55760405162461bcd60e51b81526004016108b590613d1c565b60d1805460ff191660011790558015611bd85760d1805461ff0019166101001790555b611be3600887612468565b611bec85612b9d565b611bf76000856129ce565b611c0083612c7a565b611c0982612caf565b80156117835760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6000600260005403611c7a5760405162461bcd60e51b81526004016108b590613ce5565b6002600081905550611cc733611cc2858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b613370565b9050611cd333826133c1565b600160005592915050565b6060611cea600f611899565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b8152600401611d159190613e47565b600060405180830381865afa158015611d32573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610faf9190810190613ec4565b60608151835114611d7e576040516376081a7b60e11b815260040160405180910390fd5b82516001600160401b03811115611d9757611d97613d83565b604051908082528060200260200182016040528015611dc0578160200160208202803683370190505b50905060005b8151811015611e3057611e0b848281518110611de457611de4613d99565b6020026020010151848381518110611dfe57611dfe613d99565b602002602001015161250c565b828281518110611e1d57611e1d613d99565b6020908102919091010152600101611dc6565b5092915050565b611e416008611899565b604051635061f96960e11b81526001600160a01b038381166004830152919091169063a0c3f2d290602401602060405180830381865afa158015611e89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ead9190613f75565b6108be5780611ebb82611ee7565b604051631299fe7160e11b81526001600160a01b039283166004820152911660248201526044016108b5565b6000611ef3600f611899565b6040516350a9fc2960e01b81526001600160a01b03848116600483015291909116906350a9fc2990602401602060405180830381865afa158015611f3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610faf9190613f97565b6000611f6b8484613370565b6001600160a01b038316600090815260376020526040902090915061106b908583612aee565b60018201546001600160a01b0382811691161461111957604051637bc65bd760e11b815260040160405180910390fd5b611fcf8760006104b06131fe565b61201a576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b60648201526084016108b5565b6120288460006104b06131fe565b612071576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b60648201526084016108b5565b606c5481101561209457604051630a8d7fa760e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b03161415806120c75750836001600160a01b0316866001600160a01b031614155b156120e55760405163dc1d04ff60e01b815260040160405180910390fd5b6040805160038082526080820190925260009160208201606080368337019050509050878160008151811061211c5761211c613d99565b60200260200101906001600160a01b031690816001600160a01b031681525050858160018151811061215057612150613d99565b60200260200101906001600160a01b031690816001600160a01b031681525050612179816133f6565b156121a557604051630d697db160e11b81526001600160e01b03196000351660048201526024016108b5565b506121b06008611899565b60405163f883afaf60e01b81526001600160a01b0388811660048301528781166024830152868116604483015260648201859052919091169063f883afaf90608401600060405180830381600087803b15801561220c57600080fd5b505af1158015612220573d6000803e3d6000fd5b505050506000612230600f611899565b6040516307768f2160e51b81529091506001600160a01b0382169063eed1e42090612265908a908a908a908a90600401613fb4565b600060405180830381600087803b15801561227f57600080fd5b505af1158015612293573d6000803e3d6000fd5b505050505050505050505050565b82826122ad8282611f91565b828560020160008282546122c19190613dc5565b925050819055506122e7858587600201548689600301546122e29190613dc5565b613495565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9061233d9086815260200190565b60405180910390a25050505050565b3460000361236d57604051636dfcbde560e11b815260040160405180910390fd5b565b600061237f8360020154836134d0565b9050808360020160008282546123959190613dd8565b90915550506001830154600284015460038501546123c59286926001600160a01b03909116916122e290866134e6565b82546040518281526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612459576040519150601f19603f3d011682016040523d82523d6000602084013e61245e565b606091505b5090949350505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f81111561249e5761249e613c84565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f8111156124df576124df613c84565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b6001600160a01b0380851660009081526002602090815260408083209387168352929052908120600381015484900361257657549050610944565b6001600160a01b0386166000908152600360208181526040808420600180845282862094870154865293909252832091820154839290156125db57805460018601549094506125c59085613dd8565b85600201546125d49190614027565b92506125e3565b846001015493505b81546000906125f3908690613dd8565b6125fd9089614027565b9050670de0b6b3a76400006126128286613dc5565b61261c919061403e565b86546126289190613dc5565b9b9a5050505050505050505050565b606081516001600160401b0381111561265257612652613d83565b60405190808252806020026020018201604052801561267b578160200160208202803683370190505b50905060005b82518110156126f157603760008483815181106126a0576126a0613d99565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600201548282815181106126de576126de613d99565b6020908102919091010152600101612681565b50919050565b82826127038282613500565b8260000361272457604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561275f57604051630695534560e31b815260040160405180910390fd5b600061276b6008611899565b604051635061f96960e11b81526001600160a01b0389811660048301529192509082169063a0c3f2d290602401602060405180830381865afa1580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d99190613f75565b801561285057506040516328bde1e160e01b81526001600160a01b0388811660048301528216906328bde1e19060240160e060405180830381865afa158015612826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284a9190614060565b60a00151155b801561288357506038546001600160a01b0386166000908152600588016020526040902054429161288091613dc5565b10155b156128a15760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03851660009081526004870160205260409020546128df90879087906128cf908890613dd8565b878a600301546122e29190613dd8565b85546040518581526001600160a01b03918216918716907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c9060200160405180910390a350505050505050565b60008147101561296a576040516302631c4f60e61b81526001600160e01b0319600035166004820152476024820152604481018390526064016108b5565b61106b838361240c565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b0316331461236d576000356001600160e01b0319166001604051620f948f60ea1b81526004016108b5929190614107565b6127108111806129dd57508082115b156129fb57604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c149101610df1565b606081516001600160401b03811115612a5657612a56613d83565b604051908082528060200260200182016040528015612a7f578160200160208202803683370190505b50905060005b82518110156126f157612ac9838281518110612aa357612aa3613d99565b60200260200101516001600160a01b031660009081526037602052604090206003015490565b828281518110612adb57612adb613d99565b6020908102919091010152600101612a85565b8282612afa8282613500565b6001600160a01b0384166000908152600486016020526040902054612b389086908690612b28908790613dc5565b8689600301546122e29190613dc5565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b90612b8e9087815260200190565b60405180910390a35050505050565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be290602001611291565b6000612bde6008611899565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3f9190613d6a565b905090565b806001600160a01b03163b6000036108be57604051630bfc64a360e21b81526001600160a01b03821660048201526024016108b5565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a90602001611291565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c67890602001611291565b83518214612d2d57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a5858585604051612d209392919061416e565b60405180910390a2611aa9565b600080600080600088516001600160401b03811115612d4e57612d4e613d83565b604051908082528060200260200182016040528015612d77578160200160208202803683370190505b509050600089516001600160401b03811115612d9557612d95613d83565b604051908082528060200260200182016040528015612dbe578160200160208202803683370190505b50905060008a516001600160401b03811115612ddc57612ddc613d83565b604051908082528060200260200182016040528015612e05578160200160208202803683370190505b50905060005b8b51811015613078578b8181518110612e2657612e26613d99565b6020908102919091018101516001600160a01b038116600090815260038084526040808320603790955290912001549097506001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a9003612ec757868389806001019a5081518110612ea157612ea1613d99565b60200260200101906001600160a01b031690816001600160a01b03168152505050613066565b60028101548a1115612ef557604080518082019091528681526020018a905260018101869055600281018a90555b600181015415612f3f5760018101548c8c84818110612f1657612f16613d99565b90506020020135670de0b6b3a7640000612f309190614027565b612f3a919061403e565b612f42565b60005b985088816000016000828254612f589190613dc5565b9182905550905085612f6a8a85613dd8565b81518110612f7a57612f7a613d99565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461300d9190613dd8565b8151811061301d5761301d613d99565b6020908102919091010152868d6130348a85613dd8565b8151811061304457613044613d99565b60200260200101906001600160a01b031690816001600160a01b031681525050505b80613070816141b8565b915050612e0b565b5085156130c157858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a3826040516130b891906141d1565b60405180910390a25b8a511561310557877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c85856040516130fc939291906141e4565b60405180910390a25b5050505050505050505050565b828261311e8282611f91565b846002015483111561314357604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b0385166000908152600587016020526040902054429161316c91613dc5565b111561318b576040516303db082960e11b815260040160405180910390fd5b8285600201600082825461319f9190613dd8565b925050819055506131c0858587600201548689600301546122e29190613dd8565b84546040518481526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200161233d565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461324e576040519150601f19603f3d011682016040523d82523d6000602084013e613253565b606091505b509095945050505050565b60008061326b858561250c565b90506132798585858461253b565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b7846040516132c091815260200190565b60405180910390a36001600160a01b0380861660008181526002602090815260408083209489168352938152838220828155928252600390529190912061330a9082868580613530565b60038181018590556001600160a01b03878116600081815260209384526040808220546001870155519081529188169290917faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad910160405180910390a350509392505050565b60008061337b612bd2565b905060005b8351811015610d52576133ad84828151811061339e5761339e613d99565b6020026020010151868461325e565b6133b79084613dc5565b9250600101613380565b6133cb828261292c565b611119576040516303b97b7760e41b81526001600160e01b03196000351660048201526024016108b5565b6000815160000361340957506000919050565b60005b600183510381101561348c57600181015b83518110156134835783818151811061343857613438613d99565b60200260200101516001600160a01b031684838151811061345b5761345b613d99565b60200260200101516001600160a01b03160361347b575060019392505050565b60010161341d565b5060010161340c565b50600092915050565b83546134ab906001600160a01b031684846135c2565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b60008183106134df578161106b565b5090919050565b60008183116134f657600061106b565b61106b8284613dd8565b60018201546001600160a01b0380831691160361111957604051639feb934760e01b815260040160405180910390fd5b828460030154101561354457600284018190555b60006135548560020154846134d0565b905060008186600201546135689190613dd8565b905080156135b95760028601829055600187015481111561359c576040516352e521bf60e11b815260040160405180910390fd5b808760010160000160008282546135b39190613dd8565b90915550505b50505050505050565b60006135cc612bd2565b6001600160a01b0385166000908152600360205260409020600181015460028201549293509091831115613640576040518060400160405280613627886001600160a01b031660009081526037602052604090206003015490565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090613672888861250c565b905060006136828989888561253b565b835490915081146136d4578083556040518181526001600160a01b0389811691908b16907faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad9060200160405180910390a35b6136e18584888a86613530565b845460018085019190915560038401879055850154841461374857886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c876001016000015460405161373f91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261376557600080fd5b5081356001600160401b0381111561377c57600080fd5b6020830191508360208260051b850101111561379757600080fd5b9250929050565b600080600080604085870312156137b457600080fd5b84356001600160401b03808211156137cb57600080fd5b6137d788838901613753565b909650945060208701359150808211156137f057600080fd5b506137fd87828801613753565b95989497509550505050565b600081518084526020808501945080840160005b838110156138395781518752958201959082019060010161381d565b509495945050505050565b60208152600061106b6020830184613809565b6001600160a01b03811681146108be57600080fd5b60008060006040848603121561388157600080fd5b83356001600160401b0381111561389757600080fd5b6138a386828701613753565b90945092505060208401356138b781613857565b809150509250925092565b6000602082840312156138d457600080fd5b813561106b81613857565b60008060008060008060a087890312156138f857600080fd5b863561390381613857565b9550602087013561391381613857565b9450604087013561392381613857565b93506060870135925060808701356001600160401b038082111561394657600080fd5b818901915089601f83011261395a57600080fd5b81358181111561396957600080fd5b8a602082850101111561397b57600080fd5b6020830194508093505050509295509295509295565b600080604083850312156139a457600080fd5b82356139af81613857565b946020939093013593505050565b6000806000604084860312156139d257600080fd5b83356139dd81613857565b925060208401356001600160401b038111156139f857600080fd5b613a0486828701613753565b9497909650939450505050565b60008060208385031215613a2457600080fd5b82356001600160401b03811115613a3a57600080fd5b613a4685828601613753565b90969095509350505050565b60008060408385031215613a6557600080fd5b50508035926020909101359150565b600060208284031215613a8657600080fd5b5035919050565b60008060408385031215613aa057600080fd5b8235613aab81613857565b91506020830135613abb81613857565b809150509250929050565b600080600060608486031215613adb57600080fd5b8335613ae681613857565b92506020840135613af681613857565b929592945050506040919091013590565b80356010811061190f57600080fd5b60008060408385031215613b2957600080fd5b613aab83613b07565b600080600060608486031215613b4757600080fd5b8335613b5281613857565b95602085013595506040909401359392505050565b600080600080600060608688031215613b7f57600080fd5b85356001600160401b0380821115613b9657600080fd5b613ba289838a01613753565b90975095506020880135915080821115613bbb57600080fd5b50613bc888828901613753565b96999598509660400135949350505050565b600060208284031215613bec57600080fd5b61106b82613b07565b600080600060408486031215613c0a57600080fd5b83356001600160401b03811115613c2057600080fd5b613c2c86828701613753565b909790965060209590950135949350505050565b600080600080600060a08688031215613c5857600080fd5b8535613c6381613857565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052602160045260246000fd5b60108110613caa57613caa613c84565b9052565b6001600160e01b03198416815260608101613ccc6020830185613c9a565b6001600160a01b03929092166040919091015292915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060208284031215613d7c57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610faf57610faf613daf565b81810381811115610faf57610faf613daf565b60208101610faf8284613c9a565b60208082528181018390526000908460408401835b86811015613e3c578235613e2181613857565b6001600160a01b031682529183019190830190600101613e0e565b509695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613e885783516001600160a01b031683529284019291840191600101613e63565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715613ebc57613ebc613d83565b604052919050565b60006020808385031215613ed757600080fd5b82516001600160401b0380821115613eee57600080fd5b818501915085601f830112613f0257600080fd5b815181811115613f1457613f14613d83565b8060051b9150613f25848301613e94565b8181529183018401918481019088841115613f3f57600080fd5b938501935b83851015613f695784519250613f5983613857565b8282529385019390850190613f44565b98975050505050505050565b600060208284031215613f8757600080fd5b8151801515811461106b57600080fd5b600060208284031215613fa957600080fd5b815161106b81613857565b600060018060a01b0380871683526020818716818501528186166040850152608060608501528451915081608085015260005b828110156140035785810182015185820160a001528101613fe7565b5050600060a0828501015260a0601f19601f83011684010191505095945050505050565b8082028115828204841417610faf57610faf613daf565b60008261405b57634e487b7160e01b600052601260045260246000fd5b500490565b600060e0828403121561407257600080fd5b60405160e081018181106001600160401b038211171561409457614094613d83565b60405282516140a281613857565b815260208301516140b281613857565b602082015260408301516140c581613857565b604082015260608301516140d881613857565b806060830152506080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b6001600160e01b03198316815260408101600b831061412857614128613c84565b8260208301529392505050565b600081518084526020808501945080840160005b838110156138395781516001600160a01b031687529582019590820190600101614149565b6040815260006141816040830186614135565b82810360208401528381526001600160fb1b038411156141a057600080fd5b8360051b808660208401370160200195945050505050565b6000600182016141ca576141ca613daf565b5060010190565b60208152600061106b6020830184614135565b6060815260006141f76060830186614135565b82810360208401526142098186613809565b90508281036040840152610940818561380956fea264697066735822122090fdbda614b62a56948043c2abe8dea25a67ea1f784be48d20947d38199e602864736f6c63430008130033", + "deployedBytecode": "0x6080604052600436106102765760003560e01c80636b0916951161014f578063aa15a6fd116100c1578063de981f1b1161007a578063de981f1b146107a9578063e22d1c9d146107c9578063ea80d67d146107e9578063ef9aa66514610809578063f92ad21914610829578063f9f031df1461084957610288565b8063aa15a6fd146106ab578063acd79c46146106cb578063af245429146106de578063c2a672e0146106f3578063c508700314610713578063d01b8eed1461076457610288565b8063895ab74211610113578063895ab742146105f6578063909791dd1461061657806391f8723f1461062b578063924f081e1461064b5780639488e4e91461066b578063969ffc141461068b57610288565b80636b091695146105565780636bd8f8041461057657806376664b6514610596578063865e6fd3146105b6578063888b9ae9146105d657610288565b806342ef3c34116101e857806357473447116101ac57806357473447146104b75780635a2ac073146104d75780635c19a95c146104f75780635cd8a76b1461050a5780636558954f1461051f578063679a6e431461053657610288565b806342ef3c341461040f578063435628ba1461042f578063446850a11461044f5780634530d2021461046f5780634d99dd161461049757610288565b806318a749a71161023a57806318a749a71461033e57806326476204146103515780632715805e146103645780633101cfcb146103845780633d8e846e146103a457806342e0c408146103c457610288565b806303827884146102935780630682e8fa146102bc578063095f6475146102d1578063097e4a9d146102fe5780631658c86e1461031e57610288565b3661028857600861028681610869565b005b600861028681610869565b34801561029f57600080fd5b506102a96104b081565b6040519081526020015b60405180910390f35b3480156102c857600080fd5b506038546102a9565b3480156102dd57600080fd5b506102f16102ec36600461379e565b6108c1565b6040516102b39190613844565b34801561030a57600080fd5b506102a961031936600461386c565b61094c565b34801561032a57600080fd5b506102866103393660046138c2565b610a20565b61028661034c3660046138df565b610aea565b61028661035f3660046138c2565b610c81565b34801561037057600080fd5b506102a961037f366004613991565b610cc9565b34801561039057600080fd5b5061028661039f3660046138c2565b610d5a565b3480156103b057600080fd5b506102f16103bf3660046139bd565b610dfd565b3480156103d057600080fd5b506103ff6103df3660046138c2565b6001600160a01b039081166000908152603a602052604090205416151590565b60405190151581526020016102b3565b34801561041b57600080fd5b506102f161042a366004613a11565b610f60565b34801561043b57600080fd5b506102f161044a36600461379e565b610fb5565b34801561045b57600080fd5b506102f161046a366004613a11565b61102d565b34801561047b57600080fd5b50606e54606d54604080519283526020830191909152016102b3565b3480156104a357600080fd5b506102866104b2366004613991565b611072565b3480156104c357600080fd5b506102866104d2366004613a52565b611107565b3480156104e357600080fd5b506102f16104f2366004613a11565b61111d565b6102866105053660046138c2565b61115b565b34801561051657600080fd5b506102866111dd565b34801561052b57600080fd5b506102a96201518081565b34801561054257600080fd5b50610286610551366004613a74565b61129c565b34801561056257600080fd5b506102a9610571366004613a8d565b6112ad565b34801561058257600080fd5b50610286610591366004613ac6565b6112c7565b3480156105a257600080fd5b506102a96105b1366004613a8d565b611374565b3480156105c257600080fd5b506102866105d1366004613b16565b61138c565b3480156105e257600080fd5b506102866105f1366004613a74565b6113a7565b34801561060257600080fd5b506102a96106113660046138c2565b6113b8565b34801561062257600080fd5b50606c546102a9565b34801561063757600080fd5b506102f1610646366004613a11565b6113e8565b34801561065757600080fd5b50610286610666366004613b32565b611433565b34801561067757600080fd5b5061028661068636600461379e565b611534565b34801561069757600080fd5b506102866106a6366004613a74565b6116c3565b3480156106b757600080fd5b506102866106c63660046138c2565b6116d4565b6102866106d9366004613b67565b611737565b3480156106ea57600080fd5b506039546102a9565b3480156106ff57600080fd5b5061028661070e366004613991565b61178b565b34801561071f57600080fd5b5061074c61072e3660046138c2565b6001600160a01b039081166000908152603a60205260409020541690565b6040516001600160a01b0390911681526020016102b3565b34801561077057600080fd5b5061078461077f3660046138c2565b611852565b604080516001600160a01b0390941684526020840192909252908201526060016102b3565b3480156107b557600080fd5b5061074c6107c4366004613bda565b611899565b3480156107d557600080fd5b506102866107e4366004613bf5565b611914565b3480156107f557600080fd5b50610286610804366004613a8d565b611aaf565b34801561081557600080fd5b506107846108243660046138c2565b611b18565b34801561083557600080fd5b50610286610844366004613c40565b611b5f565b34801561085557600080fd5b506102a9610864366004613a11565b611c56565b61087281611899565b6001600160a01b0316336001600160a01b0316146108be576000356001600160e01b03191681336040516320e0f98d60e21b81526004016108b593929190613cae565b60405180910390fd5b50565b60606000610901868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b905061094081858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611d5a92505050565b9150505b949350505050565b60006002600054036109705760405162461bcd60e51b81526004016108b590613ce5565b60026000558161097f81611e37565b336000908152603a60205260409020546001600160a01b0316156109b857604051632fc6bfb160e21b81523360048201526024016108b5565b60006109f6868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b90506000610a0385611ee7565b9050610a10338383611f5f565b6001600055979650505050505050565b80610a2a81611e37565b60376000610a3784611ee7565b6001600160a01b03166001600160a01b0316815260200190815260200160002033610a628282611f91565b610a6c6008611899565b6001600160a01b031663dd716ad3610a8386611ee7565b6039546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610acc57600080fd5b505af1158015610ae0573d6000803e3d6000fd5b5050505050505050565b600260005403610b0c5760405162461bcd60e51b81526004016108b590613ce5565b60026000908155338152603a60205260409020546001600160a01b031615610b4957604051632fc6bfb160e21b81523360048201526024016108b5565b606d54831180610b5a5750606e5483105b15610b7857604051631b8454a360e21b815260040160405180910390fd5b600034905060003390506000879050610bce828a838a89898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508e92508b9150611fc19050565b6001600160a01b038082166000818152603760208181526040808420600181018054978a166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052610c308184866122a1565b826001600160a01b0316826001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a3505060016000555050505050505050565b610c8961234c565b80610c9381611e37565b6000610c9e83611ee7565b6001600160a01b0381166000908152603760205260409020909150610cc49033346122a1565b505050565b60006008610cd681610869565b6001600160a01b0384166000908152603760205260409020610cf8908461236f565b915033610d05818461240c565b610d5257604080518481524760208201526001600160a01b0380841692908816917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b505092915050565b60d154600390610100900460ff16158015610d7c575060d15460ff8083169116105b610d985760405162461bcd60e51b81526004016108b590613d1c565b60d1805461ffff191660ff831617610100179055610db7600f83612468565b60d1805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b60606000610e0b6008611899565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6c9190613d6a565b9050826001600160401b03811115610e8657610e86613d83565b604051908082528060200260200182016040528015610eaf578160200160208202803683370190505b5091506000610ef0858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b905060005b84811015610f56576000828281518110610f1157610f11613d99565b60200260200101519050610f30818986610f2b858d61250c565b61253b565b858381518110610f4257610f42613d99565b602090810291909101015250600101610ef5565b5050509392505050565b60606000610fa0848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b9050610fab81612637565b9150505b92915050565b606061102485858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808902828101820190935288825290935088925087918291850190849080828437600092019190915250611d5a92505050565b95945050505050565b606061106b83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061263792505050565b9392505050565b6002600054036110945760405162461bcd60e51b81526004016108b590613ce5565b6002600090815533906110d69084906037906110af83611ee7565b6001600160a01b03166001600160a01b0316815260200190815260200160002083856126f7565b6110e0818361292c565b6110fd57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b61110f612974565b61111982826129ce565b5050565b606061106b838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612a3b92505050565b61116361234c565b8061116d81611e37565b336000908152603a60205260409020546001600160a01b0316156111a657604051632fc6bfb160e21b81523360048201526024016108b5565b611119603760006111b685611ee7565b6001600160a01b03166001600160a01b031681526020019081526020016000203334612aee565b60d154600290610100900460ff161580156111ff575060d15460ff8083169116105b61121b5760405162461bcd60e51b81526004016108b590613d1c565b60d1805461ffff191660ff831617610100179055603654611247906008906001600160a01b0316612468565b603680546001600160a01b031916905560d1805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b6112a4612974565b6108be81612b9d565b600082610fab81846112bd612bd2565b610f2b858861250c565b6002600054036112e95760405162461bcd60e51b81526004016108b590613ce5565b6002600055816112f881611e37565b33611331856037600061130a83611ee7565b6001600160a01b03166001600160a01b0316815260200190815260200160002083866126f7565b6113686037600061134187611ee7565b6001600160a01b03166001600160a01b031681526020019081526020016000208285612aee565b50506001600055505050565b60008061138084611ee7565b9050610fab818461250c565b611394612974565b61139d81612c44565b6111198282612468565b6113af612974565b6108be81612c7a565b6000806113c483611ee7565b905061106b816001600160a01b031660009081526037602052604090206003015490565b60606000611428848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b9050610fab81612a3b565b8261143d81611e37565b6037600061144a86611ee7565b6001600160a01b03166001600160a01b03168152602001908152602001600020336114758282611f91565b606d548411806114865750606e5484105b156114a457604051631b8454a360e21b815260040160405180910390fd5b6114ae6008611899565b6001600160a01b031663e5125a1d6114c588611ee7565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810188905260448101879052606401600060405180830381600087803b15801561151457600080fd5b505af1158015611528573d6000803e3d6000fd5b50505050505050505050565b6002600054036115565760405162461bcd60e51b81526004016108b590613ce5565b60026000558215806115685750828114155b15611586576040516376081a7b60e11b815260040160405180910390fd5b60003390506000806115ca878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b905060005b815181101561168d578585828181106115ea576115ea613d99565b90506020020135836115fc9190613dc5565b925061168588888381811061161357611613613d99565b905060200201602081019061162891906138c2565b6037600085858151811061163e5761163e613d99565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208689898681811061167957611679613d99565b905060200201356126f7565b6001016115cf565b50611698838361292c565b6116b557604051635ff7115760e11b815260040160405180910390fd5b505060016000555050505050565b6116cb612974565b6108be81612caf565b806116de81611e37565b603760006116eb84611ee7565b6001600160a01b03166001600160a01b03168152602001908152602001600020336117168282611f91565b6117206008611899565b6001600160a01b031663cdaa4e81610a8386611ee7565b600861174281610869565b611783868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250879150869050612ce4565b505050505050565b6002600054036117ad5760405162461bcd60e51b81526004016108b590613ce5565b6002600055816117bc81611e37565b816000036117dd576040516331d9f7d760e01b815260040160405180910390fd5b3360006117e985611ee7565b6001600160a01b0381166000908152603760205260408120600281015492935091611815908790613dd8565b9050606c5481101561183a5760405163ef0a995760e01b815260040160405180910390fd5b611845828588613112565b61169884876104b06131fe565b60008060008061186185611ee7565b6001600160a01b0390811660009081526037602052604090206001810154600282015460039092015492169790965090945092505050565b60007fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600083600f8111156118d0576118d0613c84565b60ff1681526020810191909152604001600020546001600160a01b031690508061190f578160405163409140df60e11b81526004016108b59190613deb565b919050565b600861191f81610869565b8215611aa95760005b83811015611a6e57600085858381811061194457611944613d99565b905060200201602081019061195991906138c2565b6001600160a01b03808216600090815260376020908152604080832060018101549094168352603a909152902080546001600160a01b03191690556002810154919250908015611a1d576119ad828261236f565b5060018201546119c9906001600160a01b0316826104b06131fe565b611a1d5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6001820154600090611a3a9085906001600160a01b03168961325e565b90508015611a5f576001830154611a5d906001600160a01b0316826104b06131fe565b505b84600101945050505050611928565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88484604051611aa0929190613df9565b60405180910390a15b50505050565b600f611aba81610869565b506001600160a01b039182166000818152603760209081526040808320600101805487168452603a90925280832080546001600160a01b03199081169091558254959096169486168517909155928152919091208054909216179055565b6000806000611b52846001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b9250925092509193909250565b60d154610100900460ff1615808015611b7f575060d154600160ff909116105b80611b995750303b158015611b99575060d15460ff166001145b611bb55760405162461bcd60e51b81526004016108b590613d1c565b60d1805460ff191660011790558015611bd85760d1805461ff0019166101001790555b611be3600887612468565b611bec85612b9d565b611bf76000856129ce565b611c0083612c7a565b611c0982612caf565b80156117835760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6000600260005403611c7a5760405162461bcd60e51b81526004016108b590613ce5565b6002600081905550611cc733611cc2858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611cde92505050565b613370565b9050611cd333826133c1565b600160005592915050565b6060611cea600f611899565b6001600160a01b031663f9226b1a836040518263ffffffff1660e01b8152600401611d159190613e47565b600060405180830381865afa158015611d32573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610faf9190810190613ec4565b60608151835114611d7e576040516376081a7b60e11b815260040160405180910390fd5b82516001600160401b03811115611d9757611d97613d83565b604051908082528060200260200182016040528015611dc0578160200160208202803683370190505b50905060005b8151811015611e3057611e0b848281518110611de457611de4613d99565b6020026020010151848381518110611dfe57611dfe613d99565b602002602001015161250c565b828281518110611e1d57611e1d613d99565b6020908102919091010152600101611dc6565b5092915050565b611e416008611899565b604051635061f96960e11b81526001600160a01b038381166004830152919091169063a0c3f2d290602401602060405180830381865afa158015611e89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ead9190613f75565b6108be5780611ebb82611ee7565b604051631299fe7160e11b81526001600160a01b039283166004820152911660248201526044016108b5565b6000611ef3600f611899565b6040516350a9fc2960e01b81526001600160a01b03848116600483015291909116906350a9fc2990602401602060405180830381865afa158015611f3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610faf9190613f97565b6000611f6b8484613370565b6001600160a01b038316600090815260376020526040902090915061106b908583612aee565b60018201546001600160a01b0382811691161461111957604051637bc65bd760e11b815260040160405180910390fd5b611fcf8760006104b06131fe565b61201a576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b60648201526084016108b5565b6120288460006104b06131fe565b612071576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b60648201526084016108b5565b606c5481101561209457604051630a8d7fa760e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b03161415806120c75750836001600160a01b0316866001600160a01b031614155b156120e55760405163dc1d04ff60e01b815260040160405180910390fd5b6040805160038082526080820190925260009160208201606080368337019050509050878160008151811061211c5761211c613d99565b60200260200101906001600160a01b031690816001600160a01b031681525050858160018151811061215057612150613d99565b60200260200101906001600160a01b031690816001600160a01b031681525050612179816133f6565b156121a557604051630d697db160e11b81526001600160e01b03196000351660048201526024016108b5565b506121b06008611899565b60405163f883afaf60e01b81526001600160a01b0388811660048301528781166024830152868116604483015260648201859052919091169063f883afaf90608401600060405180830381600087803b15801561220c57600080fd5b505af1158015612220573d6000803e3d6000fd5b505050506000612230600f611899565b6040516307768f2160e51b81529091506001600160a01b0382169063eed1e42090612265908a908a908a908a90600401613fb4565b600060405180830381600087803b15801561227f57600080fd5b505af1158015612293573d6000803e3d6000fd5b505050505050505050505050565b82826122ad8282611f91565b828560020160008282546122c19190613dc5565b925050819055506122e7858587600201548689600301546122e29190613dc5565b613495565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9061233d9086815260200190565b60405180910390a25050505050565b3460000361236d57604051636dfcbde560e11b815260040160405180910390fd5b565b600061237f8360020154836134d0565b9050808360020160008282546123959190613dd8565b90915550506001830154600284015460038501546123c59286926001600160a01b03909116916122e290866134e6565b82546040518281526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612459576040519150601f19603f3d011682016040523d82523d6000602084013e61245e565b606091505b5090949350505050565b807fdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb600084600f81111561249e5761249e613c84565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055811682600f8111156124df576124df613c84565b6040517f865d1c228a8ea13709cfe61f346f7ff67f1bbd4a18ff31ad3e7147350d317c5990600090a35050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b6001600160a01b0380851660009081526002602090815260408083209387168352929052908120600381015484900361257657549050610944565b6001600160a01b0386166000908152600360208181526040808420600180845282862094870154865293909252832091820154839290156125db57805460018601549094506125c59085613dd8565b85600201546125d49190614027565b92506125e3565b846001015493505b81546000906125f3908690613dd8565b6125fd9089614027565b9050670de0b6b3a76400006126128286613dc5565b61261c919061403e565b86546126289190613dc5565b9b9a5050505050505050505050565b606081516001600160401b0381111561265257612652613d83565b60405190808252806020026020018201604052801561267b578160200160208202803683370190505b50905060005b82518110156126f157603760008483815181106126a0576126a0613d99565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600201548282815181106126de576126de613d99565b6020908102919091010152600101612681565b50919050565b82826127038282613500565b8260000361272457604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561275f57604051630695534560e31b815260040160405180910390fd5b600061276b6008611899565b604051635061f96960e11b81526001600160a01b0389811660048301529192509082169063a0c3f2d290602401602060405180830381865afa1580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d99190613f75565b801561285057506040516328bde1e160e01b81526001600160a01b0388811660048301528216906328bde1e19060240160e060405180830381865afa158015612826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284a9190614060565b60a00151155b801561288357506038546001600160a01b0386166000908152600588016020526040902054429161288091613dc5565b10155b156128a15760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03851660009081526004870160205260409020546128df90879087906128cf908890613dd8565b878a600301546122e29190613dd8565b85546040518581526001600160a01b03918216918716907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c9060200160405180910390a350505050505050565b60008147101561296a576040516302631c4f60e61b81526001600160e01b0319600035166004820152476024820152604481018390526064016108b5565b61106b838361240c565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b0316331461236d576000356001600160e01b0319166001604051620f948f60ea1b81526004016108b5929190614107565b6127108111806129dd57508082115b156129fb57604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c149101610df1565b606081516001600160401b03811115612a5657612a56613d83565b604051908082528060200260200182016040528015612a7f578160200160208202803683370190505b50905060005b82518110156126f157612ac9838281518110612aa357612aa3613d99565b60200260200101516001600160a01b031660009081526037602052604090206003015490565b828281518110612adb57612adb613d99565b6020908102919091010152600101612a85565b8282612afa8282613500565b6001600160a01b0384166000908152600486016020526040902054612b389086908690612b28908790613dc5565b8689600301546122e29190613dc5565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b90612b8e9087815260200190565b60405180910390a35050505050565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be290602001611291565b6000612bde6008611899565b6001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3f9190613d6a565b905090565b806001600160a01b03163b6000036108be57604051630bfc64a360e21b81526001600160a01b03821660048201526024016108b5565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a90602001611291565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c67890602001611291565b83518214612d2d57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a5858585604051612d209392919061416e565b60405180910390a2611aa9565b600080600080600088516001600160401b03811115612d4e57612d4e613d83565b604051908082528060200260200182016040528015612d77578160200160208202803683370190505b509050600089516001600160401b03811115612d9557612d95613d83565b604051908082528060200260200182016040528015612dbe578160200160208202803683370190505b50905060008a516001600160401b03811115612ddc57612ddc613d83565b604051908082528060200260200182016040528015612e05578160200160208202803683370190505b50905060005b8b51811015613078578b8181518110612e2657612e26613d99565b6020908102919091018101516001600160a01b038116600090815260038084526040808320603790955290912001549097506001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a9003612ec757868389806001019a5081518110612ea157612ea1613d99565b60200260200101906001600160a01b031690816001600160a01b03168152505050613066565b60028101548a1115612ef557604080518082019091528681526020018a905260018101869055600281018a90555b600181015415612f3f5760018101548c8c84818110612f1657612f16613d99565b90506020020135670de0b6b3a7640000612f309190614027565b612f3a919061403e565b612f42565b60005b985088816000016000828254612f589190613dc5565b9182905550905085612f6a8a85613dd8565b81518110612f7a57612f7a613d99565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461300d9190613dd8565b8151811061301d5761301d613d99565b6020908102919091010152868d6130348a85613dd8565b8151811061304457613044613d99565b60200260200101906001600160a01b031690816001600160a01b031681525050505b80613070816141b8565b915050612e0b565b5085156130c157858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a3826040516130b891906141d1565b60405180910390a25b8a511561310557877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c85856040516130fc939291906141e4565b60405180910390a25b5050505050505050505050565b828261311e8282611f91565b846002015483111561314357604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b0385166000908152600587016020526040902054429161316c91613dc5565b111561318b576040516303db082960e11b815260040160405180910390fd5b8285600201600082825461319f9190613dd8565b925050819055506131c0858587600201548689600301546122e29190613dd8565b84546040518481526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200161233d565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461324e576040519150601f19603f3d011682016040523d82523d6000602084013e613253565b606091505b509095945050505050565b60008061326b858561250c565b90506132798585858461253b565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b7846040516132c091815260200190565b60405180910390a36001600160a01b0380861660008181526002602090815260408083209489168352938152838220828155928252600390529190912061330a9082868580613530565b60038181018590556001600160a01b03878116600081815260209384526040808220546001870155519081529188169290917faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad910160405180910390a350509392505050565b60008061337b612bd2565b905060005b8351811015610d52576133ad84828151811061339e5761339e613d99565b6020026020010151868461325e565b6133b79084613dc5565b9250600101613380565b6133cb828261292c565b611119576040516303b97b7760e41b81526001600160e01b03196000351660048201526024016108b5565b6000815160000361340957506000919050565b60005b600183510381101561348c57600181015b83518110156134835783818151811061343857613438613d99565b60200260200101516001600160a01b031684838151811061345b5761345b613d99565b60200260200101516001600160a01b03160361347b575060019392505050565b60010161341d565b5060010161340c565b50600092915050565b83546134ab906001600160a01b031684846135c2565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b60008183106134df578161106b565b5090919050565b60008183116134f657600061106b565b61106b8284613dd8565b60018201546001600160a01b0380831691160361111957604051639feb934760e01b815260040160405180910390fd5b828460030154101561354457600284018190555b60006135548560020154846134d0565b905060008186600201546135689190613dd8565b905080156135b95760028601829055600187015481111561359c576040516352e521bf60e11b815260040160405180910390fd5b808760010160000160008282546135b39190613dd8565b90915550505b50505050505050565b60006135cc612bd2565b6001600160a01b0385166000908152600360205260409020600181015460028201549293509091831115613640576040518060400160405280613627886001600160a01b031660009081526037602052604090206003015490565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090613672888861250c565b905060006136828989888561253b565b835490915081146136d4578083556040518181526001600160a01b0389811691908b16907faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad9060200160405180910390a35b6136e18584888a86613530565b845460018085019190915560038401879055850154841461374857886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c876001016000015460405161373f91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261376557600080fd5b5081356001600160401b0381111561377c57600080fd5b6020830191508360208260051b850101111561379757600080fd5b9250929050565b600080600080604085870312156137b457600080fd5b84356001600160401b03808211156137cb57600080fd5b6137d788838901613753565b909650945060208701359150808211156137f057600080fd5b506137fd87828801613753565b95989497509550505050565b600081518084526020808501945080840160005b838110156138395781518752958201959082019060010161381d565b509495945050505050565b60208152600061106b6020830184613809565b6001600160a01b03811681146108be57600080fd5b60008060006040848603121561388157600080fd5b83356001600160401b0381111561389757600080fd5b6138a386828701613753565b90945092505060208401356138b781613857565b809150509250925092565b6000602082840312156138d457600080fd5b813561106b81613857565b60008060008060008060a087890312156138f857600080fd5b863561390381613857565b9550602087013561391381613857565b9450604087013561392381613857565b93506060870135925060808701356001600160401b038082111561394657600080fd5b818901915089601f83011261395a57600080fd5b81358181111561396957600080fd5b8a602082850101111561397b57600080fd5b6020830194508093505050509295509295509295565b600080604083850312156139a457600080fd5b82356139af81613857565b946020939093013593505050565b6000806000604084860312156139d257600080fd5b83356139dd81613857565b925060208401356001600160401b038111156139f857600080fd5b613a0486828701613753565b9497909650939450505050565b60008060208385031215613a2457600080fd5b82356001600160401b03811115613a3a57600080fd5b613a4685828601613753565b90969095509350505050565b60008060408385031215613a6557600080fd5b50508035926020909101359150565b600060208284031215613a8657600080fd5b5035919050565b60008060408385031215613aa057600080fd5b8235613aab81613857565b91506020830135613abb81613857565b809150509250929050565b600080600060608486031215613adb57600080fd5b8335613ae681613857565b92506020840135613af681613857565b929592945050506040919091013590565b80356010811061190f57600080fd5b60008060408385031215613b2957600080fd5b613aab83613b07565b600080600060608486031215613b4757600080fd5b8335613b5281613857565b95602085013595506040909401359392505050565b600080600080600060608688031215613b7f57600080fd5b85356001600160401b0380821115613b9657600080fd5b613ba289838a01613753565b90975095506020880135915080821115613bbb57600080fd5b50613bc888828901613753565b96999598509660400135949350505050565b600060208284031215613bec57600080fd5b61106b82613b07565b600080600060408486031215613c0a57600080fd5b83356001600160401b03811115613c2057600080fd5b613c2c86828701613753565b909790965060209590950135949350505050565b600080600080600060a08688031215613c5857600080fd5b8535613c6381613857565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052602160045260246000fd5b60108110613caa57613caa613c84565b9052565b6001600160e01b03198416815260608101613ccc6020830185613c9a565b6001600160a01b03929092166040919091015292915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060208284031215613d7c57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610faf57610faf613daf565b81810381811115610faf57610faf613daf565b60208101610faf8284613c9a565b60208082528181018390526000908460408401835b86811015613e3c578235613e2181613857565b6001600160a01b031682529183019190830190600101613e0e565b509695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613e885783516001600160a01b031683529284019291840191600101613e63565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715613ebc57613ebc613d83565b604052919050565b60006020808385031215613ed757600080fd5b82516001600160401b0380821115613eee57600080fd5b818501915085601f830112613f0257600080fd5b815181811115613f1457613f14613d83565b8060051b9150613f25848301613e94565b8181529183018401918481019088841115613f3f57600080fd5b938501935b83851015613f695784519250613f5983613857565b8282529385019390850190613f44565b98975050505050505050565b600060208284031215613f8757600080fd5b8151801515811461106b57600080fd5b600060208284031215613fa957600080fd5b815161106b81613857565b600060018060a01b0380871683526020818716818501528186166040850152608060608501528451915081608085015260005b828110156140035785810182015185820160a001528101613fe7565b5050600060a0828501015260a0601f19601f83011684010191505095945050505050565b8082028115828204841417610faf57610faf613daf565b60008261405b57634e487b7160e01b600052601260045260246000fd5b500490565b600060e0828403121561407257600080fd5b60405160e081018181106001600160401b038211171561409457614094613d83565b60405282516140a281613857565b815260208301516140b281613857565b602082015260408301516140c581613857565b604082015260608301516140d881613857565b806060830152506080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b6001600160e01b03198316815260408101600b831061412857614128613c84565b8260208301529392505050565b600081518084526020808501945080840160005b838110156138395781516001600160a01b031687529582019590820190600101614149565b6040815260006141816040830186614135565b82810360208401528381526001600160fb1b038411156141a057600080fd5b8360051b808660208401370160200195945050505050565b6000600182016141ca576141ca613daf565b5060010190565b60208152600061106b6020830184614135565b6060815260006141f76060830186614135565b82810360208401526142098186613809565b90508281036040840152610940818561380956fea264697066735822122090fdbda614b62a56948043c2abe8dea25a67ea1f784be48d20947d38199e602864736f6c63430008130033", "devdoc": { "errors": { "ErrAdminOfAnyActivePoolForbidden(address)": [ @@ -1470,7 +1574,7 @@ } } ], - "ErrInactivePool(address)": [ + "ErrInactivePool(address,address)": [ { "details": "Error of querying inactive pool." } @@ -1580,12 +1684,74 @@ } ] }, + "events": { + "CommissionRateRangeUpdated(uint256,uint256)": { + "details": "Emitted when the commission rate range is updated." + }, + "ContractUpdated(uint8,address)": { + "details": "Emitted when a contract is updated." + }, + "CooldownSecsToUndelegateUpdated(uint256)": { + "details": "Emitted when the minium number of seconds to undelegate is updated." + }, + "Delegated(address,address,uint256)": { + "details": "Emitted when the delegator staked for a validator candidate." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "MinValidatorStakingAmountUpdated(uint256)": { + "details": "Emitted when the minimum staking amount for being a validator is updated." + }, + "PoolApproved(address,address)": { + "details": "Emitted when the validator pool is approved." + }, + "PoolSharesUpdated(uint256,address,uint256)": { + "details": "Emitted when the pool shares are updated" + }, + "PoolsDeprecated(address[])": { + "details": "Emitted when the validator pool is deprecated." + }, + "PoolsUpdateConflicted(uint256,address[])": { + "details": "Emitted when the contract fails when updating the pools that already set" + }, + "PoolsUpdateFailed(uint256,address[],uint256[])": { + "details": "Emitted when the contract fails when updating the pools" + }, + "PoolsUpdated(uint256,address[],uint256[],uint256[])": { + "details": "Emitted when the pools are updated" + }, + "RewardClaimed(address,address,uint256)": { + "details": "Emitted when the user claimed their reward" + }, + "Staked(address,uint256)": { + "details": "Emitted when the pool admin staked for themself." + }, + "StakingAmountDeductFailed(address,address,uint256,uint256)": { + "details": "Emitted when the staking amount deducted failed, e.g. when the validator gets slashed." + }, + "StakingAmountTransferFailed(address,address,uint256,uint256)": { + "details": "Emitted when the staking amount transfer failed." + }, + "Undelegated(address,address,uint256)": { + "details": "Emitted when the delegator unstaked from a validator candidate." + }, + "Unstaked(address,uint256)": { + "details": "Emitted when the pool admin unstaked the amount of RON from themself." + }, + "UserRewardUpdated(address,address,uint256)": { + "details": "Emitted when the fields to calculate pending reward for the user is updated." + }, + "WaitingSecsToRevokeUpdated(uint256)": { + "details": "Emitted when the number of seconds that a candidate must wait to be revoked." + } + }, "kind": "dev", "methods": { - "applyValidatorCandidate(address,address,address,uint256)": { + "applyValidatorCandidate(address,address,address,uint256,bytes)": { "details": "Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.", "params": { - "_candidateAdmin": "the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance." + "candidateAdmin": "the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance." } }, "bulkUndelegate(address[],uint256[])": { @@ -1603,6 +1769,9 @@ "delegateRewards(address[],address)": { "details": "Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event." }, + "execChangeAdminAddress(address,address)": { + "details": "Requirements: - Only Profile contract can call this method." + }, "execDeductStakingAmount(address,uint256)": { "details": "Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`." }, @@ -1627,6 +1796,9 @@ "getManySelfStakings(address[])": { "details": "Returns the self-staking amounts of the pools." }, + "getManySelfStakingsById(address[])": { + "details": "Returns the self-staking amounts of the pools." + }, "getManyStakingAmounts(address[],address[])": { "details": "Returns the staking amounts of the users." }, @@ -1637,7 +1809,7 @@ "details": "Returns the consensus address corresponding to the pool admin." }, "getPoolDetail(address)": { - "details": "Returns the staking pool detail." + "details": "Returns the staking pool details." }, "getReward(address,address)": { "details": "Returns the reward amount that user claimable." @@ -1654,8 +1826,14 @@ "initialize(address,uint256,uint256,uint256,uint256)": { "details": "Initializes the contract storage." }, + "initializeV2()": { + "details": "Initializes the contract storage V2." + }, + "initializeV3(address)": { + "details": "Initializes the contract storage V3." + }, "isAdminOfActivePool(address)": { - "details": "Returns whether the `_poolAdminAddr` is currently active." + "details": "Returns whether the `admin` is currently active." }, "minValidatorStakingAmount()": { "details": "Returns the minimum threshold for being a validator candidate." @@ -1692,16 +1870,13 @@ "details": "Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`." }, "stake(address)": { - "details": "Self-delegates to the validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`." - }, - "tmp_re_applyValidatorCandidate(address,address,address,uint256)": { - "details": "This method only work on testnet, to hotfix the applied validator candidate that is failed. Should remove this method before deploying it on mainnet." + "details": "Self-delegates to the validator candidate `consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`." }, "undelegate(address,uint256)": { "details": "Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event." }, "unstake(address,uint256)": { - "details": "Unstakes from the validator candidate `_consensusAddr` for `_amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`." + "details": "Unstakes from the validator candidate `consensusAddr` for `amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`." }, "waitingSecsToRevoke()": { "details": "Returns the number of seconds that a candidate must wait for the renounce request gets affected." @@ -1717,7 +1892,7 @@ "storageLayout": { "storage": [ { - "astId": 736, + "astId": 1387, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_status", "offset": 0, @@ -1725,31 +1900,31 @@ "type": "t_uint256" }, { - "astId": 12296, + "astId": 25671, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_accumulatedRps", "offset": 0, "slot": "1", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)7460_storage))" + "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)7612_storage))" }, { - "astId": 12304, + "astId": 25679, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_userReward", "offset": 0, "slot": "2", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)7887_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)8442_storage))" }, { - "astId": 12310, + "astId": 25685, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_stakingPool", "offset": 0, "slot": "3", - "type": "t_mapping(t_address,t_struct(PoolFields)7893_storage)" + "type": "t_mapping(t_address,t_struct(PoolFields)8448_storage)" }, { - "astId": 12315, + "astId": 25690, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1757,7 +1932,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 13735, + "astId": 31444, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______deprecatedValidator", "offset": 0, @@ -1765,15 +1940,15 @@ "type": "t_address" }, { - "astId": 10479, + "astId": 23480, "contract": "contracts/ronin/staking/Staking.sol:Staking", - "label": "_stakingPool", + "label": "_poolDetail", "offset": 0, "slot": "55", - "type": "t_mapping(t_address,t_struct(PoolDetail)7499_storage)" + "type": "t_mapping(t_address,t_struct(PoolDetail)8008_storage)" }, { - "astId": 10482, + "astId": 23483, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_cooldownSecsToUndelegate", "offset": 0, @@ -1781,7 +1956,7 @@ "type": "t_uint256" }, { - "astId": 10485, + "astId": 23486, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_waitingSecsToRevoke", "offset": 0, @@ -1789,7 +1964,7 @@ "type": "t_uint256" }, { - "astId": 10490, + "astId": 23491, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_adminOfActivePoolMapping", "offset": 0, @@ -1797,7 +1972,7 @@ "type": "t_mapping(t_address,t_address)" }, { - "astId": 10495, + "astId": 23496, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1805,7 +1980,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 10984, + "astId": 24237, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_minValidatorStakingAmount", "offset": 0, @@ -1813,7 +1988,7 @@ "type": "t_uint256" }, { - "astId": 10987, + "astId": 24240, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_maxCommissionRate", "offset": 0, @@ -1821,7 +1996,7 @@ "type": "t_uint256" }, { - "astId": 10990, + "astId": 24243, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_minCommissionRate", "offset": 0, @@ -1829,7 +2004,7 @@ "type": "t_uint256" }, { - "astId": 10995, + "astId": 24248, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1837,7 +2012,7 @@ "type": "t_array(t_uint256)48_storage" }, { - "astId": 11751, + "astId": 25069, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1845,7 +2020,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 581, + "astId": 1124, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_initialized", "offset": 0, @@ -1853,7 +2028,7 @@ "type": "t_uint8" }, { - "astId": 584, + "astId": 1127, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_initializing", "offset": 1, @@ -1897,40 +2072,40 @@ "numberOfBytes": "32", "value": "t_address" }, - "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)7887_storage))": { + "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)8442_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(address => struct IRewardPool.UserRewardFields))", "numberOfBytes": "32", - "value": "t_mapping(t_address,t_struct(UserRewardFields)7887_storage)" + "value": "t_mapping(t_address,t_struct(UserRewardFields)8442_storage)" }, - "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)7460_storage))": { + "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)7612_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(uint256 => struct PeriodWrapperConsumer.PeriodWrapper))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(PeriodWrapper)7460_storage)" + "value": "t_mapping(t_uint256,t_struct(PeriodWrapper)7612_storage)" }, - "t_mapping(t_address,t_struct(PoolDetail)7499_storage)": { + "t_mapping(t_address,t_struct(PoolDetail)8008_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IBaseStaking.PoolDetail)", "numberOfBytes": "32", - "value": "t_struct(PoolDetail)7499_storage" + "value": "t_struct(PoolDetail)8008_storage" }, - "t_mapping(t_address,t_struct(PoolFields)7893_storage)": { + "t_mapping(t_address,t_struct(PoolFields)8448_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IRewardPool.PoolFields)", "numberOfBytes": "32", - "value": "t_struct(PoolFields)7893_storage" + "value": "t_struct(PoolFields)8448_storage" }, - "t_mapping(t_address,t_struct(UserRewardFields)7887_storage)": { + "t_mapping(t_address,t_struct(UserRewardFields)8442_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IRewardPool.UserRewardFields)", "numberOfBytes": "32", - "value": "t_struct(UserRewardFields)7887_storage" + "value": "t_struct(UserRewardFields)8442_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -1939,19 +2114,19 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_mapping(t_uint256,t_struct(PeriodWrapper)7460_storage)": { + "t_mapping(t_uint256,t_struct(PeriodWrapper)7612_storage)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => struct PeriodWrapperConsumer.PeriodWrapper)", "numberOfBytes": "32", - "value": "t_struct(PeriodWrapper)7460_storage" + "value": "t_struct(PeriodWrapper)7612_storage" }, - "t_struct(PeriodWrapper)7460_storage": { + "t_struct(PeriodWrapper)7612_storage": { "encoding": "inplace", "label": "struct PeriodWrapperConsumer.PeriodWrapper", "members": [ { - "astId": 7457, + "astId": 7609, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "inner", "offset": 0, @@ -1959,7 +2134,7 @@ "type": "t_uint256" }, { - "astId": 7459, + "astId": 7611, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastPeriod", "offset": 0, @@ -1969,28 +2144,28 @@ ], "numberOfBytes": "64" }, - "t_struct(PoolDetail)7499_storage": { + "t_struct(PoolDetail)8008_storage": { "encoding": "inplace", "label": "struct IBaseStaking.PoolDetail", "members": [ { - "astId": 7484, + "astId": 7988, "contract": "contracts/ronin/staking/Staking.sol:Staking", - "label": "addr", + "label": "pid", "offset": 0, "slot": "0", "type": "t_address" }, { - "astId": 7486, + "astId": 7991, "contract": "contracts/ronin/staking/Staking.sol:Staking", - "label": "admin", + "label": "__shadowedPoolAdmin", "offset": 0, "slot": "1", "type": "t_address" }, { - "astId": 7488, + "astId": 7994, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "stakingAmount", "offset": 0, @@ -1998,7 +2173,7 @@ "type": "t_uint256" }, { - "astId": 7490, + "astId": 7997, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "stakingTotal", "offset": 0, @@ -2006,7 +2181,7 @@ "type": "t_uint256" }, { - "astId": 7494, + "astId": 8002, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "delegatingAmount", "offset": 0, @@ -2014,7 +2189,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 7498, + "astId": 8007, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastDelegatingTimestamp", "offset": 0, @@ -2024,12 +2199,12 @@ ], "numberOfBytes": "192" }, - "t_struct(PoolFields)7893_storage": { + "t_struct(PoolFields)8448_storage": { "encoding": "inplace", "label": "struct IRewardPool.PoolFields", "members": [ { - "astId": 7889, + "astId": 8444, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "aRps", "offset": 0, @@ -2037,22 +2212,22 @@ "type": "t_uint256" }, { - "astId": 7892, + "astId": 8447, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "shares", "offset": 0, "slot": "1", - "type": "t_struct(PeriodWrapper)7460_storage" + "type": "t_struct(PeriodWrapper)7612_storage" } ], "numberOfBytes": "96" }, - "t_struct(UserRewardFields)7887_storage": { + "t_struct(UserRewardFields)8442_storage": { "encoding": "inplace", "label": "struct IRewardPool.UserRewardFields", "members": [ { - "astId": 7880, + "astId": 8435, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "debited", "offset": 0, @@ -2060,7 +2235,7 @@ "type": "t_uint256" }, { - "astId": 7882, + "astId": 8437, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "aRps", "offset": 0, @@ -2068,7 +2243,7 @@ "type": "t_uint256" }, { - "astId": 7884, + "astId": 8439, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lowestAmount", "offset": 0, @@ -2076,7 +2251,7 @@ "type": "t_uint256" }, { - "astId": 7886, + "astId": 8441, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastPeriod", "offset": 0, diff --git a/deployments/ronin-testnet/solcInputs/0f25a5224eeb8772a3c38ebf9ab9bb4c.json b/deployments/ronin-testnet/solcInputs/0f25a5224eeb8772a3c38ebf9ab9bb4c.json new file mode 100644 index 000000000..931e7f61b --- /dev/null +++ b/deployments/ronin-testnet/solcInputs/0f25a5224eeb8772a3c38ebf9ab9bb4c.json @@ -0,0 +1,232 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/extensions/collections/HasContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { HasProxyAdmin } from \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasContracts.sol\";\nimport { IdentityGuard } from \"../../utils/IdentityGuard.sol\";\nimport { ErrUnexpectedInternalCall } from \"../../utils/CommonErrors.sol\";\n\n/**\n * @title HasContracts\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\n */\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\n /// @dev value is equal to keccak256(\"@ronin.dpos.collections.HasContracts.slot\") - 1\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\n\n /**\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\n * @param contractType The contract type that allowed to call\n */\n modifier onlyContract(ContractType contractType) virtual {\n _requireContract(contractType);\n _;\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\n _requireHasCode(addr);\n _setContract(contractType, addr);\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function getContract(ContractType contractType) public view returns (address contract_) {\n contract_ = _getContractMap()[uint8(contractType)];\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\n }\n\n /**\n * @dev Internal function to set the address of a contract with a specific role.\n * @param contractType The contract type of the contract to set.\n * @param addr The address of the contract to set.\n */\n function _setContract(ContractType contractType, address addr) internal virtual {\n _getContractMap()[uint8(contractType)] = addr;\n emit ContractUpdated(contractType, addr);\n }\n\n /**\n * @dev Internal function to access the mapping of contract addresses with roles.\n * @return contracts_ The mapping of contract addresses with roles.\n */\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\n assembly {\n contracts_.slot := _STORAGE_SLOT\n }\n }\n\n /**\n * @dev Internal function to check if the calling contract has a specific role.\n * @param contractType The contract type that the calling contract must have.\n * @dev Throws an error if the calling contract does not have the specified role.\n */\n function _requireContract(ContractType contractType) private view {\n if (msg.sender != getContract(contractType)) {\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\n }\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\nimport \"../../utils/CommonErrors.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n _requireAdmin();\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view virtual returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _requireAdmin() internal view {\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\n }\n}\n" + }, + "contracts/extensions/consumers/GlobalConfigConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract GlobalConfigConsumer {\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\n /// @dev The length of a period in second.\n uint256 public constant PERIOD_DURATION = 1 days;\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/extensions/RONTransferHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract RONTransferHelper {\n /// @dev Error of sender has insufficient balance.\n error ErrInsufficientBalance(bytes4 msgSig, uint256 currentBalance, uint256 sendAmount);\n /// @dev Error of recipient not accepting RON when transfer RON.\n error ErrRecipientRevert(bytes4 msgSig);\n\n /**\n * @dev See `_sendRON`.\n * Reverts if the recipient does not receive RON.\n */\n function _transferRON(address payable recipient, uint256 amount) internal {\n if (!_sendRON(recipient, amount)) revert ErrRecipientRevert(msg.sig);\n }\n\n /**\n * @dev Send `amount` RON to the address `recipient`.\n * Returns whether the recipient receives RON or not.\n * Reverts once the contract balance is insufficient.\n *\n * Note: consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _sendRON(address payable recipient, uint256 amount) internal returns (bool success) {\n if (address(this).balance < amount) revert ErrInsufficientBalance(msg.sig, address(this).balance, amount);\n return _unsafeSendRON(recipient, amount);\n }\n\n /**\n * @dev Unsafe send `amount` RON to the address `recipient`. If the sender's balance is insufficient,\n * the call does not revert.\n *\n * Note:\n * - Does not assert whether the balance of sender is sufficient.\n * - Does not assert whether the recipient accepts RON.\n * - Consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _unsafeSendRON(address payable recipient, uint256 amount) internal returns (bool success) {\n (success, ) = recipient.call{ value: amount }(\"\");\n }\n\n /**\n * @dev Same purpose with {_unsafeSendRONLimitGas(address,uin256)} but containing gas limit stipend forwarded in the call.\n */\n function _unsafeSendRONLimitGas(\n address payable recipient,\n uint256 amount,\n uint256 gas\n ) internal returns (bool success) {\n (success, ) = recipient.call{ value: amount, gas: gas }(\"\");\n }\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/interfaces/collections/IHasContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { ContractType } from \"../../utils/ContractType.sol\";\n\ninterface IHasContracts {\n /// @dev Error of invalid role.\n error ErrContractTypeNotFound(ContractType contractType);\n\n /// @dev Emitted when a contract is updated.\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\n\n /**\n * @dev Returns the address of a contract with a specific role.\n * Throws an error if no contract is set for the specified role.\n *\n * @param contractType The role of the contract to retrieve.\n * @return contract_ The address of the contract with the specified role.\n */\n function getContract(ContractType contractType) external view returns (address contract_);\n\n /**\n * @dev Sets the address of a contract with a specific role.\n * Emits the event {ContractUpdated}.\n * @param contractType The role of the contract to set.\n * @param addr The address of the contract to set.\n */\n function setContract(ContractType contractType, address addr) external;\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/interfaces/IFastFinalityTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IFastFinalityTracking {\n /**\n * @dev Submit list of `voters` who vote for fast finality in the current block.\n *\n * Requirements:\n * - Only called once per block\n * - Only coinbase can call this method\n */\n function recordFinality(address[] calldata voters) external;\n\n /**\n * @dev Returns vote count of `addrs` in the `period`.\n */\n function getManyFinalityVoteCounts(\n uint256 period,\n address[] calldata addrs\n ) external view returns (uint256[] memory voteCounts);\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../udvts/Types.sol\";\n\ninterface IMaintenance {\n /**\n * @dev Error thrown when attempting to schedule an already scheduled event.\n */\n error ErrAlreadyScheduled();\n\n /**\n * @dev Error thrown when referring to a non-existent schedule.\n */\n error ErrUnexistedSchedule();\n\n /**\n * @dev Error thrown when the end block of a schedule is out of range.\n */\n error ErrEndBlockOutOfRange();\n\n /**\n * @dev Error thrown when the start block of a schedule is out of range.\n */\n error ErrStartBlockOutOfRange();\n\n /**\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\n */\n error ErrAlreadyOnMaintenance();\n\n /**\n * @dev Error thrown when attempting an action before the cooldown period has ended.\n */\n error ErrCooldownTimeNotYetEnded();\n\n /**\n * @dev Error thrown when the total number of schedules exceeds the limit.\n */\n error ErrTotalOfSchedulesExceeded();\n\n /**\n * @dev Error thrown when an invalid maintenance duration is specified.\n */\n error ErrInvalidMaintenanceDuration();\n\n /**\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\n */\n error ErrInvalidMaintenanceDurationConfig();\n\n /**\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\n */\n error ErrInvalidOffsetToStartScheduleConfigs();\n\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(TConsensus indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(TConsensus indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(TConsensus consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator whose id `validatorId` maintained at the block number `_block`.\n */\n function checkMaintainedById(address validatorId, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n TConsensus consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `k` or not.\n */\n function checkManyMaintained(\n TConsensus[] calldata consensusAddrList,\n uint256 atBlock\n ) external view returns (bool[] memory);\n\n function checkManyMaintainedById(\n address[] calldata candidateIdList,\n uint256 atBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n TConsensus[] calldata _consensusAddrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n function checkManyMaintainedInBlockRangeById(\n address[] calldata idList,\n uint256 fromBlock,\n uint256 toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `consensusAddr` has finished cooldown.\n */\n function checkCooldownEnded(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `consensusAddr` has schedule.\n */\n function checkScheduled(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `consensusAddr`.\n */\n function getSchedule(TConsensus consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedule() external view returns (uint256 count);\n\n /**\n * @dev Returns the cooldown to maintain in seconds.\n */\n function cooldownSecsToMaintain() external view returns (uint256);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 minMaintenanceDurationInBlock_,\n uint256 maxMaintenanceDurationInBlock_,\n uint256 minOffsetToStartSchedule_,\n uint256 maxOffsetToStartSchedule_,\n uint256 maxSchedules_,\n uint256 cooldownSecsToMaintain_\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedule() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `startedAtBlock` to `endedAtBlock`.\n *\n * Requirements:\n * - The candidate `consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `consensusAddr`.\n * - The candidate `consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `consensusAddr`.\n *\n * Requirements:\n * - The candidate `consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `consensusAddr`.\n * - A schedule for the `consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(TConsensus consensusAddr) external;\n}\n" + }, + "contracts/interfaces/IProfile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId, TConsensus } from \"../udvts/Types.sol\";\nimport \"../utils/RoleAccess.sol\";\n\ninterface IProfile {\n struct CandidateProfile {\n /**\n * @dev Primary key of the profile, use for backward querying.\n *\n * {Staking} Contract: index of pool\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\n *\n */\n address id;\n /// @dev Consensus address.\n TConsensus consensus;\n /// @dev Pool admin address.\n address admin;\n /// @dev Treasury address.\n address payable treasury;\n /// @dev Address to voting proposal.\n address __reservedGovernor;\n /// @dev Public key for fast finality.\n bytes pubkey;\n }\n\n /// @dev Event emitted when a profile with `id` is added.\n event ProfileAdded(address indexed id);\n /// @dev Event emitted when a address in a profile is changed.\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\n /// @dev Event emitted when the pubkey of the `id` is changed.\n event PubkeyChanged(address indexed id, bytes pubkey);\n\n /// @dev Error of already existed profile.\n error ErrExistentProfile();\n /// @dev Error of non existed profile.\n error ErrNonExistentProfile();\n /// @dev Error when create a new profile whose id and consensus are not identical.\n error ErrIdAndConsensusDiffer();\n /**\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\n * and with value type of `infoType`.\n */\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\n error ErrDuplicatedPubkey(bytes pubkey);\n error ErrZeroAddress(RoleAccess infoType);\n error ErrZeroPubkey();\n\n /// @dev Getter to query full `profile` from `id` address.\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\n\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\n\n /// @dev Getter to backward query from `consensus` address to `id` address.\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\n\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\n\n /**\n * @notice Add a new profile.\n *\n * @dev Requirements:\n * - The profile must not be existent before.\n * - Only contract admin can call this method.\n */\n function addNewProfile(CandidateProfile memory profile) external;\n\n /**\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\n * applying for candidate role.\n *\n * Requirements:\n * - Only `stakingContract` can call this method.\n */\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\n\n /**\n * @notice The candidate admin changes the public key.\n *\n * @dev Requirements:\n * - The profile must be existed.\n * - Only user with candidate admin role can call this method.\n * - New public key must not be duplicated.\n */\n\n function changePubkey(address id, bytes memory pubkey) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/IRoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../utils/CommonErrors.sol\";\n\ninterface IRoninGovernanceAdmin {\n /// @dev Emitted when an emergency exit poll is created.\n event EmergencyExitPollCreated(\n bytes32 voteHash,\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n );\n /// @dev Emitted when an emergency exit poll is approved.\n event EmergencyExitPollApproved(bytes32 voteHash);\n /// @dev Emitted when an emergency exit poll is expired.\n event EmergencyExitPollExpired(bytes32 voteHash);\n /// @dev Emitted when an emergency exit poll is voted.\n event EmergencyExitPollVoted(bytes32 indexed voteHash, address indexed voter);\n\n /**\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n */\n function createEmergencyExitPoll(\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n ) external;\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\nimport \"../udvts/Types.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n /**\n * @dev Error indicating that a query for a duplicate entry was made.\n */\n error ErrQueryForDupplicated();\n\n /**\n * @dev Error indicating that a query was made for a non-existent consensus address.\n */\n error ErrQueryForNonExistentConsensusAddress();\n\n /**\n * @dev Error indicating that a governor address has already been added.\n * @param addr The address of the governor that is already added.\n */\n error ErrGovernorAddressIsAlreadyAdded(address addr);\n\n /**\n * @dev Error indicating that a consensus address is not added.\n * @param addr The address of the consensus contract that is not added.\n */\n error ErrConsensusAddressIsNotAdded(TConsensus addr);\n\n /**\n * @dev Error indicating that a consensus address is already added.\n * @param addr The address of the consensus contract that is already added.\n */\n error ErrConsensusAddressIsAlreadyAdded(TConsensus addr);\n\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n TConsensus consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address __deprecatedBridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(TConsensus[] orgs);\n /// @dev Emitted when the consensus address of a trusted organization is changed.\n event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n *\n * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\n */\n function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeight() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeightById(address cid) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address governor) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganization() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/IStakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IStakingVesting {\n /**\n * @dev Error thrown when attempting to send a bonus that has already been sent.\n */\n error ErrBonusAlreadySent();\n\n /// @dev Emitted when the block bonus for block producer is transferred.\n event BonusTransferred(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount\n );\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\n event BonusTransferFailed(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount,\n uint256 contractBalance\n );\n /// @dev Emitted when the block bonus for block producer is updated\n event BlockProducerBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the block bonus for bridge operator is updated\n event BridgeOperatorBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the percent of fast finality reward is updated\n event FastFinalityRewardPercentageUpdated(uint256);\n\n /**\n * @dev Returns the bonus amount for the block producer at `blockNum`.\n */\n function blockProducerBlockBonus(uint256 blockNum) external view returns (uint256);\n\n /**\n * @dev Returns the bonus amount for the bridge validator at `blockNum`.\n */\n function bridgeOperatorBlockBonus(uint256 blockNum) external view returns (uint256);\n\n /**\n * @dev Returns the percentage of fast finality reward.\n */\n function fastFinalityRewardPercentage() external view returns (uint256);\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Returns the last block number that the staking vesting is sent.\n */\n function lastBlockSendingBonus() external view returns (uint256);\n\n /**\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\n *\n * Requirements:\n * - The method caller must be validator contract.\n * - The method must be called only once per block.\n *\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\n *\n * Notes:\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\n * will not be reverted, and the underlying nodes does not hang.\n *\n * @param forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\n * @param forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\n *\n * @return success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\n * @return blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\n * @return bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\n * @return fastFinalityRewardPercentage The percent of fast finality reward, returns 0 when the transfer is failed.\n *\n */\n function requestBonus(\n bool forBlockProducer,\n bool forBridgeOperator\n )\n external\n returns (\n bool success,\n uint256 blockProducerBonus,\n uint256 bridgeOperatorBonus,\n uint256 fastFinalityRewardPercentage\n );\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBlockProducerBonusPerBlock(uint256 amount) external;\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\n\n /**\n * @dev Sets the percent of fast finality reward.\n *\n * Emits the event `FastFinalityRewardPercentageUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setFastFinalityRewardPercentage(uint256 _percent) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3,\n FAST_FINALITY\n }\n\n /// @dev Error thrown when evidence has already been submitted.\n error ErrEvidenceAlreadySubmitted();\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICreditScore {\n /**\n * @dev Error thrown when an invalid credit score configuration is provided.\n */\n error ErrInvalidCreditScoreConfig();\n\n /**\n * @dev Error thrown when an invalid cut-off percentage configuration is provided.\n */\n error ErrInvalidCutOffPercentageConfig();\n\n /**\n * @dev Error thrown when the caller's credit score is insufficient to bail out a situation.\n */\n error ErrInsufficientCreditScoreToBailOut();\n\n /**\n * @dev Error thrown when a validator has previously bailed out.\n */\n error ErrValidatorHasBailedOutPreviously();\n\n /**\n * @dev Error thrown when the caller must be jailed in the current period.\n */\n error ErrCallerMustBeJailedInTheCurrentPeriod();\n\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(TConsensus indexed consensus, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execUpdateCreditScores(address[] calldata validatorIds, uint256 period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata validatorIds) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(TConsensus consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(TConsensus consensus) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(\n TConsensus[] calldata consensusAddrs\n ) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `consensus` has been bailed out at the `period`.\n */\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(TConsensus _validatorAddr, bytes calldata _header1, bytes calldata _header2) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\n */\n error ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\n\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(TConsensus consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `period` of a block producer.\n */\n function getUnavailabilityIndicator(TConsensus consensusAddr, uint256 period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 tier1Threshold,\n uint256 tier2Threshold,\n uint256 slashAmountForTier2Threshold,\n uint256 jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\ninterface IBaseStaking {\n struct PoolDetail {\n /**\n * @dev Address of the pool.\n * @custom non-volatile-storage Permanently set to the first consensus address of the candidate.\n */\n address pid;\n\n /**\n * @dev The address of the pool admin.\n * @custom shadowed-storage This storage slot is always kept in sync with the admin in `Profile-CandidateProfile`.\n */\n address __shadowedPoolAdmin;\n\n /// @dev Self-staking amount\n uint256 stakingAmount;\n\n /// @dev Total number of RON staking for the pool\n uint256 stakingTotal;\n\n /// @dev Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n\n /// @dev Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(TConsensus consensusAddr, address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `admin` is currently active.\n */\n function isAdminOfActivePool(address admin) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address admin) external view returns (address);\n\n /**\n * @dev Returns the staking pool details.\n */\n function getPoolDetail(\n TConsensus consensusAddr\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\n\n function getPoolDetailById(\n address poolId\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed poolId, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed poolId, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed poolId,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed poolId,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 minRange, uint256 maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address candidateAdmin,\n TConsensus consensusAddr,\n address payable treasuryAddr,\n uint256 commissionRate,\n bytes calldata pubkey\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata pools, uint256 period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(TConsensus consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `consensusAddr` for `amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(TConsensus consensusAddr, uint256 amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n TConsensus consensusAddr,\n uint256 effectiveDaysOnwards,\n uint256 commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(TConsensus consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(TConsensus consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed poolId, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed poolId, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(TConsensus consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(TConsensus consensusAddr, uint256 amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(TConsensus consensusAddrSrc, TConsensus consensusAddrDst, uint256 amount) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(\n address user,\n TConsensus[] calldata consensusAddrList\n ) external view returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(TConsensus[] calldata consensusAddrList) external returns (uint256 amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(\n TConsensus[] calldata consensusAddrList,\n TConsensus consensusAddrDst\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(TConsensus consensusAddr, address user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(\n TConsensus[] calldata consensusAddrs,\n address[] calldata userList\n ) external view returns (uint256[] memory);\n\n function getManyStakingAmountsById(\n address[] calldata poolIds,\n address[] calldata userList\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\n\n function getManyStakingTotalsById(\n address[] calldata poolIds\n ) external view returns (uint256[] memory stakingAmounts_);\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./IStakingCallback.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking, IStakingCallback {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards, uint256 period) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address poolId, uint256 amount) external returns (uint256 actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/staking/IStakingCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId } from \"../../udvts/Types.sol\";\n\ninterface IStakingCallback {\n /**\n * @dev Requirements:\n * - Only Profile contract can call this method.\n */\n function execChangeAdminAddress(address poolAddr, address newAdminAddr) external;\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n /**\n * @dev The address of the candidate admin.\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\n */\n address __shadowedAdmin;\n /**\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\n */\n TConsensus __shadowedConsensus;\n /**\n * @dev Address that receives mining reward of the validator\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\n */\n address payable __shadowedTreasury;\n /// @dev Address of the bridge operator corresponding to the candidate\n address ____deprecatedBridgeOperatorAddr;\n /**\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\n * Values in range [0; 100_00] stands for 0-100%\n */\n uint256 commissionRate;\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnward() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/ICandidateManagerCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICandidateManagerCallback {\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address candidateAdmin,\n address cid,\n address payable treasuryAddr,\n uint256 commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\n * This updates the shadow storage slot of \"shadowedAdmin\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeAdminAddress(address cid, address newAdmin) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\n * This updates the shadow storage slot of \"shadowedConsensus\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\n * This updates the shadow storage slot of \"shadowedTreasury\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the fast finality reward is distributed.\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\n event FastFinalityRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n /// @dev Error thrown when the info of releasing locked fund not exist.\n error ErrLockedFundReleaseInfoNotFound(address cid);\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\n error ErrLockedFundMightBeRecycled(address cid);\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfoV2.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../udvts/Types.sol\";\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(TConsensus) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(\n TConsensus addr\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(\n TConsensus addr,\n uint256 blockNum\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\n\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport { TConsensus } from \"../../../udvts/Types.sol\";\n\ninterface IValidatorInfoV2 {\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators() external view returns (address[] memory _validatorList);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducer() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./ICandidateManagerCallback.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManagerCallback,\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed cid,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed cid, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address cid, uint256 period) external;\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Error thrown when a duplicated element is detected in an array.\n * @param msgSig The function signature that invoke the error.\n */\n error ErrDuplicated(bytes4 msgSig);\n\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n unchecked {\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\n // Hashing two arrays and compare their hash\n assembly {\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n yes_ := eq(_thisHash, _otherHash)\n }\n }\n\n /**\n * @dev Return the concatenated array from a and b.\n */\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\n uint256 lengthA = a.length;\n uint256 lengthB = b.length;\n unchecked {\n c = new address[](lengthA + lengthB);\n }\n uint256 i;\n for (; i < lengthA; ) {\n c[i] = a[i];\n unchecked {\n ++i;\n }\n }\n for (uint256 j; j < lengthB; ) {\n c[i] = b[j];\n unchecked {\n ++i;\n ++j;\n }\n }\n }\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n DeprecatedBridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/precompile-usages/PCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\n /// @dev Gets the address of the precompile of picking validator set\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\n return address(0x68);\n }\n\n /**\n * @dev Sorts and arranges to return a new validator set.\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\n address _smc = precompilePickValidatorSetAddress();\n bytes memory _payload = abi.encodeWithSignature(\n \"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\",\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n bool _success = true;\n\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/precompile-usages/PCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUSortValidators is PrecompiledUsage {\n /// @dev Gets the address of the precompile of sorting validators\n function precompileSortValidatorsAddress() public view virtual returns (address) {\n return address(0x66);\n }\n\n /**\n * @dev Sorts candidates descending by their weights by calling precompile contract.\n *\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\n */\n function _pcSortCandidates(\n address[] memory _candidates,\n uint256[] memory _weights\n ) internal view virtual returns (address[] memory _result) {\n address _smc = precompileSortValidatorsAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\"sortValidators(address[],uint256[])\", _candidates, _weights);\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n }\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/validator/CandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport { HasStakingDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\nabstract contract CandidateManager is\n ICandidateManager,\n PercentageConsumer,\n GlobalConfigConsumer,\n HasContracts,\n HasStakingDeprecated\n{\n /// @dev Maximum number of validator candidate\n uint256 private _maxValidatorCandidate;\n\n /// @dev The array of candidate ids\n address[] internal _candidateIds;\n /// @dev Mapping from candidate id => bitwise negation of validator index in `_candidates`\n mapping(address => uint256) internal _candidateIndex;\n /// @dev Mapping from candidate id => their info\n mapping(address => ValidatorCandidate) internal _candidateInfo;\n\n /**\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\n * Value of 1 means the change gets affected at the beginning of the following day.\n **/\n uint256 internal _minEffectiveDaysOnwards;\n /// @dev Mapping from candidate consensus id => schedule commission change.\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ICandidateManager\n */\n function maxValidatorCandidate() public view override returns (uint256) {\n return _maxValidatorCandidate;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function minEffectiveDaysOnward() external view override returns (uint256) {\n return _minEffectiveDaysOnwards;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\n _setMaxValidatorCandidate(_number);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\n _setMinEffectiveDaysOnwards(_numOfDays);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isValidatorCandidate(TConsensus consensus) external view override returns (bool) {\n return _isValidatorCandidateById(__css2cid(consensus));\n }\n\n function _isValidatorCandidateById(address cid) internal view returns (bool) {\n return _candidateIndex[cid] != 0;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory list) {\n list = new ValidatorCandidate[](_candidateIds.length);\n for (uint i; i < list.length; ) {\n list[i] = _candidateInfo[_candidateIds[i]];\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfo(TConsensus consensus) external view override returns (ValidatorCandidate memory) {\n address validatorId = __css2cid(consensus);\n if (!_isValidatorCandidateById(validatorId)) revert ErrNonExistentCandidate();\n return _candidateInfo[validatorId];\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getValidatorCandidates() public view override returns (address[] memory) {\n return _candidateIds;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCommissionChangeSchedule(\n TConsensus consensus\n ) external view override returns (CommissionSchedule memory) {\n return _candidateCommissionChangeSchedule[__css2cid(consensus)];\n }\n\n /**\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\n * or the ones who requested to renounce their candidate role.\n *\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\n *\n */\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\n IStaking _staking = IStaking(getContract(ContractType.STAKING));\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\n uint256[] memory _selfStakings = _staking.getManySelfStakingsById(_candidateIds);\n\n uint256 _length = _candidateIds.length;\n uint256 _unsatisfiedCount;\n _unsatisfiedCandidates = new address[](_length);\n\n {\n uint256 _i;\n address cid;\n ValidatorCandidate storage _info;\n while (_i < _length) {\n cid = _candidateIds[_i];\n _info = _candidateInfo[cid];\n\n // Checks for under-balance status of candidates\n bool _hasTopupDeadline = _info.topupDeadline != 0;\n if (_selfStakings[_i] < _minStakingAmount) {\n // Updates deadline on the first time unsatisfied the staking amount condition\n if (!_hasTopupDeadline) {\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\n _info.topupDeadline = _topupDeadline;\n emit CandidateTopupDeadlineUpdated(cid, _topupDeadline);\n }\n } else if (_hasTopupDeadline) {\n // Removes the deadline if the staking amount condition is satisfied\n delete _info.topupDeadline;\n emit CandidateTopupDeadlineUpdated(cid, 0);\n }\n\n // Removes unsastisfied candidates\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\n _emergencyExitLockedFundReleased(cid);\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\n if (_revokingActivated || _topupDeadlineMissed) {\n _selfStakings[_i] = _selfStakings[--_length];\n unchecked {\n _unsatisfiedCandidates[_unsatisfiedCount++] = cid;\n }\n _removeCandidate(cid);\n continue;\n }\n\n // Checks for schedule of commission change and updates commission rate\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[cid].effectiveTimestamp;\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\n uint256 _commisionRate = _candidateCommissionChangeSchedule[cid].commissionRate;\n delete _candidateCommissionChangeSchedule[cid];\n _info.commissionRate = _commisionRate;\n emit CommissionRateUpdated(cid, _commisionRate);\n }\n\n unchecked {\n _i++;\n }\n }\n }\n\n assembly {\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\n }\n\n if (_unsatisfiedCount > 0) {\n emit CandidatesRevoked(_unsatisfiedCandidates);\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isCandidateAdmin(TConsensus consensusAddr, address admin) external view override returns (bool) {\n return _isCandidateAdminById(__css2cid(consensusAddr), admin);\n }\n\n function _isCandidateAdminById(address candidateId, address admin) internal view returns (bool) {\n return _candidateInfo[candidateId].__shadowedAdmin == admin;\n }\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\n _maxValidatorCandidate = _threshold;\n emit MaxValidatorCandidateUpdated(_threshold);\n }\n\n /**\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\n _minEffectiveDaysOnwards = _numOfDays;\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\n }\n\n /**\n * @dev Removes the candidate.\n */\n function _removeCandidate(address _addr) internal virtual {\n uint256 idx = _candidateIndex[_addr];\n if (idx == 0) {\n return;\n }\n\n delete _candidateInfo[_addr];\n delete _candidateIndex[_addr];\n delete _candidateCommissionChangeSchedule[_addr];\n\n address lastCid = _candidateIds[_candidateIds.length - 1];\n if (lastCid != _addr) {\n _candidateIndex[lastCid] = idx;\n _candidateIds[~idx] = lastCid;\n }\n\n _candidateIds.pop();\n }\n\n /**\n * @dev Sets timestamp to revoke a candidate.\n */\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 timestamp) internal {\n address cid = __css2cid(_candidate.__shadowedConsensus);\n if (!_isValidatorCandidateById(cid)) revert ErrNonExistentCandidate();\n _candidate.revokingTimestamp = timestamp;\n emit CandidateRevokingTimestampUpdated(cid, timestamp);\n }\n\n /**\n * @dev Returns a flag indicating whether the fund is unlocked.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\n\n /**\n * @dev Returns whether the validator id is a trusted org or not.\n */\n function _isTrustedOrg(address validatorId) internal virtual returns (bool);\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/CandidateManagerCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/ICandidateManagerCallback.sol\";\nimport \"./CandidateManager.sol\";\n\nabstract contract CandidateManagerCallback is ICandidateManagerCallback, CandidateManager {\n // //\n // ----------- Staking's Callbacks ----------- //\n // //\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execApplyValidatorCandidate(\n address candidateAdmin,\n address cid,\n address payable treasuryAddr,\n uint256 commissionRate\n ) external override onlyContract(ContractType.STAKING) {\n uint256 length = _candidateIds.length;\n if (length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\n if (_isValidatorCandidateById(cid)) revert ErrExistentCandidate();\n if (commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n\n for (uint i; i < length; ) {\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidateIds[i]];\n if (candidateAdmin == existentInfo.__shadowedAdmin) revert ErrExistentCandidateAdmin(candidateAdmin);\n if (treasuryAddr == existentInfo.__shadowedTreasury) revert ErrExistentTreasury(treasuryAddr);\n\n unchecked {\n ++i;\n }\n }\n\n _candidateIndex[cid] = ~length;\n _candidateIds.push(cid);\n\n ValidatorCandidate storage _info = _candidateInfo[cid];\n _info.__shadowedAdmin = candidateAdmin;\n _info.__shadowedConsensus = TConsensus.wrap(cid);\n _info.__shadowedTreasury = treasuryAddr;\n _info.commissionRate = commissionRate;\n emit CandidateGranted(cid, treasuryAddr, candidateAdmin);\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execRequestRenounceCandidate(\n address cid,\n uint256 secsLeft\n ) external override onlyContract(ContractType.STAKING) {\n if (_isTrustedOrg(cid)) revert ErrTrustedOrgCannotRenounce();\n\n ValidatorCandidate storage _info = _candidateInfo[cid];\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\n _setRevokingTimestamp(_info, block.timestamp + secsLeft);\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execRequestUpdateCommissionRate(\n address cid,\n uint256 effectiveDaysOnwards,\n uint256 commissionRate\n ) external override onlyContract(ContractType.STAKING) {\n if (_candidateCommissionChangeSchedule[cid].effectiveTimestamp != 0) {\n revert ErrAlreadyRequestedUpdatingCommissionRate();\n }\n if (commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n if (effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\n\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[cid];\n uint256 effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + effectiveDaysOnwards) * PERIOD_DURATION;\n _schedule.effectiveTimestamp = effectiveTimestamp;\n _schedule.commissionRate = commissionRate;\n\n emit CommissionRateUpdateScheduled(cid, effectiveTimestamp, commissionRate);\n }\n\n // //\n // ----------- Profile's Callbacks ----------- //\n // //\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execChangeConsensusAddress(\n address cid,\n TConsensus newConsensusAddr\n ) external override onlyContract(ContractType.PROFILE) {\n _candidateInfo[cid].__shadowedConsensus = newConsensusAddr;\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execChangeAdminAddress(address cid, address newAdmin) external onlyContract(ContractType.PROFILE) {\n _candidateInfo[cid].__shadowedAdmin = newAdmin;\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execChangeTreasuryAddress(\n address cid,\n address payable newTreasury\n ) external onlyContract(ContractType.PROFILE) {\n _candidateInfo[cid].__shadowedTreasury = newTreasury;\n }\n}\n" + }, + "contracts/ronin/validator/CoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"../../interfaces/IStakingVesting.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/IFastFinalityTracking.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"../../interfaces/validator/ICoinbaseExecution.sol\";\nimport \"../../libraries/EnumFlags.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasStakingVestingDeprecated, HasBridgeTrackingDeprecated, HasMaintenanceDeprecated, HasSlashIndicatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"../../precompile-usages/PCUSortValidators.sol\";\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport { EmergencyExit } from \"./EmergencyExit.sol\";\nimport { TPoolId } from \"../../udvts/Types.sol\";\nimport { ErrCallerMustBeCoinbase } from \"../../utils/CommonErrors.sol\";\n\nabstract contract CoinbaseExecution is\n ICoinbaseExecution,\n RONTransferHelper,\n PCUSortValidators,\n PCUPickValidatorSet,\n HasContracts,\n HasStakingVestingDeprecated,\n HasBridgeTrackingDeprecated,\n HasMaintenanceDeprecated,\n HasSlashIndicatorDeprecated,\n EmergencyExit\n{\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n modifier onlyCoinbase() {\n _requireCoinbase();\n _;\n }\n\n modifier whenEpochEnding() {\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\n _;\n }\n\n modifier oncePerEpoch() {\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\n _lastUpdatedBlock = block.number;\n _;\n }\n\n function _requireCoinbase() private view {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function submitBlockReward() external payable override onlyCoinbase {\n address id = __css2cid(TConsensus.wrap(msg.sender));\n\n bool requestForBlockProducer = _isBlockProducerById(id) &&\n !_isJailedById(id) &&\n !_miningRewardDeprecatedById(id, currentPeriod());\n\n (, uint256 blockProducerBonus, , uint256 fastFinalityRewardPercentage) = IStakingVesting(\n getContract(ContractType.STAKING_VESTING)\n ).requestBonus({ forBlockProducer: requestForBlockProducer, forBridgeOperator: false });\n\n // Deprecates reward for non-validator or slashed validator\n if (!requestForBlockProducer) {\n _totalDeprecatedReward += msg.value;\n emit BlockRewardDeprecated(id, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\n return;\n }\n\n emit BlockRewardSubmitted(id, msg.value, blockProducerBonus);\n\n uint256 period = currentPeriod();\n uint256 reward = msg.value + blockProducerBonus;\n uint256 rewardFastFinality = (reward * fastFinalityRewardPercentage) / _MAX_PERCENTAGE; // reward for fast finality\n uint256 rewardProducingBlock = reward - rewardFastFinality; // reward for producing blocks\n uint256 cutOffReward;\n\n // Add fast finality reward to total reward for current epoch, then split it later in the {wrapUpEpoch} method.\n _totalFastFinalityReward += rewardFastFinality;\n\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][period]) {\n (, , , uint256 cutOffPercentage) = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR))\n .getCreditScoreConfigs();\n cutOffReward = (rewardProducingBlock * cutOffPercentage) / _MAX_PERCENTAGE;\n _totalDeprecatedReward += cutOffReward;\n emit BlockRewardDeprecated(id, cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\n }\n\n rewardProducingBlock -= cutOffReward;\n (uint256 minRate, uint256 maxRate) = IStaking(getContract(ContractType.STAKING)).getCommissionRateRange();\n uint256 rate = Math.max(Math.min(_candidateInfo[id].commissionRate, maxRate), minRate);\n uint256 miningAmount = (rate * rewardProducingBlock) / _MAX_PERCENTAGE;\n _miningReward[id] += miningAmount;\n _delegatingReward[id] += (rewardProducingBlock - miningAmount);\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\n uint256 newPeriod = _computePeriod(block.timestamp);\n bool periodEnding = _isPeriodEnding(newPeriod);\n\n address[] memory currValidatorIds = getValidators();\n address[] memory revokedCandidateIds;\n uint256 epoch = epochOf(block.number);\n uint256 nextEpoch = epoch + 1;\n uint256 lastPeriod = currentPeriod();\n\n _syncFastFinalityReward(epoch, currValidatorIds);\n\n if (periodEnding) {\n (\n uint256 totalDelegatingReward,\n uint256[] memory delegatingRewards\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(lastPeriod, currValidatorIds);\n _settleAndTransferDelegatingRewards(lastPeriod, currValidatorIds, totalDelegatingReward, delegatingRewards);\n _tryRecycleLockedFundsFromEmergencyExits();\n _recycleDeprecatedRewards();\n\n ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR));\n slashIndicatorContract.execUpdateCreditScores(currValidatorIds, lastPeriod);\n (currValidatorIds, revokedCandidateIds) = _syncValidatorSet(newPeriod);\n if (revokedCandidateIds.length > 0) {\n slashIndicatorContract.execResetCreditScores(revokedCandidateIds);\n }\n _currentPeriodStartAtBlock = block.number + 1;\n }\n _revampRoles(newPeriod, nextEpoch, currValidatorIds);\n emit WrappedUpEpoch(lastPeriod, epoch, periodEnding);\n _periodOf[nextEpoch] = newPeriod;\n _lastUpdatedPeriod = newPeriod;\n }\n\n /**\n * @dev This method calculate and update reward of each `validators` accordingly their fast finality voting performance\n * in the `epoch`. The leftover reward is added to the {_totalDeprecatedReward} and is recycled later to the\n * {StakingVesting} contract.\n *\n * Requirements:\n * - This method is only called once each epoch.\n */\n function _syncFastFinalityReward(uint256 epoch, address[] memory validatorIds) private {\n uint256[] memory voteCounts = IFastFinalityTracking(getContract(ContractType.FAST_FINALITY_TRACKING))\n .getManyFinalityVoteCounts(epoch, validatorIds);\n uint256 divisor = _numberOfBlocksInEpoch * validatorIds.length;\n uint256 iReward;\n uint256 totalReward = _totalFastFinalityReward;\n uint256 totalDispensedReward = 0;\n\n for (uint i; i < validatorIds.length; ) {\n iReward = (totalReward * voteCounts[i]) / divisor;\n _fastFinalityReward[validatorIds[i]] += iReward;\n totalDispensedReward += iReward;\n unchecked {\n ++i;\n }\n }\n\n _totalDeprecatedReward += (totalReward - totalDispensedReward);\n delete _totalFastFinalityReward;\n }\n\n /**\n * @dev This loops over all current validators to:\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\n * - Update the total deprecated reward if the two previous conditions do not satisfy.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\n uint256 lastPeriod,\n address[] memory currValidatorIds\n ) private returns (uint256 totalDelegatingReward, uint256[] memory delegatingRewards) {\n address vId; // validator id\n address payable treasury;\n delegatingRewards = new uint256[](currValidatorIds.length);\n\n for (uint _i; _i < currValidatorIds.length; ) {\n vId = currValidatorIds[_i];\n treasury = _candidateInfo[vId].__shadowedTreasury;\n\n if (!_isJailedById(vId) && !_miningRewardDeprecatedById(vId, lastPeriod)) {\n totalDelegatingReward += _delegatingReward[vId];\n delegatingRewards[_i] = _delegatingReward[vId];\n _distributeMiningReward(vId, treasury);\n _distributeFastFinalityReward(vId, treasury);\n } else {\n _totalDeprecatedReward += _miningReward[vId] + _delegatingReward[vId] + _fastFinalityReward[vId];\n }\n\n delete _delegatingReward[vId];\n delete _miningReward[vId];\n delete _fastFinalityReward[vId];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\n *\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeMiningReward(address cid, address payable treasury) private {\n uint256 amount = _miningReward[cid];\n if (amount > 0) {\n if (_unsafeSendRONLimitGas(treasury, amount, DEFAULT_ADDITION_GAS)) {\n emit MiningRewardDistributed(cid, treasury, amount);\n return;\n }\n\n emit MiningRewardDistributionFailed(cid, treasury, amount, address(this).balance);\n }\n }\n\n function _distributeFastFinalityReward(address cid, address payable treasury) private {\n uint256 amount = _fastFinalityReward[cid];\n if (amount > 0) {\n if (_unsafeSendRONLimitGas(treasury, amount, DEFAULT_ADDITION_GAS)) {\n emit FastFinalityRewardDistributed(cid, treasury, amount);\n return;\n }\n\n emit FastFinalityRewardDistributionFailed(cid, treasury, amount, address(this).balance);\n }\n }\n\n /**\n * @dev Helper function to settle rewards for delegators of `currValidatorIds` at the end of each period,\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\n *\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _settleAndTransferDelegatingRewards(\n uint256 period,\n address[] memory currValidatorIds,\n uint256 totalDelegatingReward,\n uint256[] memory delegatingRewards\n ) private {\n IStaking _staking = IStaking(getContract(ContractType.STAKING));\n if (totalDelegatingReward > 0) {\n if (_unsafeSendRON(payable(address(_staking)), totalDelegatingReward)) {\n _staking.execRecordRewards(currValidatorIds, delegatingRewards, period);\n emit StakingRewardDistributed(totalDelegatingReward, currValidatorIds, delegatingRewards);\n return;\n }\n\n emit StakingRewardDistributionFailed(\n totalDelegatingReward,\n currValidatorIds,\n delegatingRewards,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\n * to the staking vesting contract\n *\n * Note: This method should be called once in the end of each period.\n */\n function _recycleDeprecatedRewards() private {\n uint256 withdrawAmount = _totalDeprecatedReward;\n\n if (withdrawAmount != 0) {\n address withdrawTarget = getContract(ContractType.STAKING_VESTING);\n\n delete _totalDeprecatedReward;\n\n (bool _success, ) = withdrawTarget.call{ value: withdrawAmount }(\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\n );\n\n if (_success) {\n emit DeprecatedRewardRecycled(withdrawTarget, withdrawAmount);\n } else {\n emit DeprecatedRewardRecycleFailed(withdrawTarget, withdrawAmount, address(this).balance);\n }\n }\n }\n\n /**\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncValidatorSet(\n uint256 newPeriod\n ) private returns (address[] memory newValidatorIds, address[] memory unsatisfiedCandidates) {\n unsatisfiedCandidates = _syncCandidateSet(newPeriod);\n uint256[] memory weights = IStaking(getContract(ContractType.STAKING)).getManyStakingTotalsById(_candidateIds);\n uint256[] memory trustedWeights = IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION))\n .getConsensusWeightsById(_candidateIds);\n uint256 newValidatorCount;\n (newValidatorIds, newValidatorCount) = _pcPickValidatorSet(\n _candidateIds,\n weights,\n trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n _setNewValidatorSet(newValidatorIds, newValidatorCount, newPeriod);\n }\n\n /**\n * @dev Private helper function helps writing the new validator set into the contract storage.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _setNewValidatorSet(\n address[] memory _newValidators,\n uint256 _newValidatorCount,\n uint256 _newPeriod\n ) private {\n // Remove exceeding validators in the current set\n for (uint256 _i = _newValidatorCount; _i < _validatorCount; ) {\n delete _validatorMap[_validatorIds[_i]];\n delete _validatorIds[_i];\n\n unchecked {\n ++_i;\n }\n }\n\n // Remove flag for all validator in the current set\n for (uint _i; _i < _newValidatorCount; ) {\n delete _validatorMap[_validatorIds[_i]];\n\n unchecked {\n ++_i;\n }\n }\n\n // Update new validator set and set flag correspondingly.\n for (uint256 _i; _i < _newValidatorCount; ) {\n address _newValidator = _newValidators[_i];\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\n _validatorIds[_i] = _newValidator;\n\n unchecked {\n ++_i;\n }\n }\n\n _validatorCount = _newValidatorCount;\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\n }\n\n /**\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\n *\n * Requirements:\n * - This method is called at the end of each epoch\n *\n * Emits the `BlockProducerSetUpdated` event.\n * Emits the `BridgeOperatorSetUpdated` event.\n *\n */\n function _revampRoles(uint256 _newPeriod, uint256 _nextEpoch, address[] memory currValidatorIds) private {\n bool[] memory _maintainedList = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedById(\n currValidatorIds,\n block.number + 1\n );\n\n for (uint _i; _i < currValidatorIds.length; ) {\n address validatorId = currValidatorIds[_i];\n bool emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[validatorId];\n bool isProducerBefore = _isBlockProducerById(validatorId);\n bool isProducerAfter = !(_isJailedAtBlockById(validatorId, block.number + 1) ||\n _maintainedList[_i] ||\n emergencyExitRequested);\n\n if (!isProducerBefore && isProducerAfter) {\n _validatorMap[validatorId] = _validatorMap[validatorId].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\n } else if (isProducerBefore && !isProducerAfter) {\n _validatorMap[validatorId] = _validatorMap[validatorId].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n unchecked {\n ++_i;\n }\n }\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\n }\n\n /**\n * @dev Override `CandidateManager-_isTrustedOrg`.\n */\n function _isTrustedOrg(address validatorId) internal view override returns (bool) {\n return\n IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getConsensusWeightById(\n validatorId\n ) > 0;\n }\n}\n" + }, + "contracts/ronin/validator/EmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../interfaces/validator/IEmergencyExit.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManagerCallback.sol\";\n\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManagerCallback, CommonStorage {\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExitLockedAmount() external view returns (uint256) {\n return _emergencyExitLockedAmount;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExpiryDuration() external view returns (uint256) {\n return _emergencyExpiryDuration;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execRequestEmergencyExit(address cid, uint256 secLeftToRevoke) external onlyContract(ContractType.STAKING) {\n EmergencyExitInfo storage _info = _exitInfo[cid];\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\n\n uint256 revokingTimestamp = block.timestamp + secLeftToRevoke;\n _setRevokingTimestamp(_candidateInfo[cid], revokingTimestamp);\n _emergencyExitJailedTimestamp[cid] = revokingTimestamp;\n\n uint256 deductedAmount = IStaking(msg.sender).execDeductStakingAmount(cid, _emergencyExitLockedAmount);\n if (deductedAmount > 0) {\n uint256 recyclingAt = block.timestamp + _emergencyExpiryDuration;\n _lockedConsensusList.push(cid);\n _info.lockedAmount = deductedAmount;\n _info.recyclingAt = recyclingAt;\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\n cid,\n _candidateInfo[cid].__shadowedTreasury,\n block.timestamp,\n recyclingAt\n );\n }\n emit EmergencyExitRequested(cid, deductedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExitLockedAmount(uint256 amount) external onlyAdmin {\n _setEmergencyExitLockedAmount(amount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExpiryDuration(uint256 duration) external onlyAdmin {\n _setEmergencyExpiryDuration(duration);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execReleaseLockedFundForEmergencyExitRequest(address cid, address payable recipient) external onlyAdmin {\n if (_exitInfo[cid].recyclingAt == 0) {\n revert ErrLockedFundReleaseInfoNotFound(cid);\n }\n\n uint256 length = _lockedConsensusList.length;\n uint256 index = length;\n\n for (uint i; i < length; ) {\n if (_lockedConsensusList[i] == cid) {\n index = i;\n break;\n }\n\n unchecked {\n ++i;\n }\n }\n\n // The locked amount might be recycled\n if (index == length) {\n revert ErrLockedFundMightBeRecycled(cid);\n }\n\n uint256 amount = _exitInfo[cid].lockedAmount;\n if (amount > 0) {\n delete _exitInfo[cid];\n if (length > 1) {\n _lockedConsensusList[index] = _lockedConsensusList[length - 1];\n }\n _lockedConsensusList.pop();\n\n _lockedFundReleased[cid] = true;\n if (_unsafeSendRONLimitGas(recipient, amount, DEFAULT_ADDITION_GAS)) {\n emit EmergencyExitLockedFundReleased(cid, recipient, amount);\n return;\n }\n\n emit EmergencyExitLockedFundReleasingFailed(cid, recipient, amount, address(this).balance);\n }\n }\n\n /**\n * @dev Tries to recycle the locked funds from emergency exit requests.\n */\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\n uint256 length = _lockedConsensusList.length;\n\n uint256 i;\n address addr;\n EmergencyExitInfo storage _info;\n\n while (i < length) {\n addr = _lockedConsensusList[i];\n _info = _exitInfo[addr];\n\n if (_info.recyclingAt <= block.timestamp) {\n _totalDeprecatedReward += _info.lockedAmount;\n\n delete _exitInfo[addr];\n if (--length > 0) {\n _lockedConsensusList[i] = _lockedConsensusList[length];\n }\n _lockedConsensusList.pop();\n continue;\n }\n\n unchecked {\n i++;\n }\n }\n }\n\n /**\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\n */\n function _emergencyExitLockedFundReleased(address cid) internal virtual override returns (bool) {\n return _lockedFundReleased[cid];\n }\n\n /**\n * @dev Override `CandidateManager-_removeCandidate`.\n */\n function _removeCandidate(address cid) internal override {\n delete _lockedFundReleased[cid];\n super._removeCandidate(cid);\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(\n TConsensus consensusAddr\n ) internal view virtual override(CandidateManager, CommonStorage) returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(\n TConsensus[] memory consensusAddrs\n ) internal view virtual override(CandidateManager, CommonStorage) returns (address[] memory);\n\n /**\n * @dev See `setEmergencyExitLockedAmount.\n */\n function _setEmergencyExitLockedAmount(uint256 amount) internal {\n _emergencyExitLockedAmount = amount;\n emit EmergencyExitLockedAmountUpdated(amount);\n }\n\n /**\n * @dev See `setEmergencyExpiryDuration`.\n */\n function _setEmergencyExpiryDuration(uint256 duration) internal {\n _emergencyExpiryDuration = duration;\n emit EmergencyExpiryDurationUpdated(duration);\n }\n}\n" + }, + "contracts/ronin/validator/RoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CoinbaseExecution.sol\";\nimport \"./SlashingExecution.sol\";\n\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\n constructor() {\n _disableInitializers();\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __slashIndicatorContract,\n address __stakingContract,\n address __stakingVestingContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address /* __bridgeTrackingContract */,\n uint256 __maxValidatorNumber,\n uint256 __maxValidatorCandidate,\n uint256 __maxPrioritizedValidatorNumber,\n uint256 __minEffectiveDaysOnwards,\n uint256 __numberOfBlocksInEpoch,\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\n uint256[2] calldata __emergencyExitConfigs\n ) external initializer {\n _setContract(ContractType.SLASH_INDICATOR, __slashIndicatorContract);\n _setContract(ContractType.STAKING, __stakingContract);\n _setContract(ContractType.STAKING_VESTING, __stakingVestingContract);\n _setContract(ContractType.MAINTENANCE, __maintenanceContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract);\n\n _setMaxValidatorNumber(__maxValidatorNumber);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n }\n\n function initializeV2() external reinitializer(2) {\n _setContract(ContractType.STAKING, ______deprecatedStakingContract);\n _setContract(ContractType.MAINTENANCE, ______deprecatedMaintenance);\n _setContract(ContractType.SLASH_INDICATOR, ______deprecatedSlashIndicator);\n _setContract(ContractType.STAKING_VESTING, ______deprecatedStakingVesting);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ______deprecatedTrustedOrg);\n\n delete ______deprecatedStakingContract;\n delete ______deprecatedMaintenance;\n delete ______deprecatedSlashIndicator;\n delete ______deprecatedStakingVesting;\n delete ______deprecatedBridgeTracking;\n delete ______deprecatedTrustedOrg;\n }\n\n function initializeV3(address fastFinalityTrackingContract) external reinitializer(3) {\n _setContract(ContractType.FAST_FINALITY_TRACKING, fastFinalityTrackingContract);\n }\n\n function initializeV4(address profileContract) external reinitializer(4) {\n _setContract(ContractType.PROFILE, profileContract);\n }\n\n /**\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\n * deducting amount on slashing).\n */\n function _fallback() internal view {\n if (msg.sender != getContract(ContractType.STAKING_VESTING) && msg.sender != getContract(ContractType.STAKING)) {\n revert ErrUnauthorizedReceiveRON();\n }\n }\n\n /**\n * @dev Convert consensus address to corresponding id from the Profile contract.\n */\n function __css2cid(TConsensus consensusAddr) internal view override(EmergencyExit, CommonStorage) returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n /**\n * @dev Convert many consensus addresses to corresponding ids from the Profile contract.\n */\n function __css2cidBatch(\n TConsensus[] memory consensusAddrs\n ) internal view override(EmergencyExit, CommonStorage) returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n}\n" + }, + "contracts/ronin/validator/SlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../interfaces/validator/ISlashingExecution.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasSlashIndicatorDeprecated, HasStakingDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\n\nabstract contract SlashingExecution is\n ISlashingExecution,\n HasContracts,\n HasSlashIndicatorDeprecated,\n HasStakingDeprecated,\n CommonStorage\n{\n /**\n * @inheritdoc ISlashingExecution\n */\n function execSlash(\n address validatorId,\n uint256 newJailedUntil,\n uint256 slashAmount,\n bool cannotBailout\n ) external override onlyContract(ContractType.SLASH_INDICATOR) {\n uint256 period = currentPeriod();\n _miningRewardDeprecatedAtPeriod[validatorId][period] = true;\n\n _totalDeprecatedReward += _miningReward[validatorId] + _delegatingReward[validatorId];\n\n delete _miningReward[validatorId];\n delete _delegatingReward[validatorId];\n\n _blockProducerJailedBlock[validatorId] = Math.max(newJailedUntil, _blockProducerJailedBlock[validatorId]);\n\n if (slashAmount > 0) {\n uint256 _actualAmount = IStaking(getContract(ContractType.STAKING)).execDeductStakingAmount(\n validatorId,\n slashAmount\n );\n _totalDeprecatedReward += _actualAmount;\n }\n\n if (cannotBailout) {\n _cannotBailoutUntilBlock[validatorId] = Math.max(newJailedUntil, _cannotBailoutUntilBlock[validatorId]);\n }\n\n emit ValidatorPunished(validatorId, period, _blockProducerJailedBlock[validatorId], slashAmount, true, false);\n }\n\n /**\n * @inheritdoc ISlashingExecution\n */\n function execBailOut(\n address validatorId,\n uint256 period\n ) external override onlyContract(ContractType.SLASH_INDICATOR) {\n if (block.number <= _cannotBailoutUntilBlock[validatorId]) revert ErrCannotBailout(validatorId);\n\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\n // removed previously in the `slash` function.\n _miningRewardBailoutCutOffAtPeriod[validatorId][period] = true;\n _miningRewardDeprecatedAtPeriod[validatorId][period] = false;\n _blockProducerJailedBlock[validatorId] = block.number - 1;\n\n emit ValidatorUnjailed(validatorId, period);\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/CommonStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/ICommonInfo.sol\";\nimport \"./JailingStorage.sol\";\nimport \"./TimingStorage.sol\";\nimport \"./ValidatorInfoStorageV2.sol\";\n\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorageV2 {\n /// @dev Mapping from consensus address => pending reward from producing block\n mapping(address => uint256) internal _miningReward;\n /// @dev Mapping from consensus address => pending reward from delegating\n mapping(address => uint256) internal _delegatingReward;\n\n /// @dev The total reward for fast finality\n uint256 internal _totalFastFinalityReward;\n /// @dev Mapping from consensus address => pending reward for fast finality\n mapping(address => uint256) internal _fastFinalityReward;\n\n /// @dev The deprecated reward that has not been withdrawn by admin\n uint256 internal _totalDeprecatedReward;\n\n /// @dev The amount of RON to lock from a consensus address.\n uint256 internal _emergencyExitLockedAmount;\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\n uint256 internal _emergencyExpiryDuration;\n /// @dev The address list of consensus addresses that being locked fund.\n address[] internal _lockedConsensusList;\n /// @dev Mapping from consensus => request exist info\n mapping(address => EmergencyExitInfo) internal _exitInfo;\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\n mapping(address => bool) internal _lockedFundReleased;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[44] private ______gap;\n\n /**\n * @inheritdoc ICommonInfo\n */\n function getEmergencyExitInfo(TConsensus consensus) external view override returns (EmergencyExitInfo memory _info) {\n _info = _exitInfo[__css2cid(consensus)];\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\n }\n\n /**\n * @inheritdoc ICommonInfo\n */\n function totalDeprecatedReward() external view override returns (uint256) {\n return _totalDeprecatedReward;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(\n uint256 _block\n ) public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.epochOf(_block);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.currentPeriod();\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(\n TConsensus consensusAddr\n ) internal view virtual override(JailingStorage, ValidatorInfoStorageV2) returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(\n TConsensus[] memory consensusAddrs\n ) internal view virtual override(JailingStorage, ValidatorInfoStorageV2) returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/JailingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/IJailingInfo.sol\";\n\nabstract contract JailingStorage is IJailingInfo {\n /// @dev Mapping from candidate id => period number => block producer has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\n /// @dev Mapping from candidate id => period number => whether the block producer get cut off reward, due to bailout.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\n /// @dev Mapping from candidate id => period number => block operator has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal ______deprecatedBridgeRewardDeprecatedAtPeriod;\n\n /// @dev Mapping from candidate id => the last block that the block producer is jailed.\n mapping(address => uint256) internal _blockProducerJailedBlock;\n /// @dev Mapping from candidate id => the last timestamp that the bridge operator is jailed.\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\n /// @dev Mapping from candidate id => the last block that the block producer cannot bailout.\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailed(TConsensus consensus) external view override returns (bool) {\n address candidateId = __css2cid(consensus);\n return _isJailedAtBlockById(candidateId, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view override returns (bool) {\n address candidateId = __css2cid(addr);\n return _isJailedAtBlockById(candidateId, blockNum);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeft(\n TConsensus consensus\n ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {\n return _getJailedTimeLeftAtBlockById(__css2cid(consensus), block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeftAtBlock(\n TConsensus consensus,\n uint256 _blockNum\n ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {\n return _getJailedTimeLeftAtBlockById(__css2cid(consensus), _blockNum);\n }\n\n function _getJailedTimeLeftAtBlockById(\n address candidateId,\n uint256 blockNum\n ) internal view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {\n uint256 jailedBlock = _blockProducerJailedBlock[candidateId];\n if (jailedBlock < blockNum) {\n return (false, 0, 0);\n }\n\n isJailed_ = true;\n blockLeft_ = jailedBlock - blockNum + 1;\n epochLeft_ = epochOf(jailedBlock) - epochOf(blockNum) + 1;\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkManyJailed(TConsensus[] calldata consensusList) external view override returns (bool[] memory) {\n return _checkManyJailedById(__css2cidBatch(consensusList));\n }\n\n function checkManyJailedById(address[] calldata candidateIds) external view override returns (bool[] memory) {\n return _checkManyJailedById(candidateIds);\n }\n\n function _checkManyJailedById(address[] memory candidateIds) internal view returns (bool[] memory result) {\n result = new bool[](candidateIds.length);\n for (uint256 i; i < candidateIds.length; ) {\n result[i] = _isJailedById(candidateIds[i]);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecated(TConsensus consensus) external view override returns (bool) {\n uint256 period = currentPeriod();\n return _miningRewardDeprecatedById(__css2cid(consensus), period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecatedAtPeriod(\n TConsensus consensus,\n uint256 period\n ) external view override returns (bool) {\n return _miningRewardDeprecatedById(__css2cid(consensus), period);\n }\n\n /**\n * @dev See `ITimingInfo-epochOf`\n */\n function epochOf(uint256 _block) public view virtual returns (uint256);\n\n /**\n * @dev See `ITimingInfo-currentPeriod`\n */\n function currentPeriod() public view virtual returns (uint256);\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\n */\n function _isJailedById(address validatorId) internal view returns (bool) {\n return _isJailedAtBlockById(validatorId, block.number);\n }\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\n */\n function _isJailedAtBlockById(address validatorId, uint256 blockNum) internal view returns (bool) {\n return blockNum <= _blockProducerJailedBlock[validatorId];\n }\n\n /**\n * @dev Returns whether the block producer has no pending reward in that period.\n */\n function _miningRewardDeprecatedById(address validatorId, uint256 period) internal view returns (bool) {\n return _miningRewardDeprecatedAtPeriod[validatorId][period];\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/TimingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../../interfaces/validator/info-fragments/ITimingInfo.sol\";\n\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\n /// @dev The number of blocks in a epoch\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev The last updated block\n uint256 internal _lastUpdatedBlock;\n /// @dev The last updated period\n uint256 internal _lastUpdatedPeriod;\n /// @dev The starting block of the last updated period\n uint256 internal _currentPeriodStartAtBlock;\n\n /// @dev Mapping from epoch index => period index\n mapping(uint256 => uint256) internal _periodOf;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @inheritdoc ITimingInfo\n */\n function getLastUpdatedBlock() external view override returns (uint256) {\n return _lastUpdatedBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\n return _block / _numberOfBlocksInEpoch + 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function isPeriodEnding() external view override returns (bool) {\n return _isPeriodEnding(_computePeriod(block.timestamp));\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override returns (uint256) {\n return _lastUpdatedPeriod;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriodStartAtBlock() public view override returns (uint256) {\n return _currentPeriodStartAtBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\n return _numberOfBlocksInEpoch;\n }\n\n /**\n * @dev See `ITimingInfo-isPeriodEnding`\n */\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\n return _newPeriod > _lastUpdatedPeriod;\n }\n\n /**\n * @dev Returns the calculated period.\n */\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\n return _timestamp / PERIOD_DURATION;\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport { HasTrustedOrgDeprecated } from \"../../../utils/DeprecatedSlots.sol\";\nimport \"../../../extensions/collections/HasContracts.sol\";\nimport \"../../../interfaces/validator/info-fragments/IValidatorInfoV2.sol\";\nimport \"../../../interfaces/IProfile.sol\";\nimport { TConsensus } from \"../../../udvts/Types.sol\";\n\nabstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasTrustedOrgDeprecated {\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev The maximum number of validator.\n uint256 internal _maxValidatorNumber;\n\n /// @dev The total of validators\n uint256 internal _validatorCount;\n /// @dev Mapping from validator index => validator id address\n mapping(uint256 => address) internal _validatorIds;\n /// @dev Mapping from validator id => flag indicating the validator ability: producing block, operating bridge\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\n /// @dev The number of slot that is reserved for prioritized validators\n uint256 internal _maxPrioritizedValidatorNumber;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n function validatorCount() external view returns (uint256) {\n return _validatorCount;\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function getValidators() public view override returns (address[] memory validatorList_) {\n validatorList_ = new address[](_validatorCount);\n address iValidator;\n for (uint i; i < validatorList_.length; ) {\n iValidator = _validatorIds[i];\n validatorList_[i] = iValidator;\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function getBlockProducers() public view override returns (address[] memory result) {\n result = new address[](_validatorCount);\n uint256 count = 0;\n for (uint i; i < result.length; ) {\n address validatorId = _validatorIds[i];\n if (_isBlockProducerById(validatorId)) {\n result[count++] = validatorId;\n }\n\n unchecked {\n ++i;\n }\n }\n\n assembly {\n mstore(result, count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function isBlockProducer(TConsensus consensusAddr) public view override returns (bool) {\n return _isBlockProducerById(__css2cid(consensusAddr));\n }\n\n function _isBlockProducerById(address id) internal view returns (bool) {\n return _validatorMap[id].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function totalBlockProducer() external view returns (uint256 total) {\n unchecked {\n for (uint i; i < _validatorCount; i++) {\n if (_isBlockProducerById(_validatorIds[i])) {\n total++;\n }\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\n return _maxValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\n return _maxPrioritizedValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\n _setMaxValidatorNumber(_max);\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\n _setMaxPrioritizedValidatorNumber(_number);\n }\n\n /**\n * @dev See `IValidatorInfoV2-setMaxValidatorNumber`\n */\n function _setMaxValidatorNumber(uint256 _number) internal {\n _maxValidatorNumber = _number;\n emit MaxValidatorNumberUpdated(_number);\n }\n\n /**\n * @dev See `IValidatorInfoV2-setMaxPrioritizedValidatorNumber`\n */\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\n _maxPrioritizedValidatorNumber = _number;\n emit MaxPrioritizedValidatorNumberUpdated(_number);\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n}\n" + }, + "contracts/udvts/Types.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ntype TPoolId is address;\ntype TConsensus is address;\n\nusing { TPoolIdEq as == } for TPoolId global;\nusing { TConsensusEq as == } for TConsensus global;\n\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\n}\n\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\n}\n" + }, + "contracts/utils/CommonErrors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { ContractType } from \"./ContractType.sol\";\nimport { RoleAccess } from \"./RoleAccess.sol\";\n\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\n\n/**\n * @dev Error raised when a bridge operator update operation fails.\n * @param bridgeOperator The address of the bridge operator that failed to update.\n */\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\n\n/**\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\n */\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\n\n/**\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\n */\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\n\n/**\n * @dev The error indicating an unsupported interface.\n * @param interfaceId The bytes4 interface identifier that is not supported.\n * @param addr The address where the unsupported interface was encountered.\n */\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\n\n/**\n * @dev Error thrown when the return data from a callback function is invalid.\n * @param callbackFnSig The signature of the callback function that returned invalid data.\n * @param register The address of the register where the callback function was invoked.\n * @param returnData The invalid return data received from the callback function.\n */\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\n\n/**\n * @dev Error of set to non-contract.\n */\nerror ErrZeroCodeContract(address addr);\n\n/**\n * @dev Error indicating that arguments are invalid.\n */\nerror ErrInvalidArguments(bytes4 msgSig);\n\n/**\n * @dev Error indicating that given address is null when it should not.\n */\nerror ErrZeroAddress(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\n */\nerror ErrInvalidThreshold(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a function can only be called by the contract itself.\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\n */\nerror ErrOnlySelfCall(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\n * @param expectedRole The role required to perform the function.\n */\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\n */\nerror ErrUnauthorizedCall(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4).\n * @param expectedContractType The contract type required to perform the function.\n * @param actual The actual address that called to the function.\n */\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\n\n/**\n * @dev Error indicating that an array is empty when it should contain elements.\n */\nerror ErrEmptyArray();\n\n/**\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\n * @param msgSig The function signature (bytes4) that has a length mismatch.\n */\nerror ErrLengthMismatch(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a proxy call to an external contract has failed.\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\n */\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\n\n/**\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\n */\nerror ErrCallPrecompiled(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a native token transfer has failed.\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\n */\nerror ErrNativeTransferFailed(bytes4 msgSig);\n\n/**\n * @dev Error indicating that an order is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\n */\nerror ErrInvalidOrder(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the chain ID is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\n * @param actual Current chain ID that executing function.\n * @param expected Expected chain ID required for the tx to success.\n */\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\n\n/**\n * @dev Error indicating that a vote type is not supported.\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\n */\nerror ErrUnsupportedVoteType(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the proposal nonce is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\n */\nerror ErrInvalidProposalNonce(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a voter has already voted.\n * @param voter The address of the voter who has already voted.\n */\nerror ErrAlreadyVoted(address voter);\n\n/**\n * @dev Error indicating that a signature is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\n */\nerror ErrInvalidSignatures(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a relay call has failed.\n * @param msgSig The function signature (bytes4) of the relay call that failed.\n */\nerror ErrRelayFailed(bytes4 msgSig);\n/**\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\n */\nerror ErrInvalidVoteWeight(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a query was made for an outdated bridge operator set.\n */\nerror ErrQueryForOutdatedBridgeOperatorSet();\n\n/**\n * @dev Error indicating that a request is invalid.\n */\nerror ErrInvalidRequest();\n\n/**\n * @dev Error indicating that a token standard is invalid.\n */\nerror ErrInvalidTokenStandard();\n\n/**\n * @dev Error indicating that a token is not supported.\n */\nerror ErrUnsupportedToken();\n\n/**\n * @dev Error indicating that a receipt kind is invalid.\n */\nerror ErrInvalidReceiptKind();\n\n/**\n * @dev Error indicating that a receipt is invalid.\n */\nerror ErrInvalidReceipt();\n\n/**\n * @dev Error indicating that an address is not payable.\n */\nerror ErrNonpayableAddress(address);\n\n/**\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\n */\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\n\n/**\n * @dev Error thrown when an invalid vote hash is provided.\n */\nerror ErrInvalidVoteHash();\n\n/**\n * @dev Error thrown when querying for an empty vote.\n */\nerror ErrQueryForEmptyVote();\n\n/**\n * @dev Error thrown when querying for an expired vote.\n */\nerror ErrQueryForExpiredVote();\n\n/**\n * @dev Error thrown when querying for a non-existent vote.\n */\nerror ErrQueryForNonExistentVote();\n\n/**\n * @dev Error indicating that the method is only called once per block.\n */\nerror ErrOncePerBlock();\n\n/**\n * @dev Error of method caller must be coinbase\n */\nerror ErrCallerMustBeCoinbase();\n" + }, + "contracts/utils/ContractType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nenum ContractType {\n /* 0 */ UNKNOWN,\n /* 1 */ PAUSE_ENFORCER,\n /* 2 */ BRIDGE,\n /* 3 */ BRIDGE_TRACKING,\n /* 4 */ GOVERNANCE_ADMIN,\n /* 5 */ MAINTENANCE,\n /* 6 */ SLASH_INDICATOR,\n /* 7 */ STAKING_VESTING,\n /* 8 */ VALIDATOR,\n /* 9 */ STAKING,\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\n /* 11 */ BRIDGE_MANAGER,\n /* 12 */ BRIDGE_SLASH,\n /* 13 */ BRIDGE_REWARD,\n /* 14 */ FAST_FINALITY_TRACKING,\n /* 15 */ PROFILE\n}\n" + }, + "contracts/utils/DeprecatedSlots.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Deprecated Contracts\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\n * They provide functionality related to various aspects of a smart contract but have been marked\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\n */\ncontract HasSlashIndicatorDeprecated {\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\n address internal ______deprecatedSlashIndicator;\n}\n\ncontract HasStakingVestingDeprecated {\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\n address internal ______deprecatedStakingVesting;\n}\n\ncontract HasBridgeDeprecated {\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\n address internal ______deprecatedBridge;\n}\n\ncontract HasValidatorDeprecated {\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\n address internal ______deprecatedValidator;\n}\n\ncontract HasStakingDeprecated {\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\n address internal ______deprecatedStakingContract;\n}\n\ncontract HasMaintenanceDeprecated {\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\n address internal ______deprecatedMaintenance;\n}\n\ncontract HasTrustedOrgDeprecated {\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\n address internal ______deprecatedTrustedOrg;\n}\n\ncontract HasGovernanceAdminDeprecated {\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\n address internal ______deprecatedGovernanceAdmin;\n}\n\ncontract HasBridgeTrackingDeprecated {\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\n address internal ______deprecatedBridgeTracking;\n}\n" + }, + "contracts/utils/IdentityGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { AddressArrayUtils } from \"../libraries/AddressArrayUtils.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport { TransparentUpgradeableProxyV2 } from \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \"./CommonErrors.sol\";\n\nabstract contract IdentityGuard {\n using AddressArrayUtils for address[];\n\n /// @dev value is equal to keccak256(abi.encode())\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n\n /**\n * @dev Modifier to restrict functions to only be called by this contract.\n * @dev Reverts if the caller is not this contract.\n */\n modifier onlySelfCall() virtual {\n _requireSelfCall();\n _;\n }\n\n /**\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\n *\n * Requirements:\n * - The elements in the `arr` array must not contain any duplicates.\n */\n modifier nonDuplicate(address[] memory arr) virtual {\n _requireNonDuplicate(arr);\n _;\n }\n\n /**\n * @dev Internal method to check the method caller.\n * @dev Reverts if the method caller is not this contract.\n */\n function _requireSelfCall() internal view virtual {\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\n }\n\n /**\n * @dev Internal function to check if a contract address has code.\n * @param addr The address of the contract to check.\n * @dev Throws an error if the contract address has no code.\n */\n function _requireHasCode(address addr) internal view {\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\n }\n\n /**\n * @dev Checks if an address is zero and reverts if it is.\n * @param addr The address to check.\n */\n function _requireNonZeroAddress(address addr) internal pure {\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\n }\n\n /**\n * @dev Check if arr is empty and revert if it is.\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\n * @param arr The array of addresses to check.\n */\n function _requireNonDuplicate(address[] memory arr) internal pure {\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\n }\n\n /**\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\n * @notice This method only works with non-state EOA accounts\n */\n function _requireCreatedEOA(address addr) internal view {\n _requireNonZeroAddress(addr);\n bytes32 codehash = addr.codehash;\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\n }\n\n /**\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\n *\n * @param contractAddr The address of the contract to check for interface support.\n * @param interfaceId The interface ID to check for support.\n */\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\n if (!success) {\n (success, returnOrRevertData) = contractAddr.staticcall(\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\n );\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\n }\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\n }\n}\n" + }, + "contracts/utils/RoleAccess.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nenum RoleAccess {\n /* 0 */ UNKNOWN,\n /* 1 */ ADMIN,\n /* 2 */ COINBASE,\n /* 3 */ GOVERNOR,\n /* 4 */ CANDIDATE_ADMIN,\n /* 5 */ WITHDRAWAL_MIGRATOR,\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\n /* 7 */ BLOCK_PRODUCER,\n /* 8 */ VALIDATOR_CANDIDATE,\n /* 9 */ CONSENSUS,\n /* 10 */ TREASURY\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10 + }, + "metadata": { + "bytecodeHash": "none" + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/ronin-testnet/solcInputs/b469203c60a069be0ec276c20622629d.json b/deployments/ronin-testnet/solcInputs/b469203c60a069be0ec276c20622629d.json new file mode 100644 index 000000000..4f643ff17 --- /dev/null +++ b/deployments/ronin-testnet/solcInputs/b469203c60a069be0ec276c20622629d.json @@ -0,0 +1,483 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "contracts/extensions/bridge-operator-governance/BridgeTrackingHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract BridgeTrackingHelper {\n /// @dev Event emited when the bridge tracking contract tracks the invalid data, cause malform in sharing bridge reward.\n event BridgeTrackingIncorrectlyResponded();\n\n /**\n * @dev Internal function to validate the bridge tracking response for a given set of ballots.\n * @param totalBallot The total number of ballots available for the tracking response.\n * @param totalVote The total number of votes recorded in the tracking response.\n * @param ballots An array containing the individual ballot counts in the tracking response.\n * @return valid A boolean indicating whether the bridge tracking response is valid or not.\n * @notice The function checks if each individual ballot count is not greater than the total votes recorded.\n * @notice It also verifies that the sum of all individual ballot counts does not exceed the total available ballots.\n */\n function _isValidBridgeTrackingResponse(\n uint256 totalBallot,\n uint256 totalVote,\n uint256[] memory ballots\n ) internal pure returns (bool valid) {\n valid = true;\n uint256 sumBallot;\n uint256 length = ballots.length;\n\n unchecked {\n for (uint256 i; i < length; ++i) {\n if (ballots[i] > totalVote) {\n valid = false;\n break;\n }\n\n sumBallot += ballots[i];\n }\n }\n\n valid = valid && (sumBallot <= totalBallot);\n }\n}\n" + }, + "contracts/extensions/collections/HasContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { HasProxyAdmin } from \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasContracts.sol\";\nimport { IdentityGuard } from \"../../utils/IdentityGuard.sol\";\nimport { ErrUnexpectedInternalCall } from \"../../utils/CommonErrors.sol\";\n\n/**\n * @title HasContracts\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\n */\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\n /// @dev value is equal to keccak256(\"@ronin.dpos.collections.HasContracts.slot\") - 1\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\n\n /**\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\n * @param contractType The contract type that allowed to call\n */\n modifier onlyContract(ContractType contractType) virtual {\n _requireContract(contractType);\n _;\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\n _requireHasCode(addr);\n _setContract(contractType, addr);\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function getContract(ContractType contractType) public view returns (address contract_) {\n contract_ = _getContractMap()[uint8(contractType)];\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\n }\n\n /**\n * @dev Internal function to set the address of a contract with a specific role.\n * @param contractType The contract type of the contract to set.\n * @param addr The address of the contract to set.\n */\n function _setContract(ContractType contractType, address addr) internal virtual {\n _getContractMap()[uint8(contractType)] = addr;\n emit ContractUpdated(contractType, addr);\n }\n\n /**\n * @dev Internal function to access the mapping of contract addresses with roles.\n * @return contracts_ The mapping of contract addresses with roles.\n */\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\n assembly {\n contracts_.slot := _STORAGE_SLOT\n }\n }\n\n /**\n * @dev Internal function to check if the calling contract has a specific role.\n * @param contractType The contract type that the calling contract must have.\n * @dev Throws an error if the calling contract does not have the specified role.\n */\n function _requireContract(ContractType contractType) private view {\n if (msg.sender != getContract(contractType)) {\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\n }\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\nimport \"../../utils/CommonErrors.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n _requireAdmin();\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view virtual returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _requireAdmin() internal view {\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\n }\n}\n" + }, + "contracts/extensions/consumers/GlobalConfigConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract GlobalConfigConsumer {\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\n /// @dev The length of a period in second.\n uint256 public constant PERIOD_DURATION = 1 days;\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/extensions/GatewayV3.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\nimport \"../interfaces/IQuorum.sol\";\nimport \"./collections/HasProxyAdmin.sol\";\n\nabstract contract GatewayV3 is HasProxyAdmin, Pausable, IQuorum {\n uint256 internal _num;\n uint256 internal _denom;\n\n address private ______deprecated;\n uint256 public nonce;\n\n address public emergencyPauser;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @dev Grant emergency pauser role for `_addr`.\n */\n function setEmergencyPauser(address _addr) external onlyAdmin {\n emergencyPauser = _addr;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _getTotalWeight();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) external virtual onlyAdmin returns (uint256, uint256) {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @dev Triggers paused state.\n */\n function pause() external {\n _requireAuth();\n _pause();\n }\n\n /**\n * @dev Triggers unpaused state.\n */\n function unpause() external {\n _requireAuth();\n _unpause();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() public view virtual returns (uint256) {\n return _minimumVoteWeight(_getTotalWeight());\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) internal virtual returns (uint256 _previousNum, uint256 _previousDenom) {\n if (_numerator > _denominator) revert ErrInvalidThreshold(msg.sig);\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n unchecked {\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n }\n\n /**\n * @dev Returns minimum vote weight.\n */\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @dev Internal method to check method caller.\n *\n * Requirements:\n *\n * - The method caller must be admin or pauser.\n *\n */\n function _requireAuth() private view {\n if (!(msg.sender == _getAdmin() || msg.sender == emergencyPauser)) {\n revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\n }\n }\n\n /**\n * @dev Returns the total weight.\n */\n function _getTotalWeight() internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/GovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/sequential-governance/CoreGovernance.sol\";\nimport \"../extensions/collections/HasContracts.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport { ErrorHandler } from \"../libraries/ErrorHandler.sol\";\nimport { IdentityGuard } from \"../utils/IdentityGuard.sol\";\nimport { HasGovernanceAdminDeprecated, HasBridgeDeprecated } from \"../utils/DeprecatedSlots.sol\";\n\nabstract contract GovernanceAdmin is\n CoreGovernance,\n IdentityGuard,\n HasContracts,\n HasGovernanceAdminDeprecated,\n HasBridgeDeprecated\n{\n using ErrorHandler for bool;\n\n uint256 public roninChainId;\n /// @dev Domain separator\n bytes32 public DOMAIN_SEPARATOR;\n\n constructor(uint256 _roninChainId, address _roninTrustedOrganizationContract) {\n roninChainId = _roninChainId;\n\n /*\n * DOMAIN_SEPARATOR = keccak256(\n * abi.encode(\n * keccak256(\"EIP712Domain(string name,string version,bytes32 salt)\"),\n * keccak256(\"GovernanceAdmin\"), // name hash\n * keccak256(\"2\"), // version hash\n * keccak256(abi.encode(\"RONIN_GOVERNANCE_ADMIN\", _roninChainId)) // salt\n * )\n */\n assembly {\n let ptr := mload(0x40)\n\n // See abi.encode implementation: https://github.com/axieinfinity/ronin/blob/569ebd5a782da5601c6aba22799dc9b4afd39da9/accounts/abi/argument.go#L227-L267\n mstore(ptr, 0x40) // offset bytes\n mstore(add(ptr, 0x20), _roninChainId)\n mstore(add(ptr, 0x40), 0x16) // \"RONIN_GOVERNANCE_ADMIN\".length\n mstore(add(ptr, 0x60), 0x524f4e494e5f474f5645524e414e43455f41444d494e00000000000000000000) // bytes(\"RONIN_GOVERNANCE_ADMIN\")\n let salt := keccak256(ptr, 0x80) // keccak256(abi.encode(\"RONIN_GOVERNANCE_ADMIN\", _roninChainId))\n\n mstore(ptr, 0x599a80fcaa47b95e2323ab4d34d34e0cc9feda4b843edafcc30c7bdf60ea15bf) // keccak256(\"EIP712Domain(string name,string version,bytes32 salt)\")\n mstore(add(ptr, 0x20), 0x7e7935007966eb860f4a2ee3dcc9fd53fb3205ce2aa86b0126d4893d4d4c14b9) // keccak256(\"GovernanceAdmin\")\n mstore(add(ptr, 0x40), 0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4de) // keccak256(\"3\")\n mstore(add(ptr, 0x60), salt)\n sstore(DOMAIN_SEPARATOR.slot, keccak256(ptr, 0x80))\n }\n\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, _roninTrustedOrganizationContract);\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function setContract(ContractType contractType, address addr) external virtual override onlySelfCall {\n _requireHasCode(addr);\n _setContract(contractType, addr);\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n *\n * Requirements:\n * - Only allowing self-call to this method, since this contract does not have admin.\n *\n */\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Returns the current implementation of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyImplementation(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n bytes4 _selector = 0x5c60da1b;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n _success.handleRevert(_selector, _returndata);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Returns the proposal expiry duration.\n */\n function getProposalExpiryDuration() external view returns (uint256) {\n return super._getProposalExpiryDuration();\n }\n\n /**\n * @dev Returns the current admin of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyAdmin(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n bytes4 _selector = 0xf851a440;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n _success.handleRevert(_selector, _returndata);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `_proxy` to `newAdmin`.\n *\n * Requirements:\n * - This contract must be the current admin of `_proxy`.\n *\n */\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\n // bytes4(keccak256(\"changeAdmin(address)\"))\n bytes4 _selector = 0x8f283970;\n (bool _success, bytes memory _returndata) = _proxy.call(abi.encodeWithSelector(_selector, _newAdmin));\n _success.handleRevert(_selector, _returndata);\n }\n\n /**\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\n */\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\n bytes4 _selector = IQuorum.minimumVoteWeight.selector;\n (bool _success, bytes memory _returndata) = getContract(ContractType.RONIN_TRUSTED_ORGANIZATION).staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n _success.handleRevert(_selector, _returndata);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Override `CoreGovernance-_getTotalWeights`.\n */\n function _getTotalWeight() internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.totalWeight.selector;\n (bool _success, bytes memory _returndata) = getContract(ContractType.RONIN_TRUSTED_ORGANIZATION).staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n _success.handleRevert(_selector, _returndata);\n return abi.decode(_returndata, (uint256));\n }\n}\n" + }, + "contracts/extensions/MinimumWithdrawal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./collections/HasProxyAdmin.sol\";\nimport \"../libraries/Transfer.sol\";\n\nabstract contract MinimumWithdrawal is HasProxyAdmin {\n /// @dev Throwed when the ERC20 withdrawal quantity is less than the minimum threshold.\n error ErrQueryForTooSmallQuantity();\n\n /// @dev Emitted when the minimum thresholds are updated\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\n\n /// @dev Mapping from token address => minimum thresholds\n mapping(address => uint256) public minimumThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Sets the minimum thresholds to withdraw.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n if (_tokens.length == 0) revert ErrEmptyArray();\n _setMinimumThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets minimum thresholds.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n if (_tokens.length != _thresholds.length) revert ErrLengthMismatch(msg.sig);\n\n for (uint256 _i; _i < _tokens.length; ) {\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\n\n unchecked {\n ++_i;\n }\n }\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\n */\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\n if (_request.info.erc == Token.Standard.ERC20 && _request.info.quantity < minimumThreshold[_request.tokenAddr]) {\n revert ErrQueryForTooSmallQuantity();\n }\n }\n}\n" + }, + "contracts/extensions/RONTransferHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract RONTransferHelper {\n /// @dev Error of sender has insufficient balance.\n error ErrInsufficientBalance(bytes4 msgSig, uint256 currentBalance, uint256 sendAmount);\n /// @dev Error of recipient not accepting RON when transfer RON.\n error ErrRecipientRevert(bytes4 msgSig);\n\n /**\n * @dev See `_sendRON`.\n * Reverts if the recipient does not receive RON.\n */\n function _transferRON(address payable recipient, uint256 amount) internal {\n if (!_sendRON(recipient, amount)) revert ErrRecipientRevert(msg.sig);\n }\n\n /**\n * @dev Send `amount` RON to the address `recipient`.\n * Returns whether the recipient receives RON or not.\n * Reverts once the contract balance is insufficient.\n *\n * Note: consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _sendRON(address payable recipient, uint256 amount) internal returns (bool success) {\n if (address(this).balance < amount) revert ErrInsufficientBalance(msg.sig, address(this).balance, amount);\n return _unsafeSendRON(recipient, amount);\n }\n\n /**\n * @dev Unsafe send `amount` RON to the address `recipient`. If the sender's balance is insufficient,\n * the call does not revert.\n *\n * Note:\n * - Does not assert whether the balance of sender is sufficient.\n * - Does not assert whether the recipient accepts RON.\n * - Consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _unsafeSendRON(address payable recipient, uint256 amount) internal returns (bool success) {\n (success, ) = recipient.call{ value: amount }(\"\");\n }\n\n /**\n * @dev Same purpose with {_unsafeSendRONLimitGas(address,uin256)} but containing gas limit stipend forwarded in the call.\n */\n function _unsafeSendRONLimitGas(\n address payable recipient,\n uint256 amount,\n uint256 gas\n ) internal returns (bool success) {\n (success, ) = recipient.call{ value: amount, gas: gas }(\"\");\n }\n}\n" + }, + "contracts/extensions/sequential-governance/CoreGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../libraries/Proposal.sol\";\nimport \"../../libraries/GlobalProposal.sol\";\nimport \"../../utils/CommonErrors.sol\";\nimport \"../../libraries/Ballot.sol\";\nimport \"../../interfaces/consumers/ChainTypeConsumer.sol\";\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\n\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\n using Proposal for Proposal.ProposalDetail;\n\n /**\n * @dev Error thrown when attempting to interact with a finalized vote.\n */\n error ErrVoteIsFinalized();\n\n /**\n * @dev Error thrown when the current proposal is not completed.\n */\n error ErrCurrentProposalIsNotCompleted();\n\n struct ProposalVote {\n VoteStatus status;\n bytes32 hash;\n uint256 againstVoteWeight; // Total weight of against votes\n uint256 forVoteWeight; // Total weight of for votes\n address[] forVoteds; // Array of addresses voting for\n address[] againstVoteds; // Array of addresses voting against\n uint256 expiryTimestamp;\n mapping(address => Signature) sig;\n mapping(address => bool) voted;\n }\n\n /// @dev Emitted when a proposal is created\n event ProposalCreated(\n uint256 indexed chainId,\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n address creator\n );\n /// @dev Emitted when the proposal is voted\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\n /// @dev Emitted when the proposal is approved\n event ProposalApproved(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is reject\n event ProposalRejected(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is expired\n event ProposalExpired(bytes32 indexed proposalHash);\n /// @dev Emitted when the proposal is executed\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\n /// @dev Emitted when the proposal expiry duration is changed.\n event ProposalExpiryDurationChanged(uint256 indexed duration);\n\n /// @dev Mapping from chain id => vote round\n /// @notice chain id = 0 for global proposal\n mapping(uint256 => uint256) public round;\n /// @dev Mapping from chain id => vote round => proposal vote\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\n\n uint256 internal _proposalExpiryDuration;\n\n constructor(uint256 _expiryDuration) {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\n * if it is expired and not increase the `_round`.\n */\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\n _round = round[_chainId];\n // Skip checking for the first ever round\n if (_round == 0) {\n _round = round[_chainId] = 1;\n } else {\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\n if (!_isExpired) {\n if (_latestProposalVote.status == VoteStatus.Pending) revert ErrCurrentProposalIsNotCompleted();\n unchecked {\n _round = ++round[_chainId];\n }\n }\n }\n }\n\n /**\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\n */\n function _saveVotingRound(ProposalVote storage _vote, bytes32 _proposalHash, uint256 _expiryTimestamp) internal {\n _vote.hash = _proposalHash;\n _vote.expiryTimestamp = _expiryTimestamp;\n }\n\n /**\n * @dev Proposes for a new proposal.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposal(\n uint256 chainId,\n uint256 expiryTimestamp,\n address[] memory targets,\n uint256[] memory values,\n bytes[] memory calldatas,\n uint256[] memory gasAmounts,\n address creator\n ) internal virtual returns (Proposal.ProposalDetail memory proposal) {\n if (chainId == 0) revert ErrInvalidChainId(msg.sig, 0, block.chainid);\n uint256 round_ = _createVotingRound(chainId);\n\n proposal = Proposal.ProposalDetail(round_, chainId, expiryTimestamp, targets, values, calldatas, gasAmounts);\n proposal.validate(_proposalExpiryDuration);\n\n bytes32 proposalHash = proposal.hash();\n _saveVotingRound(vote[chainId][round_], proposalHash, expiryTimestamp);\n emit ProposalCreated(chainId, round_, proposalHash, proposal, creator);\n }\n\n /**\n * @dev Proposes proposal struct.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposalStruct(\n Proposal.ProposalDetail memory proposal,\n address creator\n ) internal virtual returns (uint256 round_) {\n uint256 chainId = proposal.chainId;\n if (chainId == 0) revert ErrInvalidChainId(msg.sig, 0, block.chainid);\n proposal.validate(_proposalExpiryDuration);\n\n bytes32 proposalHash = proposal.hash();\n round_ = _createVotingRound(chainId);\n _saveVotingRound(vote[chainId][round_], proposalHash, proposal.expiryTimestamp);\n if (round_ != proposal.nonce) revert ErrInvalidProposalNonce(msg.sig);\n emit ProposalCreated(chainId, round_, proposalHash, proposal, creator);\n }\n\n /**\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\n *\n * Requirements:\n * - The proposal nonce is equal to the round.\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\n * proposal is approved, executed or rejected.\n *\n */\n function _castVote(\n Proposal.ProposalDetail memory proposal,\n Ballot.VoteType support,\n uint256 minimumForVoteWeight,\n uint256 minimumAgainstVoteWeight,\n address voter,\n Signature memory signature,\n uint256 voterWeight\n ) internal virtual returns (bool done) {\n uint256 chainId = proposal.chainId;\n uint256 round_ = proposal.nonce;\n ProposalVote storage _vote = vote[chainId][round_];\n\n if (_tryDeleteExpiredVotingRound(_vote)) {\n return true;\n }\n\n if (round[proposal.chainId] != round_) revert ErrInvalidProposalNonce(msg.sig);\n if (_vote.status != VoteStatus.Pending) revert ErrVoteIsFinalized();\n if (_voted(_vote, voter)) revert ErrAlreadyVoted(voter);\n\n _vote.voted[voter] = true;\n // Stores the signature if it is not empty\n if (signature.r > 0 || signature.s > 0 || signature.v > 0) {\n _vote.sig[voter] = signature;\n }\n emit ProposalVoted(_vote.hash, voter, support, voterWeight);\n\n uint256 _forVoteWeight;\n uint256 _againstVoteWeight;\n if (support == Ballot.VoteType.For) {\n _vote.forVoteds.push(voter);\n _forVoteWeight = _vote.forVoteWeight += voterWeight;\n } else if (support == Ballot.VoteType.Against) {\n _vote.againstVoteds.push(voter);\n _againstVoteWeight = _vote.againstVoteWeight += voterWeight;\n } else revert ErrUnsupportedVoteType(msg.sig);\n\n if (_forVoteWeight >= minimumForVoteWeight) {\n done = true;\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, proposal);\n } else if (_againstVoteWeight >= minimumAgainstVoteWeight) {\n done = true;\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n }\n }\n\n /**\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\n *\n * Emits the event `ProposalExpired` if the vote is expired.\n *\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\n * before or it will emit an unexpected event of `ProposalExpired`.\n */\n function _tryDeleteExpiredVotingRound(ProposalVote storage proposalVote) internal returns (bool isExpired) {\n isExpired =\n _getChainType() == ChainType.RoninChain &&\n proposalVote.status == VoteStatus.Pending &&\n proposalVote.expiryTimestamp <= block.timestamp;\n\n if (isExpired) {\n emit ProposalExpired(proposalVote.hash);\n\n for (uint256 _i; _i < proposalVote.forVoteds.length; ) {\n delete proposalVote.voted[proposalVote.forVoteds[_i]];\n delete proposalVote.sig[proposalVote.forVoteds[_i]];\n\n unchecked {\n ++_i;\n }\n }\n for (uint256 _i; _i < proposalVote.againstVoteds.length; ) {\n delete proposalVote.voted[proposalVote.againstVoteds[_i]];\n delete proposalVote.sig[proposalVote.againstVoteds[_i]];\n\n unchecked {\n ++_i;\n }\n }\n delete proposalVote.status;\n delete proposalVote.hash;\n delete proposalVote.againstVoteWeight;\n delete proposalVote.forVoteWeight;\n delete proposalVote.forVoteds;\n delete proposalVote.againstVoteds;\n delete proposalVote.expiryTimestamp;\n }\n }\n\n /**\n * @dev Executes the proposal and update the vote status once the proposal is executable.\n */\n function _tryExecute(ProposalVote storage vote_, Proposal.ProposalDetail memory proposal) internal {\n if (proposal.executable()) {\n vote_.status = VoteStatus.Executed;\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = proposal.execute();\n emit ProposalExecuted(vote_.hash, _successCalls, _returnDatas);\n }\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n */\n function _setProposalExpiryDuration(uint256 expiryDuration) internal {\n _proposalExpiryDuration = expiryDuration;\n emit ProposalExpiryDurationChanged(expiryDuration);\n }\n\n /**\n * @dev Returns the expiry duration for a new proposal.\n */\n function _getProposalExpiryDuration() internal view returns (uint256) {\n return _proposalExpiryDuration;\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function _voted(ProposalVote storage vote_, address voter) internal view returns (bool) {\n return vote_.voted[voter];\n }\n\n /**\n * @dev Returns total weight from validators.\n */\n function _getTotalWeight() internal view virtual returns (uint256);\n\n /**\n * @dev Returns minimum vote to pass a proposal.\n */\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\n\n /**\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\n */\n function _getChainType() internal view virtual returns (ChainType);\n}\n" + }, + "contracts/extensions/sequential-governance/governance-proposal/CommonGovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../CoreGovernance.sol\";\n\nabstract contract CommonGovernanceProposal is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n\n /**\n * @dev Error thrown when an invalid proposal is encountered.\n * @param actual The actual value of the proposal.\n * @param expected The expected value of the proposal.\n */\n error ErrInvalidProposal(bytes32 actual, bytes32 expected);\n\n /**\n * @dev Casts votes by signatures.\n *\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\n *\n */\n function _castVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n if (!(_supports.length != 0 && _supports.length == _signatures.length)) revert ErrLengthMismatch(msg.sig);\n\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeight() - _minimumForVoteWeight + 1;\n\n address _lastSigner;\n address _signer;\n Signature calldata _sig;\n bool _hasValidVotes;\n for (uint256 _i; _i < _signatures.length; ) {\n _sig = _signatures[_i];\n\n if (_supports[_i] == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n } else if (_supports[_i] == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n } else revert ErrUnsupportedVoteType(msg.sig);\n\n if (_lastSigner >= _signer) revert ErrInvalidOrder(msg.sig);\n _lastSigner = _signer;\n\n uint256 _weight = _getWeight(_signer);\n if (_weight > 0) {\n _hasValidVotes = true;\n if (\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\n ) {\n return;\n }\n }\n\n unchecked {\n ++_i;\n }\n }\n\n if (!_hasValidVotes) revert ErrInvalidSignatures(msg.sig);\n }\n\n /**\n * @dev Returns the voted signatures for the proposals.\n *\n * Note: The signatures can be empty in case the proposal is voted on the current network.\n *\n */\n function _getProposalSignatures(\n uint256 _chainId,\n uint256 _round\n )\n internal\n view\n returns (address[] memory _voters, Ballot.VoteType[] memory _supports, Signature[] memory _signatures)\n {\n ProposalVote storage _vote = vote[_chainId][_round];\n\n uint256 _forLength = _vote.forVoteds.length;\n uint256 _againstLength = _vote.againstVoteds.length;\n uint256 _voterLength = _forLength + _againstLength;\n\n _supports = new Ballot.VoteType[](_voterLength);\n _signatures = new Signature[](_voterLength);\n _voters = new address[](_voterLength);\n for (uint256 _i; _i < _forLength; ) {\n _supports[_i] = Ballot.VoteType.For;\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\n _voters[_i] = _vote.forVoteds[_i];\n\n unchecked {\n ++_i;\n }\n }\n for (uint256 _i; _i < _againstLength; ) {\n _supports[_i + _forLength] = Ballot.VoteType.Against;\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function _proposalVoted(uint256 _chainId, uint256 _round, address _voter) internal view returns (bool) {\n return _voted(vote[_chainId][_round], _voter);\n }\n\n /**\n * @dev Returns the weight of a governor.\n */\n function _getWeight(address _governor) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/sequential-governance/governance-proposal/GovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../CoreGovernance.sol\";\nimport \"./CommonGovernanceProposal.sol\";\n\nabstract contract GovernanceProposal is CoreGovernance, CommonGovernanceProposal {\n using Proposal for Proposal.ProposalDetail;\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator\n ) internal {\n bytes32 _proposalHash = _proposal.hash();\n\n if (vote[_proposal.chainId][_proposal.nonce].hash != _proposalHash) {\n revert ErrInvalidProposal(_proposalHash, vote[_proposal.chainId][_proposal.nonce].hash);\n }\n\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev See `castProposalVoteForCurrentNetwork`.\n */\n function _castProposalVoteForCurrentNetwork(\n address _voter,\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support\n ) internal {\n if (_proposal.chainId != block.chainid) revert ErrInvalidChainId(msg.sig, _proposal.chainId, block.chainid);\n\n bytes32 proposalHash = _proposal.hash();\n if (vote[_proposal.chainId][_proposal.nonce].hash != proposalHash)\n revert ErrInvalidProposal(proposalHash, vote[_proposal.chainId][_proposal.nonce].hash);\n\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeight() - _minimumForVoteWeight + 1;\n Signature memory _emptySignature;\n _castVote(\n _proposal,\n _support,\n _minimumForVoteWeight,\n _minimumAgainstVoteWeight,\n _voter,\n _emptySignature,\n _getWeight(_voter)\n );\n }\n\n /**\n * @dev See {CommonGovernanceProposal-_getProposalSignatures}\n */\n function getProposalSignatures(\n uint256 _chainId,\n uint256 _round\n )\n external\n view\n returns (address[] memory _voters, Ballot.VoteType[] memory _supports, Signature[] memory _signatures)\n {\n return _getProposalSignatures(_chainId, _round);\n }\n\n /**\n * @dev See {CommonGovernanceProposal-_proposalVoted}\n */\n function proposalVoted(uint256 _chainId, uint256 _round, address _voter) external view returns (bool) {\n return _proposalVoted(_chainId, _round, _voter);\n }\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/interfaces/bridge/events/IBridgeManagerEvents.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeManagerEvents {\n /**\n * @dev The structure representing information about a bridge operator.\n * @param addr The address of the bridge operator.\n * @param voteWeight The vote weight assigned to the bridge operator.\n */\n struct BridgeOperatorInfo {\n address addr;\n uint96 voteWeight;\n }\n\n /**\n * @dev Emitted when new bridge operators are added.\n * @param statuses The array of boolean values represents whether the corresponding bridge operator is added successfully.\n * @param voteWeights The array of vote weights assigned to the added bridge operators.\n * @param governors The array of addresses representing the governors associated with the added bridge operators.\n * @param bridgeOperators The array of addresses representing the added bridge operators.\n */\n event BridgeOperatorsAdded(bool[] statuses, uint96[] voteWeights, address[] governors, address[] bridgeOperators);\n\n /**\n * @dev Emitted when bridge operators are removed.\n * @param statuses The array of boolean values representing the statuses of the removed bridge operators.\n * @param bridgeOperators The array of addresses representing the removed bridge operators.\n */\n event BridgeOperatorsRemoved(bool[] statuses, address[] bridgeOperators);\n\n /**\n * @dev Emitted when a bridge operator is updated.\n * @param governor The address of the governor initiating the update.\n * @param fromBridgeOperator The address of the bridge operator being updated.\n * @param toBridgeOperator The updated address of the bridge operator.\n */\n event BridgeOperatorUpdated(\n address indexed governor,\n address indexed fromBridgeOperator,\n address indexed toBridgeOperator\n );\n}\n" + }, + "contracts/interfaces/bridge/events/IBridgeRewardEvents.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeRewardEvents {\n /**\n * @dev Reward-related information for a bridge operator.\n * @param claimed The amount of rewards claimed by the bridge operator.\n * @param slashed The amount of rewards that have been slashed from the bridge operator.\n */\n struct BridgeRewardInfo {\n uint256 claimed;\n uint256 slashed;\n }\n\n /**\n * @dev Emitted when RON are safely received as rewards in the contract.\n * @param from The address of the sender who transferred RON tokens as rewards.\n * @param balanceBefore The balance of the contract before receiving the RON tokens.\n * @param amount The amount of RON received.\n */\n event SafeReceived(address indexed from, uint256 balanceBefore, uint256 amount);\n /// @dev Event emitted when the reward per period config is updated.\n event UpdatedRewardPerPeriod(uint256 newRewardPerPeriod);\n /// @dev Event emitted when the reward of the `operator` is scattered with `amount`.\n event BridgeRewardScattered(uint256 indexed period, address operator, uint256 amount);\n /// @dev Event emitted when the reward of the `operator` is slashed with `amount`.\n event BridgeRewardSlashed(uint256 indexed period, address operator, uint256 amount);\n /// @dev Event emitted when the reward of the `operator` is scattered with `amount` but failed to transfer.\n event BridgeRewardScatterFailed(uint256 indexed period, address operator, uint256 amount);\n /// @dev Event emitted when the requesting period to sync is too far.\n event BridgeRewardSyncTooFarPeriod(uint256 requestingPeriod, uint256 latestPeriod);\n}\n" + }, + "contracts/interfaces/bridge/events/IBridgeSlashEvents.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeSlashEvents {\n /**\n * @dev Enumeration representing the slashing tiers for bridge operators.\n */\n enum Tier {\n Tier0,\n Tier1,\n Tier2\n }\n\n /**\n * @dev Struct representing the status of a bridge operator.\n */\n struct BridgeSlashInfo {\n uint128 slashUntilPeriod;\n uint128 newlyAddedAtPeriod;\n }\n\n /**\n * @dev Event emitted when a bridge operator is slashed.\n * @param tier The slash tier of the operator.\n * @param bridgeOperator The address of the slashed bridge operator.\n * @param period The period in which the operator is slashed.\n * @param slashUntilPeriod The period until which the operator is penalized.\n */\n event Slashed(Tier indexed tier, address indexed bridgeOperator, uint256 indexed period, uint256 slashUntilPeriod);\n\n /**\n * @dev Emitted when a removal request is made for a bridge operator.\n * @param period The period for which the removal request is made.\n * @param bridgeOperator The address of the bridge operator being requested for removal.\n */\n event RemovalRequested(uint256 indexed period, address indexed bridgeOperator);\n}\n" + }, + "contracts/interfaces/bridge/IBridgeManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IBridgeManagerEvents } from \"./events/IBridgeManagerEvents.sol\";\n\n/**\n * @title IBridgeManager\n * @dev The interface for managing bridge operators.\n */\ninterface IBridgeManager is IBridgeManagerEvents {\n /**\n * @dev The domain separator used for computing hash digests in the contract.\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @dev Returns the total number of bridge operators.\n * @return The total number of bridge operators.\n */\n function totalBridgeOperator() external view returns (uint256);\n\n /**\n * @dev Checks if the given address is a bridge operator.\n * @param addr The address to check.\n * @return A boolean indicating whether the address is a bridge operator.\n */\n function isBridgeOperator(address addr) external view returns (bool);\n\n /**\n * @dev Retrieves the full information of all registered bridge operators.\n *\n * This external function allows external callers to obtain the full information of all the registered bridge operators.\n * The returned arrays include the addresses of governors, bridge operators, and their corresponding vote weights.\n *\n * @return governors An array of addresses representing the governors of each bridge operator.\n * @return bridgeOperators An array of addresses representing the registered bridge operators.\n * @return weights An array of uint256 values representing the vote weights of each bridge operator.\n *\n * Note: The length of each array will be the same, and the order of elements corresponds to the same bridge operator.\n *\n * Example Usage:\n * ```\n * (address[] memory governors, address[] memory bridgeOperators, uint256[] memory weights) = getFullBridgeOperatorInfos();\n * for (uint256 i = 0; i < bridgeOperators.length; i++) {\n * // Access individual information for each bridge operator.\n * address governor = governors[i];\n * address bridgeOperator = bridgeOperators[i];\n * uint256 weight = weights[i];\n * // ... (Process or use the information as required) ...\n * }\n * ```\n *\n */\n function getFullBridgeOperatorInfos()\n external\n view\n returns (address[] memory governors, address[] memory bridgeOperators, uint96[] memory weights);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorsWeight(address[] calldata governors) external view returns (uint256 sum);\n\n /**\n * @dev Returns total weights.\n */\n function getTotalWeight() external view returns (uint256);\n\n /**\n * @dev Returns an array of all bridge operators.\n * @return An array containing the addresses of all bridge operators.\n */\n function getBridgeOperators() external view returns (address[] memory);\n\n /**\n * @dev Returns an array of bridge operators correspoding to governor addresses.\n * @return bridgeOperators_ An array containing the addresses of all bridge operators.\n */\n function getBridgeOperatorOf(address[] calldata gorvernors) external view returns (address[] memory bridgeOperators_);\n\n /**\n * @dev Retrieves the governors corresponding to a given array of bridge operators.\n * This external function allows external callers to obtain the governors associated with a given array of bridge operators.\n * The function takes an input array `bridgeOperators` containing bridge operator addresses and returns an array of corresponding governors.\n * @param bridgeOperators An array of bridge operator addresses for which governors are to be retrieved.\n * @return governors An array of addresses representing the governors corresponding to the provided bridge operators.\n */\n function getGovernorsOf(address[] calldata bridgeOperators) external view returns (address[] memory governors);\n\n /**\n * @dev External function to retrieve the vote weight of a specific governor.\n * @param governor The address of the governor to get the vote weight for.\n * @return voteWeight The vote weight of the specified governor.\n */\n function getGovernorWeight(address governor) external view returns (uint96);\n\n /**\n * @dev External function to retrieve the vote weight of a specific bridge operator.\n * @param bridgeOperator The address of the bridge operator to get the vote weight for.\n * @return weight The vote weight of the specified bridge operator.\n */\n function getBridgeOperatorWeight(address bridgeOperator) external view returns (uint96 weight);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata governors) external view returns (uint96[] memory weights);\n\n /**\n * @dev Returns an array of all governors.\n * @return An array containing the addresses of all governors.\n */\n function getGovernors() external view returns (address[] memory);\n\n /**\n * @dev Adds multiple bridge operators.\n * @param governors An array of addresses of hot/cold wallets for bridge operator to update their node address.\n * @param bridgeOperators An array of addresses representing the bridge operators to add.\n * @return addeds An array of booleans indicating whether each bridge operator was added successfully.\n *\n * Note: return boolean array `addeds` indicates whether a group (voteWeight, governor, operator) are recorded.\n * It is expected that FE/BE staticcall to the function first to get the return values and handle it correctly.\n * Governors are expected to see the outcome of this function and decide if they want to vote for the proposal or not.\n *\n * Example Usage:\n * Making an `eth_call` in ethers.js\n * ```\n * const {addeds} = await bridgeManagerContract.callStatic.addBridgeOperators(\n * voteWeights,\n * governors,\n * bridgeOperators,\n * // overriding the caller to the contract itself since we use `onlySelfCall` guard\n * {from: bridgeManagerContract.address}\n * )\n * const filteredOperators = bridgeOperators.filter((_, index) => addeds[index]);\n * const filteredWeights = weights.filter((_, index) => addeds[index]);\n * const filteredGovernors = governors.filter((_, index) => addeds[index]);\n * // ... (Process or use the information as required) ...\n * ```\n */\n function addBridgeOperators(\n uint96[] calldata voteWeights,\n address[] calldata governors,\n address[] calldata bridgeOperators\n ) external returns (bool[] memory addeds);\n\n /**\n * @dev Removes multiple bridge operators.\n * @param bridgeOperators An array of addresses representing the bridge operators to remove.\n * @return removeds An array of booleans indicating whether each bridge operator was removed successfully.\n *\n * * Note: return boolean array `removeds` indicates whether a group (voteWeight, governor, operator) are recorded.\n * It is expected that FE/BE staticcall to the function first to get the return values and handle it correctly.\n * Governors are expected to see the outcome of this function and decide if they want to vote for the proposal or not.\n *\n * Example Usage:\n * Making an `eth_call` in ethers.js\n * ```\n * const {removeds} = await bridgeManagerContract.callStatic.removeBridgeOperators(\n * bridgeOperators,\n * // overriding the caller to the contract itself since we use `onlySelfCall` guard\n * {from: bridgeManagerContract.address}\n * )\n * const filteredOperators = bridgeOperators.filter((_, index) => removeds[index]);\n * // ... (Process or use the information as required) ...\n * ```\n */\n function removeBridgeOperators(address[] calldata bridgeOperators) external returns (bool[] memory removeds);\n\n /**\n * @dev Governor updates their corresponding governor and/or operator address.\n * Requirements:\n * - The caller must the governor of the operator that is requested changes.\n * @param bridgeOperator The address of the bridge operator to update.\n */\n function updateBridgeOperator(address bridgeOperator) external;\n}\n" + }, + "contracts/interfaces/bridge/IBridgeManagerCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title IBridgeManagerCallback\n * @dev Interface for the callback functions to be implemented by the Bridge Manager contract.\n */\ninterface IBridgeManagerCallback is IERC165 {\n /**\n * @dev Handles the event when bridge operators are added.\n * @param bridgeOperators The addresses of the bridge operators.\n * @param addeds The corresponding boolean values indicating whether the operators were added or not.\n * @return selector The selector of the function being called.\n */\n function onBridgeOperatorsAdded(\n address[] memory bridgeOperators,\n bool[] memory addeds\n ) external returns (bytes4 selector);\n\n /**\n * @dev Handles the event when bridge operators are removed.\n * @param bridgeOperators The addresses of the bridge operators.\n * @param removeds The corresponding boolean values indicating whether the operators were removed or not.\n * @return selector The selector of the function being called.\n */\n function onBridgeOperatorsRemoved(\n address[] memory bridgeOperators,\n bool[] memory removeds\n ) external returns (bytes4 selector);\n\n /**\n * @dev Handles the event when a bridge operator is updated.\n * @param currentBridgeOperator The address of the current bridge operator.\n * @param newbridgeOperator The new address of the bridge operator.\n * @return selector The selector of the function being called.\n */\n function onBridgeOperatorUpdated(\n address currentBridgeOperator,\n address newbridgeOperator\n ) external returns (bytes4 selector);\n}\n" + }, + "contracts/interfaces/bridge/IBridgeReward.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { IBridgeRewardEvents } from \"./events/IBridgeRewardEvents.sol\";\n\ninterface IBridgeReward is IBridgeRewardEvents {\n /**\n * @dev This function allows bridge operators to manually synchronize the reward for a given period length.\n * @param periodLength The length of the reward period for which synchronization is requested.\n */\n function syncReward(uint256 periodLength) external;\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Invoke calculate and transfer reward to operators based on their performance.\n *\n * Requirements:\n * - This method is only called once each period.\n * - The caller must be the bridge tracking contract or a bridge operator.\n */\n function execSyncReward(\n address[] calldata operators,\n uint256[] calldata ballots,\n uint256 totalBallot,\n uint256 totalVote,\n uint256 period\n ) external;\n\n /**\n * @dev Retrieve the total amount of rewards that have been topped up in the contract.\n * @return totalRewardToppedUp The total rewards topped up value.\n */\n function getTotalRewardToppedUp() external view returns (uint256);\n\n /**\n * @dev Retrieve the total amount of rewards that have been scattered to bridge operators in the contract.\n * @return totalRewardScattered The total rewards scattered value.\n */\n function getTotalRewardScattered() external view returns (uint256);\n\n /**\n * @dev Getter for all bridge operators per period.\n */\n function getRewardPerPeriod() external view returns (uint256);\n\n /**\n * @dev External function to retrieve the latest rewarded period in the contract.\n * @return latestRewardedPeriod The latest rewarded period value.\n */\n function getLatestRewardedPeriod() external view returns (uint256);\n\n /**\n * @dev Setter for all bridge operators per period.\n */\n function setRewardPerPeriod(uint256 rewardPerPeriod) external;\n}\n" + }, + "contracts/interfaces/bridge/IBridgeSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IBridgeSlashEvents } from \"./events/IBridgeSlashEvents.sol\";\n\n/**\n * @title IBridgeSlash\n * @dev Interface for the BridgeSlash contract to manage slashing functionality for bridge operators.\n */\ninterface IBridgeSlash is IBridgeSlashEvents {\n /**\n * @dev Slashes the unavailability of bridge operators during a specific period.\n * @param period The period to slash the bridge operators for.\n */\n function execSlashBridgeOperators(\n address[] calldata operators,\n uint256[] calldata ballots,\n uint256 totalBallot,\n uint256 totalVote,\n uint256 period\n ) external;\n\n /**\n * @dev Returns the penalize durations for the specified bridge operators.\n * @param bridgeOperators The addresses of the bridge operators.\n * @return untilPeriods The penalized periods for the bridge operators.\n */\n function getSlashUntilPeriodOf(address[] calldata bridgeOperators) external returns (uint256[] memory untilPeriods);\n\n /**\n * @dev Retrieves the added periods of the specified bridge operators.\n * @param bridgeOperators An array of bridge operator addresses.\n * @return addedPeriods An array of uint256 values representing the added periods for each bridge operator.\n */\n function getAddedPeriodOf(address[] calldata bridgeOperators) external view returns (uint256[] memory addedPeriods);\n\n /**\n * @dev Gets the slash tier based on the given ballot and total ballots.\n * @param ballot The ballot count for a bridge operator.\n * @param totalVote The total vote count for the period.\n * @return tier The slash tier.\n */\n function getSlashTier(uint256 ballot, uint256 totalVote) external pure returns (Tier tier);\n\n /**\n * @dev Retrieve the penalty durations for different slash tiers.\n * @return penaltyDurations The array of penalty durations for each slash tier.\n */\n function getPenaltyDurations() external pure returns (uint256[] memory penaltyDurations);\n\n /**\n * @dev Returns the penalty duration for Tier 1 slashing.\n * @return The duration in period number for Tier 1 slashing.\n */\n function TIER_1_PENALTY_DURATION() external view returns (uint256);\n\n /**\n * @dev Returns the penalty duration for Tier 2 slashing.\n * @return The duration in period number for Tier 2 slashing.\n */\n function TIER_2_PENALTY_DURATION() external view returns (uint256);\n\n /**\n * @dev Returns the threshold duration for removing bridge operators.\n * @return The duration in period number that exceeds which a bridge operator will be removed.\n */\n function REMOVE_DURATION_THRESHOLD() external view returns (uint256);\n\n /**\n * @dev External function to retrieve the value of the minimum vote threshold to execute slashing rule.\n * @return minimumVoteThreshold The minimum vote threshold value.\n */\n function MINIMUM_VOTE_THRESHOLD() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/bridge/IBridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeTracking {\n struct Request {\n VoteKind kind;\n uint256 id;\n }\n\n enum VoteKind {\n Deposit,\n Withdrawal,\n MainchainWithdrawal\n }\n\n event ExternalCallFailed(address indexed to, bytes4 indexed msgSig, bytes reason);\n\n /**\n * @dev Returns the block that allow incomming mutable call.\n */\n function startedAtBlock() external view returns (uint256);\n\n /**\n * @dev Returns the total number of votes at the specific period `_period`.\n */\n function totalVote(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots at the specific period `_period`.\n */\n function totalBallot(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\n */\n function getManyTotalBallots(\n uint256 _period,\n address[] calldata _bridgeOperators\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\n */\n function totalBallotOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\n\n /**\n * @dev Handles the request once it is approved.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\n\n /**\n * @dev Records vote for a receipt and a operator.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function recordVote(VoteKind _kind, uint256 _requestId, address _operator) external;\n}\n" + }, + "contracts/interfaces/collections/IHasContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { ContractType } from \"../../utils/ContractType.sol\";\n\ninterface IHasContracts {\n /// @dev Error of invalid role.\n error ErrContractTypeNotFound(ContractType contractType);\n\n /// @dev Emitted when a contract is updated.\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\n\n /**\n * @dev Returns the address of a contract with a specific role.\n * Throws an error if no contract is set for the specified role.\n *\n * @param contractType The role of the contract to retrieve.\n * @return contract_ The address of the contract with the specified role.\n */\n function getContract(ContractType contractType) external view returns (address contract_);\n\n /**\n * @dev Sets the address of a contract with a specific role.\n * Emits the event {ContractUpdated}.\n * @param contractType The role of the contract to set.\n * @param addr The address of the contract to set.\n */\n function setContract(ContractType contractType, address addr) external;\n}\n" + }, + "contracts/interfaces/consumers/ChainTypeConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ChainTypeConsumer {\n enum ChainType {\n RoninChain,\n Mainchain\n }\n}\n" + }, + "contracts/interfaces/consumers/MappedTokenConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../libraries/Token.sol\";\n\ninterface MappedTokenConsumer {\n struct MappedToken {\n Token.Standard erc;\n address tokenAddr;\n }\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/interfaces/consumers/SignatureConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface SignatureConsumer {\n struct Signature {\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n}\n" + }, + "contracts/interfaces/consumers/VoteStatusConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface VoteStatusConsumer {\n enum VoteStatus {\n Pending,\n Approved,\n Executed,\n Rejected,\n Expired\n }\n}\n" + }, + "contracts/interfaces/IERC20Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ninterface IERC20Mintable {\n function mint(address _to, uint256 _value) external returns (bool _success);\n}\n" + }, + "contracts/interfaces/IERC721Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC721Mintable {\n function mint(address _to, uint256 _tokenId) external returns (bool);\n}\n" + }, + "contracts/interfaces/IFastFinalityTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IFastFinalityTracking {\n /**\n * @dev Submit list of `voters` who vote for fast finality in the current block.\n *\n * Requirements:\n * - Only called once per block\n * - Only coinbase can call this method\n */\n function recordFinality(address[] calldata voters) external;\n\n /**\n * @dev Returns vote count of `addrs` in the `period`.\n */\n function getManyFinalityVoteCounts(\n uint256 period,\n address[] calldata addrs\n ) external view returns (uint256[] memory voteCounts);\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../udvts/Types.sol\";\n\ninterface IMaintenance {\n /**\n * @dev Error thrown when attempting to schedule an already scheduled event.\n */\n error ErrAlreadyScheduled();\n\n /**\n * @dev Error thrown when referring to a non-existent schedule.\n */\n error ErrUnexistedSchedule();\n\n /**\n * @dev Error thrown when the end block of a schedule is out of range.\n */\n error ErrEndBlockOutOfRange();\n\n /**\n * @dev Error thrown when the start block of a schedule is out of range.\n */\n error ErrStartBlockOutOfRange();\n\n /**\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\n */\n error ErrAlreadyOnMaintenance();\n\n /**\n * @dev Error thrown when attempting an action before the cooldown period has ended.\n */\n error ErrCooldownTimeNotYetEnded();\n\n /**\n * @dev Error thrown when the total number of schedules exceeds the limit.\n */\n error ErrTotalOfSchedulesExceeded();\n\n /**\n * @dev Error thrown when an invalid maintenance duration is specified.\n */\n error ErrInvalidMaintenanceDuration();\n\n /**\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\n */\n error ErrInvalidMaintenanceDurationConfig();\n\n /**\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\n */\n error ErrInvalidOffsetToStartScheduleConfigs();\n\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(TConsensus indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(TConsensus indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(TConsensus consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator whose id `validatorId` maintained at the block number `_block`.\n */\n function checkMaintainedById(address validatorId, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n TConsensus consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `k` or not.\n */\n function checkManyMaintained(\n TConsensus[] calldata consensusAddrList,\n uint256 atBlock\n ) external view returns (bool[] memory);\n\n function checkManyMaintainedById(\n address[] calldata candidateIdList,\n uint256 atBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n TConsensus[] calldata _consensusAddrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n function checkManyMaintainedInBlockRangeById(\n address[] calldata idList,\n uint256 fromBlock,\n uint256 toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `consensusAddr` has finished cooldown.\n */\n function checkCooldownEnded(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `consensusAddr` has schedule.\n */\n function checkScheduled(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `consensusAddr`.\n */\n function getSchedule(TConsensus consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedule() external view returns (uint256 count);\n\n /**\n * @dev Returns the cooldown to maintain in seconds.\n */\n function cooldownSecsToMaintain() external view returns (uint256);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 minMaintenanceDurationInBlock_,\n uint256 maxMaintenanceDurationInBlock_,\n uint256 minOffsetToStartSchedule_,\n uint256 maxOffsetToStartSchedule_,\n uint256 maxSchedules_,\n uint256 cooldownSecsToMaintain_\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedule() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `startedAtBlock` to `endedAtBlock`.\n *\n * Requirements:\n * - The candidate `consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `consensusAddr`.\n * - The candidate `consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `consensusAddr`.\n *\n * Requirements:\n * - The candidate `consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `consensusAddr`.\n * - A schedule for the `consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(TConsensus consensusAddr) external;\n}\n" + }, + "contracts/interfaces/IProfile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId, TConsensus } from \"../udvts/Types.sol\";\nimport \"../utils/RoleAccess.sol\";\n\ninterface IProfile {\n struct CandidateProfile {\n /**\n * @dev Primary key of the profile, use for backward querying.\n *\n * {Staking} Contract: index of pool\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\n *\n */\n address id;\n /// @dev Consensus address.\n TConsensus consensus;\n /// @dev Pool admin address.\n address admin;\n /// @dev Treasury address.\n address payable treasury;\n /// @dev Address to voting proposal.\n address __reservedGovernor;\n /// @dev Public key for fast finality.\n bytes pubkey;\n }\n\n /// @dev Event emitted when a profile with `id` is added.\n event ProfileAdded(address indexed id);\n /// @dev Event emitted when a address in a profile is changed.\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\n /// @dev Event emitted when the pubkey of the `id` is changed.\n event PubkeyChanged(address indexed id, bytes pubkey);\n\n /// @dev Error of already existed profile.\n error ErrExistentProfile();\n /// @dev Error of non existed profile.\n error ErrNonExistentProfile();\n /// @dev Error when create a new profile whose id and consensus are not identical.\n error ErrIdAndConsensusDiffer();\n /**\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\n * and with value type of `infoType`.\n */\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\n error ErrDuplicatedPubkey(bytes pubkey);\n error ErrZeroAddress(RoleAccess infoType);\n error ErrZeroPubkey();\n\n /// @dev Getter to query full `profile` from `id` address.\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\n\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\n\n /// @dev Getter to backward query from `consensus` address to `id` address.\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\n\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\n\n /**\n * @notice Add a new profile.\n *\n * @dev Requirements:\n * - The profile must not be existent before.\n * - Only contract admin can call this method.\n */\n function addNewProfile(CandidateProfile memory profile) external;\n\n /**\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\n * applying for candidate role.\n *\n * Requirements:\n * - Only `stakingContract` can call this method.\n */\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\n\n /**\n * @notice The candidate admin changes the public key.\n *\n * @dev Requirements:\n * - The profile must be existed.\n * - Only user with candidate admin role can call this method.\n * - New public key must not be duplicated.\n */\n\n function changePubkey(address id, bytes memory pubkey) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/IRoninGatewayV3.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Transfer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\n\ninterface IRoninGatewayV3 is MappedTokenConsumer {\n /**\n * @dev Error thrown when attempting to withdraw funds that have already been migrated.\n */\n error ErrWithdrawalsMigrated();\n\n /**\n * @dev Error thrown when an invalid trusted threshold is specified.\n */\n error ErrInvalidTrustedThreshold();\n\n /**\n * @dev Error thrown when attempting to withdraw funds that have already been withdrawn on the mainchain.\n */\n error ErrWithdrawnOnMainchainAlready();\n\n /// @dev Emitted when the assets are depositted\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is requested\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the assets are withdrawn on mainchain\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal signatures is requested\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\n /// @dev Emitted when the threshold is updated\n event TrustedThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when a deposit is voted\n event DepositVoted(address indexed bridgeOperator, uint256 indexed id, uint256 indexed chainId, bytes32 receiptHash);\n\n /**\n * @dev Returns withdrawal count.\n */\n function withdrawalCount() external view returns (uint256);\n\n /**\n * @dev Returns withdrawal signatures.\n */\n function getWithdrawalSignatures(\n uint256 _withdrawalId,\n address[] calldata _validators\n ) external view returns (bytes[] memory);\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\n *\n */\n function depositFor(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\n * vote is already done before.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\n *\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\n * same time.\n *\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\n\n /**\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\n *\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\n\n /**\n * @dev Bulk requests withdrawals.\n *\n * Emits the `WithdrawalRequested` events.\n *\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\n\n /**\n * @dev Requests withdrawal signatures for a specific withdrawal.\n *\n * Emits the `WithdrawalSignaturesRequested` event.\n *\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\n\n /**\n * @dev Submits withdrawal signatures.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata chainIds,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Returns whether the deposit is casted by the voter.\n */\n function depositVoted(uint256 _chainId, uint256 _depositId, address _voter) external view returns (bool);\n\n /**\n * @dev Returns whether the mainchain withdrew is casted by the voter.\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\n\n /**\n * @dev Returns whether the withdrawal is done on mainchain.\n */\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns mainchain token address.\n * Reverts for unsupported token.\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/interfaces/IRoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../utils/CommonErrors.sol\";\n\ninterface IRoninGovernanceAdmin {\n /// @dev Emitted when an emergency exit poll is created.\n event EmergencyExitPollCreated(\n bytes32 voteHash,\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n );\n /// @dev Emitted when an emergency exit poll is approved.\n event EmergencyExitPollApproved(bytes32 voteHash);\n /// @dev Emitted when an emergency exit poll is expired.\n event EmergencyExitPollExpired(bytes32 voteHash);\n /// @dev Emitted when an emergency exit poll is voted.\n event EmergencyExitPollVoted(bytes32 indexed voteHash, address indexed voter);\n\n /**\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n */\n function createEmergencyExitPoll(\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n ) external;\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\nimport \"../udvts/Types.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n /**\n * @dev Error indicating that a query for a duplicate entry was made.\n */\n error ErrQueryForDupplicated();\n\n /**\n * @dev Error indicating that a query was made for a non-existent consensus address.\n */\n error ErrQueryForNonExistentConsensusAddress();\n\n /**\n * @dev Error indicating that a governor address has already been added.\n * @param addr The address of the governor that is already added.\n */\n error ErrGovernorAddressIsAlreadyAdded(address addr);\n\n /**\n * @dev Error indicating that a consensus address is not added.\n * @param addr The address of the consensus contract that is not added.\n */\n error ErrConsensusAddressIsNotAdded(TConsensus addr);\n\n /**\n * @dev Error indicating that a consensus address is already added.\n * @param addr The address of the consensus contract that is already added.\n */\n error ErrConsensusAddressIsAlreadyAdded(TConsensus addr);\n\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n TConsensus consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address __deprecatedBridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(TConsensus[] orgs);\n /// @dev Emitted when the consensus address of a trusted organization is changed.\n event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n *\n * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\n */\n function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeight() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeightById(address cid) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address governor) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganization() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/IStakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IStakingVesting {\n /**\n * @dev Error thrown when attempting to send a bonus that has already been sent.\n */\n error ErrBonusAlreadySent();\n\n /// @dev Emitted when the block bonus for block producer is transferred.\n event BonusTransferred(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount\n );\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\n event BonusTransferFailed(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount,\n uint256 contractBalance\n );\n /// @dev Emitted when the block bonus for block producer is updated\n event BlockProducerBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the block bonus for bridge operator is updated\n event BridgeOperatorBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the percent of fast finality reward is updated\n event FastFinalityRewardPercentageUpdated(uint256);\n\n /**\n * @dev Returns the bonus amount for the block producer at `blockNum`.\n */\n function blockProducerBlockBonus(uint256 blockNum) external view returns (uint256);\n\n /**\n * @dev Returns the bonus amount for the bridge validator at `blockNum`.\n */\n function bridgeOperatorBlockBonus(uint256 blockNum) external view returns (uint256);\n\n /**\n * @dev Returns the percentage of fast finality reward.\n */\n function fastFinalityRewardPercentage() external view returns (uint256);\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Returns the last block number that the staking vesting is sent.\n */\n function lastBlockSendingBonus() external view returns (uint256);\n\n /**\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\n *\n * Requirements:\n * - The method caller must be validator contract.\n * - The method must be called only once per block.\n *\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\n *\n * Notes:\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\n * will not be reverted, and the underlying nodes does not hang.\n *\n * @param forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\n * @param forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\n *\n * @return success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\n * @return blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\n * @return bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\n * @return fastFinalityRewardPercentage The percent of fast finality reward, returns 0 when the transfer is failed.\n *\n */\n function requestBonus(\n bool forBlockProducer,\n bool forBridgeOperator\n )\n external\n returns (\n bool success,\n uint256 blockProducerBonus,\n uint256 bridgeOperatorBonus,\n uint256 fastFinalityRewardPercentage\n );\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBlockProducerBonusPerBlock(uint256 amount) external;\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\n\n /**\n * @dev Sets the percent of fast finality reward.\n *\n * Emits the event `FastFinalityRewardPercentageUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setFastFinalityRewardPercentage(uint256 _percent) external;\n}\n" + }, + "contracts/interfaces/IWETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 _wad) external;\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3,\n FAST_FINALITY\n }\n\n /// @dev Error thrown when evidence has already been submitted.\n error ErrEvidenceAlreadySubmitted();\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICreditScore {\n /**\n * @dev Error thrown when an invalid credit score configuration is provided.\n */\n error ErrInvalidCreditScoreConfig();\n\n /**\n * @dev Error thrown when an invalid cut-off percentage configuration is provided.\n */\n error ErrInvalidCutOffPercentageConfig();\n\n /**\n * @dev Error thrown when the caller's credit score is insufficient to bail out a situation.\n */\n error ErrInsufficientCreditScoreToBailOut();\n\n /**\n * @dev Error thrown when a validator has previously bailed out.\n */\n error ErrValidatorHasBailedOutPreviously();\n\n /**\n * @dev Error thrown when the caller must be jailed in the current period.\n */\n error ErrCallerMustBeJailedInTheCurrentPeriod();\n\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(TConsensus indexed consensus, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execUpdateCreditScores(address[] calldata validatorIds, uint256 period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata validatorIds) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(TConsensus consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(TConsensus consensus) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(\n TConsensus[] calldata consensusAddrs\n ) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `consensus` has been bailed out at the `period`.\n */\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(TConsensus _validatorAddr, bytes calldata _header1, bytes calldata _header2) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashFastFinality.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashFastFinality is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash fast finality is updated. See the method `getFastFinalitySlashingConfigs`\n * for param details.\n */\n event FastFinalitySlashingConfigsUpdated(uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\n\n /**\n * @dev Slashes for fast finality.\n *\n * Requirements:\n * - Only whitelisted addresses are allowed to call.\n *\n * Emits the event `Slashed` if the fast finality evidence of the two headers valid.\n */\n function slashFastFinality(\n TConsensus consensusAddr,\n bytes calldata voterPublicKey,\n uint256 targetBlockNumber,\n bytes32[2] calldata targetBlockHash,\n bytes[][2] calldata listOfPublicKey,\n bytes[2] calldata aggregatedSignature\n ) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return slashFastFinalityAmount The amount of RON to slash fast finality.\n * @return fastFinalityJailUntilBlock The block number that the punished validator will be jailed until, due to\n * malicious fast finality.\n */\n function getFastFinalitySlashingConfigs()\n external\n view\n returns (uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `FastFinalitySlashingConfigsUpdated`.\n *\n * @param slashAmount The amount of RON to slash fast finality.\n * @param jailUntilBlock The block number that the punished validator will be jailed until, due to fast finality.\n *\n */\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\n */\n error ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\n\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(TConsensus consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `period` of a block producer.\n */\n function getUnavailabilityIndicator(TConsensus consensusAddr, uint256 period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 tier1Threshold,\n uint256 tier2Threshold,\n uint256 slashAmountForTier2Threshold,\n uint256 jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\ninterface IBaseStaking {\n struct PoolDetail {\n /**\n * @dev Address of the pool.\n * @custom non-volatile-storage Permanently set to the first consensus address of the candidate.\n */\n address pid;\n\n /**\n * @dev The address of the pool admin.\n * @custom shadowed-storage This storage slot is always kept in sync with the admin in `Profile-CandidateProfile`.\n */\n address __shadowedPoolAdmin;\n\n /// @dev Self-staking amount\n uint256 stakingAmount;\n\n /// @dev Total number of RON staking for the pool\n uint256 stakingTotal;\n\n /// @dev Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n\n /// @dev Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(TConsensus consensusAddr, address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `admin` is currently active.\n */\n function isAdminOfActivePool(address admin) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address admin) external view returns (address);\n\n /**\n * @dev Returns the staking pool details.\n */\n function getPoolDetail(\n TConsensus consensusAddr\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\n\n function getPoolDetailById(\n address poolId\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed poolId, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed poolId, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed poolId,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed poolId,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 minRange, uint256 maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address candidateAdmin,\n TConsensus consensusAddr,\n address payable treasuryAddr,\n uint256 commissionRate,\n bytes calldata pubkey\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata pools, uint256 period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(TConsensus consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `consensusAddr` for `amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(TConsensus consensusAddr, uint256 amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n TConsensus consensusAddr,\n uint256 effectiveDaysOnwards,\n uint256 commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(TConsensus consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(TConsensus consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed poolId, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed poolId, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(TConsensus consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(TConsensus consensusAddr, uint256 amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(TConsensus consensusAddrSrc, TConsensus consensusAddrDst, uint256 amount) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(\n address user,\n TConsensus[] calldata consensusAddrList\n ) external view returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(TConsensus[] calldata consensusAddrList) external returns (uint256 amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(\n TConsensus[] calldata consensusAddrList,\n TConsensus consensusAddrDst\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(TConsensus consensusAddr, address user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(\n TConsensus[] calldata consensusAddrs,\n address[] calldata userList\n ) external view returns (uint256[] memory);\n\n function getManyStakingAmountsById(\n address[] calldata poolIds,\n address[] calldata userList\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\n\n function getManyStakingTotalsById(\n address[] calldata poolIds\n ) external view returns (uint256[] memory stakingAmounts_);\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./IStakingCallback.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking, IStakingCallback {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards, uint256 period) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address poolId, uint256 amount) external returns (uint256 actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/staking/IStakingCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId } from \"../../udvts/Types.sol\";\n\ninterface IStakingCallback {\n /**\n * @dev Requirements:\n * - Only Profile contract can call this method.\n */\n function execChangeAdminAddress(address poolAddr, address newAdminAddr) external;\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n /**\n * @dev The address of the candidate admin.\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\n */\n address __shadowedAdmin;\n /**\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\n */\n TConsensus __shadowedConsensus;\n /**\n * @dev Address that receives mining reward of the validator\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\n */\n address payable __shadowedTreasury;\n /// @dev Address of the bridge operator corresponding to the candidate\n address ____deprecatedBridgeOperatorAddr;\n /**\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\n * Values in range [0; 100_00] stands for 0-100%\n */\n uint256 commissionRate;\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnward() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/ICandidateManagerCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICandidateManagerCallback {\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address candidateAdmin,\n address cid,\n address payable treasuryAddr,\n uint256 commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\n * This updates the shadow storage slot of \"shadowedAdmin\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeAdminAddress(address cid, address newAdmin) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\n * This updates the shadow storage slot of \"shadowedConsensus\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\n * This updates the shadow storage slot of \"shadowedTreasury\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the fast finality reward is distributed.\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\n event FastFinalityRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n /// @dev Error thrown when the info of releasing locked fund not exist.\n error ErrLockedFundReleaseInfoNotFound(address cid);\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\n error ErrLockedFundMightBeRecycled(address cid);\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfoV2.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../udvts/Types.sol\";\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(TConsensus) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(\n TConsensus addr\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(\n TConsensus addr,\n uint256 blockNum\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\n\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport { TConsensus } from \"../../../udvts/Types.sol\";\n\ninterface IValidatorInfoV2 {\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators() external view returns (address[] memory _validatorList);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducer() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./ICandidateManagerCallback.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManagerCallback,\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed cid,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed cid, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address cid, uint256 period) external;\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Error thrown when a duplicated element is detected in an array.\n * @param msgSig The function signature that invoke the error.\n */\n error ErrDuplicated(bytes4 msgSig);\n\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n unchecked {\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\n // Hashing two arrays and compare their hash\n assembly {\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n yes_ := eq(_thisHash, _otherHash)\n }\n }\n\n /**\n * @dev Return the concatenated array from a and b.\n */\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\n uint256 lengthA = a.length;\n uint256 lengthB = b.length;\n unchecked {\n c = new address[](lengthA + lengthB);\n }\n uint256 i;\n for (; i < lengthA; ) {\n c[i] = a[i];\n unchecked {\n ++i;\n }\n }\n for (uint256 j; j < lengthB; ) {\n c[i] = b[j];\n unchecked {\n ++i;\n ++j;\n }\n }\n }\n}\n" + }, + "contracts/libraries/Ballot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary Ballot {\n using ECDSA for bytes32;\n\n enum VoteType {\n For,\n Against\n }\n\n // keccak256(\"Ballot(bytes32 proposalHash,uint8 support)\");\n bytes32 private constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\n\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32 digest) {\n // return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, BALLOT_TYPEHASH)\n mstore(add(ptr, 0x20), _proposalHash)\n mstore(add(ptr, 0x40), _support)\n digest := keccak256(ptr, 0x60)\n }\n }\n}\n" + }, + "contracts/libraries/EmergencyExitBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary EmergencyExitBallot {\n // keccak256(\"EmergencyExitBallot(address validatorId,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\");\n bytes32 private constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\n 0x64e34629e995f7ed2919b1f05a7ad1f274a24512f6d0d8b5b057427f7adf6518;\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n ) internal pure returns (bytes32 digest) {\n /*\n * return\n * keccak256(\n * abi.encode(\n * EMERGENCY_EXIT_BALLOT_TYPEHASH,\n * validatorId,\n * recipientAfterUnlockedFund,\n * requestedAt,\n * expiredAt\n * )\n * );\n */\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, EMERGENCY_EXIT_BALLOT_TYPEHASH)\n mstore(add(ptr, 0x20), validatorId)\n mstore(add(ptr, 0x40), recipientAfterUnlockedFund)\n mstore(add(ptr, 0x60), requestedAt)\n mstore(add(ptr, 0x80), expiredAt)\n digest := keccak256(ptr, 0xa0)\n }\n }\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n DeprecatedBridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/libraries/ErrorHandler.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { ErrProxyCallFailed } from \"../utils/CommonErrors.sol\";\n\nlibrary ErrorHandler {\n /// @notice handle low level call revert if call failed,\n /// If extcall return empty bytes, reverts with custom error.\n /// @param status Status of external call\n /// @param callSig function signature of the calldata\n /// @param returnOrRevertData bytes result from external call\n function handleRevert(bool status, bytes4 callSig, bytes memory returnOrRevertData) internal pure {\n // Get the function signature of current context\n bytes4 msgSig = msg.sig;\n assembly {\n if iszero(status) {\n // Load the length of bytes array\n let revertLength := mload(returnOrRevertData)\n // Check if length != 0 => revert following reason from external call\n if iszero(iszero(revertLength)) {\n // Start of revert data bytes. The 0x20 offset is always the same.\n revert(add(returnOrRevertData, 0x20), revertLength)\n }\n\n // Load free memory pointer\n let ptr := mload(0x40)\n // Store 4 bytes the function selector of ErrProxyCallFailed(msg.sig, callSig)\n // Equivalent to revert ErrProxyCallFailed(bytes4,bytes4)\n mstore(ptr, 0x8e3eda2b)\n // Store 4 bytes of msgSig parameter in the next slot\n mstore(add(ptr, 0x20), msgSig)\n // Store 4 bytes of callSig parameter in the next slot\n mstore(add(ptr, 0x40), callSig)\n // Revert 68 bytes of error starting from 0x1c\n revert(add(ptr, 0x1c), 0x44)\n }\n }\n }\n}\n" + }, + "contracts/libraries/GlobalProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Proposal.sol\";\n\nlibrary GlobalProposal {\n /**\n * @dev Error thrown when attempting to interact with an unsupported target.\n */\n error ErrUnsupportedTarget(bytes32 proposalHash, uint256 targetNumber);\n\n enum TargetOption {\n /* 0 */ BridgeManager,\n /* 1 */ GatewayContract,\n /* 2 */ BridgeReward,\n /* 3 */ BridgeSlash,\n /* 4 */ BridgeTracking\n }\n\n struct GlobalProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n uint256 expiryTimestamp;\n TargetOption[] targetOptions;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(GlobalProposalDetail memory self) internal pure returns (bytes32 digest_) {\n uint256[] memory values = self.values;\n TargetOption[] memory targets = self.targetOptions;\n bytes32[] memory calldataHashList = new bytes32[](self.calldatas.length);\n uint256[] memory gasAmounts = self.gasAmounts;\n\n for (uint256 i; i < calldataHashList.length; ) {\n calldataHashList[i] = keccak256(self.calldatas[i]);\n\n unchecked {\n ++i;\n }\n }\n\n /*\n * return\n * keccak256(\n * abi.encode(\n * TYPE_HASH,\n * _proposal.nonce,\n * _proposal.expiryTimestamp,\n * _targetsHash,\n * _valuesHash,\n * _calldatasHash,\n * _gasAmountsHash\n * )\n * );\n */\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, TYPE_HASH)\n mstore(add(ptr, 0x20), mload(self)) // _proposal.nonce\n mstore(add(ptr, 0x40), mload(add(self, 0x20))) // _proposal.expiryTimestamp\n\n let arrayHashed\n arrayHashed := keccak256(add(targets, 32), mul(mload(targets), 32)) // targetsHash\n mstore(add(ptr, 0x60), arrayHashed)\n arrayHashed := keccak256(add(values, 32), mul(mload(values), 32)) // _valuesHash\n mstore(add(ptr, 0x80), arrayHashed)\n arrayHashed := keccak256(add(calldataHashList, 32), mul(mload(calldataHashList), 32)) // _calldatasHash\n mstore(add(ptr, 0xa0), arrayHashed)\n arrayHashed := keccak256(add(gasAmounts, 32), mul(mload(gasAmounts), 32)) // _gasAmountsHash\n mstore(add(ptr, 0xc0), arrayHashed)\n digest_ := keccak256(ptr, 0xe0)\n }\n }\n\n /**\n * @dev Converts into the normal proposal.\n */\n function intoProposalDetail(\n GlobalProposalDetail memory self,\n address[] memory targets\n ) internal pure returns (Proposal.ProposalDetail memory detail_) {\n detail_.nonce = self.nonce;\n detail_.expiryTimestamp = self.expiryTimestamp;\n detail_.chainId = 0;\n detail_.targets = new address[](self.targetOptions.length);\n detail_.values = self.values;\n detail_.calldatas = self.calldatas;\n detail_.gasAmounts = self.gasAmounts;\n\n for (uint256 i; i < self.targetOptions.length; ) {\n detail_.targets[i] = targets[i];\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/libraries/IsolatedGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../utils/CommonErrors.sol\";\n\nlibrary IsolatedGovernance {\n struct Vote {\n VoteStatusConsumer.VoteStatus status;\n bytes32 finalHash;\n /// @dev Mapping from voter => receipt hash\n mapping(address => bytes32) voteHashOf;\n /// @dev The timestamp that voting is expired (no expiration=0)\n uint256 expiredAt;\n /// @dev The timestamp that voting is created\n uint256 createdAt;\n /// @dev The list of voters\n address[] voters;\n }\n\n /**\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\n *\n * Requirements:\n * - The voter has not voted for the round.\n *\n */\n function castVote(Vote storage _v, address _voter, bytes32 _hash) internal {\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\n }\n\n if (voted(_v, _voter)) revert ErrAlreadyVoted(_voter);\n\n _v.voteHashOf[_voter] = _hash;\n _v.voters.push(_voter);\n }\n\n /**\n * @dev Updates vote with the requirement of minimum vote weight.\n */\n function syncVoteStatus(\n Vote storage _v,\n uint256 _minimumVoteWeight,\n uint256 _votedWeightForHash,\n bytes32 _hash\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\n if (_votedWeightForHash >= _minimumVoteWeight && _v.status == VoteStatusConsumer.VoteStatus.Pending) {\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\n _v.finalHash = _hash;\n }\n\n return _v.status;\n }\n\n /**\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\n */\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\n uint256 _count;\n _voters = new address[](_v.voters.length);\n\n unchecked {\n for (uint _i; _i < _voters.length; ++_i) {\n address _voter = _v.voters[_i];\n if (_v.voteHashOf[_voter] == _hash) {\n _voters[_count++] = _voter;\n }\n }\n }\n\n assembly {\n mstore(_voters, _count)\n }\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\n return _v.voteHashOf[_voter] != bytes32(0);\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/libraries/Proposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { ErrInvalidChainId, ErrLengthMismatch } from \"../utils/CommonErrors.sol\";\n\nlibrary Proposal {\n /**\n * @dev Error thrown when there is insufficient gas to execute a function.\n */\n error ErrInsufficientGas(bytes32 proposalHash);\n\n /**\n * @dev Error thrown when an invalid expiry timestamp is provided.\n */\n error ErrInvalidExpiryTimestamp();\n\n struct ProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n // Value 0: all chain should run this proposal\n // Other values: only specifc chain has to execute\n uint256 chainId;\n uint256 expiryTimestamp;\n address[] targets;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\n\n /**\n * @dev Validates the proposal.\n */\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\n if (\n !(_proposal.targets.length > 0 &&\n _proposal.targets.length == _proposal.values.length &&\n _proposal.targets.length == _proposal.calldatas.length &&\n _proposal.targets.length == _proposal.gasAmounts.length)\n ) {\n revert ErrLengthMismatch(msg.sig);\n }\n\n if (_proposal.expiryTimestamp > block.timestamp + _maxExpiryDuration) {\n revert ErrInvalidExpiryTimestamp();\n }\n }\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32 digest_) {\n uint256[] memory _values = _proposal.values;\n address[] memory _targets = _proposal.targets;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; ) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n\n unchecked {\n ++_i;\n }\n }\n\n // return\n // keccak256(\n // abi.encode(\n // TYPE_HASH,\n // _proposal.nonce,\n // _proposal.chainId,\n // _targetsHash,\n // _valuesHash,\n // _calldatasHash,\n // _gasAmountsHash\n // )\n // );\n // /\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, TYPE_HASH)\n mstore(add(ptr, 0x20), mload(_proposal)) // _proposal.nonce\n mstore(add(ptr, 0x40), mload(add(_proposal, 0x20))) // _proposal.chainId\n mstore(add(ptr, 0x60), mload(add(_proposal, 0x40))) // expiry timestamp\n\n let arrayHashed\n arrayHashed := keccak256(add(_targets, 32), mul(mload(_targets), 32)) // targetsHash\n mstore(add(ptr, 0x80), arrayHashed)\n arrayHashed := keccak256(add(_values, 32), mul(mload(_values), 32)) // _valuesHash\n mstore(add(ptr, 0xa0), arrayHashed)\n arrayHashed := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32)) // _calldatasHash\n mstore(add(ptr, 0xc0), arrayHashed)\n arrayHashed := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32)) // _gasAmountsHash\n mstore(add(ptr, 0xe0), arrayHashed)\n digest_ := keccak256(ptr, 0x100)\n }\n }\n\n /**\n * @dev Returns whether the proposal is executable for the current chain.\n *\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\n *\n */\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\n }\n\n /**\n * @dev Executes the proposal.\n */\n function execute(\n ProposalDetail memory _proposal\n ) internal returns (bool[] memory _successCalls, bytes[] memory _returnDatas) {\n if (!executable(_proposal)) revert ErrInvalidChainId(msg.sig, _proposal.chainId, block.chainid);\n\n _successCalls = new bool[](_proposal.targets.length);\n _returnDatas = new bytes[](_proposal.targets.length);\n for (uint256 _i = 0; _i < _proposal.targets.length; ) {\n if (gasleft() <= _proposal.gasAmounts[_i]) revert ErrInsufficientGas(hash(_proposal));\n\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\n value: _proposal.values[_i],\n gas: _proposal.gasAmounts[_i]\n }(_proposal.calldatas[_i]);\n\n unchecked {\n ++_i;\n }\n }\n }\n}\n" + }, + "contracts/libraries/Token.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary Token {\n /// @dev Error indicating that the provided information is invalid.\n error ErrInvalidInfo();\n\n /// @dev Error indicating that the minting of ERC20 tokens has failed.\n error ErrERC20MintingFailed();\n\n /// @dev Error indicating that the minting of ERC721 tokens has failed.\n error ErrERC721MintingFailed();\n\n /// @dev Error indicating that an unsupported standard is encountered.\n error ErrUnsupportedStandard();\n\n /**\n * @dev Error indicating that the `transfer` has failed.\n * @param tokenInfo Info of the token including ERC standard, id or quantity.\n * @param to Receiver of the token value.\n * @param token Address of the token.\n */\n error ErrTokenCouldNotTransfer(Info tokenInfo, address to, address token);\n\n /**\n * @dev Error indicating that the `transferFrom` has failed.\n * @param tokenInfo Info of the token including ERC standard, id or quantity.\n * @param from Owner of the token value.\n * @param to Receiver of the token value.\n * @param token Address of the token.\n */\n error ErrTokenCouldNotTransferFrom(Info tokenInfo, address from, address to, address token);\n\n enum Standard {\n ERC20,\n ERC721\n }\n\n struct Info {\n Standard erc;\n // For ERC20: the id must be 0 and the quantity is larger than 0.\n // For ERC721: the quantity must be 0.\n uint256 id;\n uint256 quantity;\n }\n\n // keccak256(\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\");\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Info memory _info) internal pure returns (bytes32 digest) {\n // keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity))\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, INFO_TYPE_HASH)\n mstore(add(ptr, 0x20), mload(_info)) // _info.erc\n mstore(add(ptr, 0x40), mload(add(_info, 0x20))) // _info.id\n mstore(add(ptr, 0x60), mload(add(_info, 0x40))) // _info.quantity\n digest := keccak256(ptr, 0x80)\n }\n }\n\n /**\n * @dev Validates the token info.\n */\n function validate(Info memory _info) internal pure {\n if (\n !((_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\n (_info.erc == Standard.ERC721 && _info.quantity == 0))\n ) revert ErrInvalidInfo();\n }\n\n /**\n * @dev Transfer asset from.\n *\n * Requirements:\n * - The `_from` address must approve for the contract using this library.\n *\n */\n function transferFrom(Info memory _info, address _from, address _to, address _token) internal {\n bool _success;\n bytes memory _data;\n if (_info.erc == Standard.ERC20) {\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n } else if (_info.erc == Standard.ERC721) {\n // bytes4(keccak256(\"transferFrom(address,address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\n } else revert ErrUnsupportedStandard();\n\n if (!_success) revert ErrTokenCouldNotTransferFrom(_info, _from, _to, _token);\n }\n\n /**\n * @dev Transfers ERC721 token and returns the result.\n */\n function tryTransferERC721(address _token, address _to, uint256 _id) internal returns (bool _success) {\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\n }\n\n /**\n * @dev Transfers ERC20 token and returns the result.\n */\n function tryTransferERC20(address _token, address _to, uint256 _quantity) internal returns (bool _success) {\n bytes memory _data;\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n }\n\n /**\n * @dev Transfer assets from current address to `_to` address.\n */\n function transfer(Info memory _info, address _to, address _token) internal {\n bool _success;\n if (_info.erc == Standard.ERC20) {\n _success = tryTransferERC20(_token, _to, _info.quantity);\n } else if (_info.erc == Standard.ERC721) {\n _success = tryTransferERC721(_token, _to, _info.id);\n } else revert ErrUnsupportedStandard();\n\n if (!_success) revert ErrTokenCouldNotTransfer(_info, _to, _token);\n }\n\n /**\n * @dev Tries minting and transfering assets.\n *\n * @notice Prioritizes transfer native token if the token is wrapped.\n *\n */\n function handleAssetTransfer(\n Info memory _info,\n address payable _to,\n address _token,\n IWETH _wrappedNativeToken\n ) internal {\n bool _success;\n if (_token == address(_wrappedNativeToken)) {\n // Try sending the native token before transferring the wrapped token\n if (!_to.send(_info.quantity)) {\n _wrappedNativeToken.deposit{ value: _info.quantity }();\n transfer(_info, _to, _token);\n }\n } else if (_info.erc == Token.Standard.ERC20) {\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n\n if (_balance < _info.quantity) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\n if (!_success) revert ErrERC20MintingFailed();\n }\n\n transfer(_info, _to, _token);\n } else if (_info.erc == Token.Standard.ERC721) {\n if (!tryTransferERC721(_token, _to, _info.id)) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\n if (!_success) revert ErrERC721MintingFailed();\n }\n } else revert ErrUnsupportedStandard();\n }\n\n struct Owner {\n address addr;\n address tokenAddr;\n uint256 chainId;\n }\n\n // keccak256(\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\n\n /**\n * @dev Returns ownership struct hash.\n */\n function hash(Owner memory _owner) internal pure returns (bytes32 digest) {\n // keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId))\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, OWNER_TYPE_HASH)\n mstore(add(ptr, 0x20), mload(_owner)) // _owner.addr\n mstore(add(ptr, 0x40), mload(add(_owner, 0x20))) // _owner.tokenAddr\n mstore(add(ptr, 0x60), mload(add(_owner, 0x40))) // _owner.chainId\n digest := keccak256(ptr, 0x80)\n }\n }\n}\n" + }, + "contracts/libraries/Transfer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./Token.sol\";\n\nlibrary Transfer {\n using ECDSA for bytes32;\n\n enum Kind {\n Deposit,\n Withdrawal\n }\n\n struct Request {\n // For deposit request: Recipient address on Ronin network\n // For withdrawal request: Recipient address on mainchain network\n address recipientAddr;\n // Token address to deposit/withdraw\n // Value 0: native token\n address tokenAddr;\n Token.Info info;\n }\n\n /**\n * @dev Converts the transfer request into the deposit receipt.\n */\n function into_deposit_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _roninTokenAddr,\n uint256 _roninChainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Deposit;\n _receipt.mainchain.addr = _requester;\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\n _receipt.mainchain.chainId = block.chainid;\n _receipt.ronin.addr = _request.recipientAddr;\n _receipt.ronin.tokenAddr = _roninTokenAddr;\n _receipt.ronin.chainId = _roninChainId;\n _receipt.info = _request.info;\n }\n\n /**\n * @dev Converts the transfer request into the withdrawal receipt.\n */\n function into_withdrawal_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _mainchainTokenAddr,\n uint256 _mainchainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Withdrawal;\n _receipt.ronin.addr = _requester;\n _receipt.ronin.tokenAddr = _request.tokenAddr;\n _receipt.ronin.chainId = block.chainid;\n _receipt.mainchain.addr = _request.recipientAddr;\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\n _receipt.mainchain.chainId = _mainchainId;\n _receipt.info = _request.info;\n }\n\n struct Receipt {\n uint256 id;\n Kind kind;\n Token.Owner mainchain;\n Token.Owner ronin;\n Token.Info info;\n }\n\n // keccak256(\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Receipt memory _receipt) internal pure returns (bytes32 digest) {\n bytes32 hashedReceiptMainchain = Token.hash(_receipt.mainchain);\n bytes32 hashedReceiptRonin = Token.hash(_receipt.ronin);\n bytes32 hashedReceiptInfo = Token.hash(_receipt.info);\n\n /*\n * return\n * keccak256(\n * abi.encode(\n * TYPE_HASH,\n * _receipt.id,\n * _receipt.kind,\n * Token.hash(_receipt.mainchain),\n * Token.hash(_receipt.ronin),\n * Token.hash(_receipt.info)\n * )\n * );\n */\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, TYPE_HASH)\n mstore(add(ptr, 0x20), mload(_receipt)) // _receipt.id\n mstore(add(ptr, 0x40), mload(add(_receipt, 0x20))) // _receipt.kind\n mstore(add(ptr, 0x60), hashedReceiptMainchain)\n mstore(add(ptr, 0x80), hashedReceiptRonin)\n mstore(add(ptr, 0xa0), hashedReceiptInfo)\n digest := keccak256(ptr, 0xc0)\n }\n }\n\n /**\n * @dev Returns the receipt digest.\n */\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\n return _domainSeparator.toTypedDataHash(_receiptHash);\n }\n}\n" + }, + "contracts/mocks/libraries/Sorting.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Sorting {\n struct Node {\n uint key;\n uint value;\n }\n\n struct Node3 {\n uint key;\n uint value;\n uint otherKey;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // VALUE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(uint[] memory data) internal pure returns (uint[] memory) {\n return _quickSort(data, int(0), int(data.length - 1));\n }\n\n function _quickSort(uint[] memory arr, int left, int right) private pure returns (uint[] memory) {\n int i = left;\n int j = right;\n if (i == j) return arr;\n uint pivot = arr[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (arr[uint(i)] > pivot) i++;\n while (pivot > arr[uint(j)]) j--;\n if (i <= j) {\n (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);\n i++;\n j--;\n }\n }\n if (left < j) arr = _quickSort(arr, left, j);\n if (i < right) arr = _quickSort(arr, i, right);\n\n return arr;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(address[] memory _keys, uint256[] memory _values) internal pure returns (address[] memory) {\n require(_values.length == _keys.length, \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return _keys;\n }\n\n Node[] memory _nodes = new Node[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(uint256(uint160(_keys[_i])), _values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return _keys;\n }\n\n function sort(uint256[] memory keys, uint256[] memory values) internal pure returns (uint256[] memory) {\n require(values.length == keys.length, \"Sorting: invalid array length\");\n if (keys.length == 0) {\n return keys;\n }\n\n Node[] memory _nodes = new Node[](keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(keys[_i], values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n keys[_i] = _nodes[_i].key; // Casting?\n }\n\n return keys;\n }\n\n function sortNodes(Node[] memory nodes) internal pure returns (Node[] memory) {\n return _quickSortNodes(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNodes(Node[] memory nodes, int left, int right) private pure returns (Node[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNodes(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNodes(nodes, left, j);\n if (i < right) nodes = _quickSortNodes(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNodes(Node[] memory nodes) private pure returns (Node[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNodes(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNodes(Node memory x, Node memory y) private pure returns (Node memory, Node memory) {\n Node memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE3 SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sortWithExternalKeys(\n address[] memory _keys,\n uint256[] memory _values,\n uint256[] memory _otherKeys\n ) internal pure returns (address[] memory keys_, uint256[] memory otherKeys_) {\n require((_values.length == _keys.length) && (_otherKeys.length == _keys.length), \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return (_keys, _otherKeys);\n }\n\n Node3[] memory _nodes = new Node3[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node3(uint256(uint160(_keys[_i])), _values[_i], _otherKeys[_i]);\n }\n _quickSortNode3s(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return (_keys, _otherKeys);\n }\n\n function sortNode3s(Node3[] memory nodes) internal pure returns (Node3[] memory) {\n return _quickSortNode3s(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNode3s(Node3[] memory nodes, int left, int right) private pure returns (Node3[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node3 memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNode3s(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNode3s(nodes, left, j);\n if (i < right) nodes = _quickSortNode3s(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNode3s(Node3[] memory nodes) private pure returns (Node3[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNode3s(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNode3s(Node3 memory x, Node3 memory y) private pure returns (Node3 memory, Node3 memory) {\n Node3 memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n}\n" + }, + "contracts/mocks/MockPrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./libraries/Sorting.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract MockPrecompile {\n function sortValidators(\n address[] memory _validators,\n uint256[] memory _weights\n ) public pure returns (address[] memory) {\n return Sorting.sort(_validators, _weights);\n }\n\n function validatingDoubleSignProof(\n address /*consensusAddr*/,\n bytes calldata /*_header1*/,\n bytes calldata /*_header2*/\n ) public pure returns (bool _validEvidence) {\n return true;\n }\n\n function validateFinalityVoteProof(\n bytes calldata,\n uint256,\n bytes32[2] calldata,\n bytes[][2] calldata,\n bytes[2] calldata\n ) public pure returns (bool) {\n return true;\n }\n\n function pickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public pure returns (address[] memory _result) {\n (_result, _trustedWeights) = Sorting.sortWithExternalKeys(_candidates, _weights, _trustedWeights);\n uint256 _newValidatorCount = Math.min(_maxValidatorNumber, _result.length);\n _arrangeValidatorCandidates(_result, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n }\n\n /**\n * @dev Arranges the sorted candidates to list of validators, by asserting prioritized and non-prioritized candidates\n *\n * @param _candidates A sorted list of candidates\n */\n function _arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) internal pure {\n address[] memory _waitingCandidates = new address[](_candidates.length);\n uint _waitingCounter;\n uint _prioritySlotCounter;\n\n for (uint _i = 0; _i < _candidates.length; _i++) {\n if (_trustedWeights[_i] > 0 && _prioritySlotCounter < _maxPrioritizedValidatorNumber) {\n _candidates[_prioritySlotCounter++] = _candidates[_i];\n continue;\n }\n _waitingCandidates[_waitingCounter++] = _candidates[_i];\n }\n\n _waitingCounter = 0;\n for (uint _i = _prioritySlotCounter; _i < _newValidatorCount; _i++) {\n _candidates[_i] = _waitingCandidates[_waitingCounter++];\n }\n\n assembly {\n mstore(_candidates, _newValidatorCount)\n }\n }\n}\n" + }, + "contracts/mocks/MockSlashIndicatorExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockPrecompile.sol\";\nimport \"../ronin/slash-indicator/SlashIndicator.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\n\ncontract MockSlashIndicatorExtended is SlashIndicator, MockPrecompile {\n function slashFelony(address _validatorAddr) external {\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execSlash(_validatorAddr, 0, 0, false);\n }\n\n function slashMisdemeanor(address _validatorAddr) external {\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execSlash(_validatorAddr, 0, 0, false);\n }\n\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal pure override returns (bool _validEvidence) {\n return validatingDoubleSignProof(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/ronin/MockBridgeReward.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IBridgeReward, BridgeReward } from \"../../ronin/gateway/BridgeReward.sol\";\n\ncontract MockBridgeReward is BridgeReward {\n function calcRewardAndCheckSlashedStatus(\n bool isValidTrackingResponse,\n uint256 numBridgeOperators,\n uint256 rewardPerPeriod,\n uint256 ballot,\n uint256 totalBallot,\n uint256 period,\n uint256 slashUntilPeriod\n ) external pure returns (uint256 reward, bool isSlashed) {\n return\n _calcRewardAndCheckSlashedStatus(\n isValidTrackingResponse,\n numBridgeOperators,\n rewardPerPeriod,\n ballot,\n totalBallot,\n period,\n slashUntilPeriod\n );\n }\n\n function calcReward(\n bool isValidTrackingResponse,\n uint256 numBridgeOperators,\n uint256 rewardPerPeriod,\n uint256 ballot,\n uint256 totalBallot\n ) external pure returns (uint256 reward) {\n reward = _calcReward(isValidTrackingResponse, numBridgeOperators, rewardPerPeriod, ballot, totalBallot);\n }\n\n function isValidBridgeTrackingResponse(\n uint256 totalBallot,\n uint256 totalVote,\n uint256[] memory ballots\n ) external pure returns (bool valid) {\n return _isValidBridgeTrackingResponse(totalBallot, totalVote, ballots);\n }\n\n function shouldShareEqually(\n uint256 totalBallot,\n uint256 totalVote,\n uint256[] memory ballots\n ) external returns (bool shareEqually) {\n return _shouldShareEqually(totalBallot, totalVote, ballots);\n }\n\n function shouldSlashedThisPeriod(uint256 period, uint256 slashUntilDuration) external pure returns (bool) {\n return _shouldSlashedThisPeriod(period, slashUntilDuration);\n }\n}\n" + }, + "contracts/mocks/ronin/MockBridgeSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IBridgeSlash, BridgeSlash } from \"../../ronin/gateway/BridgeSlash.sol\";\n\ncontract MockBridgeSlash is BridgeSlash {\n function calcSlashUntilPeriod(\n Tier tier,\n uint256 period,\n uint256 slashUntilPeriod\n ) external pure returns (uint256 newSlashUntilPeriod) {\n newSlashUntilPeriod = _calcSlashUntilPeriod(tier, period, slashUntilPeriod, _getPenaltyDurations());\n }\n\n function isSlashDurationMetRemovalThreshold(uint256 slashUntilPeriod, uint256 period) external pure returns (bool) {\n return _isSlashDurationMetRemovalThreshold(slashUntilPeriod, period);\n }\n}\n" + }, + "contracts/mocks/ronin/MockRoninGatewayV3Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../ronin/gateway/RoninGatewayV3.sol\";\n\ncontract MockRoninGatewayV3Extended is RoninGatewayV3 {\n /*\n * @dev Returns the vote weight for a deposit based on its corressponding hash.\n */\n function getDepositVoteWeight(\n uint256 _chainId,\n uint256 _depositId,\n bytes32 _hash\n ) external view returns (uint256 totalWeight) {\n totalWeight = _getVoteWeight(depositVote[_chainId][_depositId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a mainchain withdrew acknowledgement based on its corressponding hash.\n */\n function getMainchainWithdrewVoteWeight(\n uint256 _withdrawalId,\n bytes32 _hash\n ) external view returns (uint256 totalWeight) {\n totalWeight = _getVoteWeight(mainchainWithdrewVote[_withdrawalId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a withdraw stats based on its corressponding hash.\n */\n function getWithdrawalStatVoteWeight(\n uint256 _withdrawalId,\n bytes32 _hash\n ) external view returns (uint256 totalWeight) {\n totalWeight = _getVoteWeight(withdrawalStatVote[_withdrawalId], _hash);\n }\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockRoninValidatorSetOverridePrecompile.sol\";\nimport \"../../libraries/EnumFlags.sol\";\n\ncontract MockRoninValidatorSetExtended is MockRoninValidatorSetOverridePrecompile {\n bool private _initialized;\n uint256[] internal _epochs;\n\n constructor() {}\n\n function initEpoch() public {\n if (!_initialized) {\n _epochs.push(0);\n _initialized = true;\n }\n }\n\n function endEpoch() external {\n _epochs.push(block.number);\n }\n\n function epochOf(uint256 _block) public view override returns (uint256 _epoch) {\n for (uint256 _i = _epochs.length; _i > 0; _i--) {\n if (_block > _epochs[_i - 1]) {\n return _i;\n }\n }\n }\n\n function epochEndingAt(uint256 _block) public view override(ITimingInfo, TimingStorage) returns (bool) {\n for (uint _i = 0; _i < _epochs.length; _i++) {\n if (_block == _epochs[_i]) {\n return true;\n }\n }\n return false;\n }\n\n function getJailUntils(address[] calldata _addrs) public view returns (uint256[] memory jailUntils_) {\n jailUntils_ = new uint256[](_addrs.length);\n for (uint _i = 0; _i < _addrs.length; _i++) {\n jailUntils_[_i] = _blockProducerJailedBlock[_addrs[_i]];\n }\n }\n\n function addValidators(address[] calldata _addrs) public {\n for (uint _i = 0; _i < _addrs.length; _i++) {\n address _cAddr = _addrs[_i];\n _validatorIds[_i] = _cAddr;\n _validatorMap[_cAddr] = EnumFlags.ValidatorFlag.Both;\n }\n }\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../MockPrecompile.sol\";\nimport \"../../ronin/validator/RoninValidatorSet.sol\";\n\ncontract MockRoninValidatorSetOverridePrecompile is RoninValidatorSet, MockPrecompile {\n constructor() {}\n\n function arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) external pure returns (address[] memory) {\n _arrangeValidatorCandidates(_candidates, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n return _candidates;\n }\n\n function _pcSortCandidates(\n address[] memory _candidates,\n uint256[] memory _weights\n ) internal pure override returns (address[] memory _result) {\n return sortValidators(_candidates, _weights);\n }\n\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal pure override returns (address[] memory _result, uint256 _newValidatorCount) {\n _result = pickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/mocks/validator/MockValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../ronin/validator/CandidateManagerCallback.sol\";\nimport { HasStakingVestingDeprecated, HasSlashIndicatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\ncontract MockValidatorSet is\n IRoninValidatorSet,\n CandidateManagerCallback,\n HasStakingVestingDeprecated,\n HasSlashIndicatorDeprecated\n{\n uint256 internal _lastUpdatedPeriod;\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n constructor(\n address _stakingContract,\n address _slashIndicatorContract,\n address _stakingVestingContract,\n address _profileContract,\n uint256 __maxValidatorCandidate,\n uint256 __numberOfBlocksInEpoch,\n uint256 __minEffectiveDaysOnwards\n ) {\n _setContract(ContractType.STAKING, _stakingContract);\n _setContract(ContractType.SLASH_INDICATOR, _slashIndicatorContract);\n _setContract(ContractType.STAKING_VESTING, _stakingVestingContract);\n _setContract(ContractType.PROFILE, _profileContract);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n _minEffectiveDaysOnwards = __minEffectiveDaysOnwards;\n }\n\n function submitBlockReward() external payable override {}\n\n function wrapUpEpoch() external payable override {\n _syncCandidateSet(_lastUpdatedPeriod + 1);\n _lastUpdatedPeriod = currentPeriod();\n }\n\n function getLastUpdatedBlock() external view override returns (uint256) {}\n\n function checkManyJailed(TConsensus[] calldata) external view override returns (bool[] memory) {}\n\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory) {}\n\n function checkMiningRewardDeprecated(TConsensus) external view override returns (bool) {}\n\n function checkMiningRewardDeprecatedAtPeriod(TConsensus, uint256 period) external view override returns (bool) {}\n\n function checkBridgeRewardDeprecatedAtPeriod(\n TConsensus _consensusAddr,\n uint256 _period\n ) external view returns (bool _result) {}\n\n function epochOf(uint256 _block) external view override returns (uint256) {}\n\n function getValidators() external view override returns (address[] memory) {}\n\n function epochEndingAt(uint256 _block) external view override returns (bool) {}\n\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external override {}\n\n function execBailOut(address, uint256) external override {}\n\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external override {}\n\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external override {}\n\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {}\n\n function maxPrioritizedValidatorNumber()\n external\n view\n override\n returns (uint256 _maximumPrioritizedValidatorNumber)\n {}\n\n function numberOfBlocksInEpoch() public view override returns (uint256) {\n return _numberOfBlocksInEpoch;\n }\n\n function getBlockProducers() external view override returns (address[] memory) {}\n\n function isBlockProducer(TConsensus) external pure override returns (bool) {\n return true;\n }\n\n function totalBlockProducer() external view override returns (uint256) {}\n\n function tryGetPeriodOfEpoch(uint256) external view returns (bool, uint256) {}\n\n function isPeriodEnding() public view virtual returns (bool) {\n return currentPeriod() > _lastUpdatedPeriod;\n }\n\n function currentPeriod() public view override returns (uint256) {\n return block.timestamp / 86400;\n }\n\n function checkJailed(TConsensus) external view override returns (bool) {}\n\n function getJailedTimeLeft(TConsensus) external view override returns (bool, uint256, uint256) {}\n\n function currentPeriodStartAtBlock() external view override returns (uint256) {}\n\n function checkJailedAtBlock(TConsensus _addr, uint256 _blockNum) external view override returns (bool) {}\n\n function getJailedTimeLeftAtBlock(\n TConsensus _addr,\n uint256 _blockNum\n ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {}\n\n function totalDeprecatedReward() external view override returns (uint256) {}\n\n function __css2cid(TConsensus consensusAddr) internal view override returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view override returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n\n function execReleaseLockedFundForEmergencyExitRequest(\n address _candidateId,\n address payable _recipient\n ) external override {}\n\n function emergencyExitLockedAmount() external override returns (uint256) {}\n\n function emergencyExpiryDuration() external override returns (uint256) {}\n\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external override {}\n\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external override {}\n\n function getEmergencyExitInfo(TConsensus consensus) external view override returns (EmergencyExitInfo memory) {}\n\n function execRequestEmergencyExit(address, uint256) external {}\n\n function isOperatingBridge(TConsensus) external view returns (bool) {}\n\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {}\n\n function _isTrustedOrg(address validatorId) internal virtual override returns (bool) {}\n}\n" + }, + "contracts/precompile-usages/PCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\n /// @dev Gets the address of the precompile of picking validator set\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\n return address(0x68);\n }\n\n /**\n * @dev Sorts and arranges to return a new validator set.\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\n address _smc = precompilePickValidatorSetAddress();\n bytes memory _payload = abi.encodeWithSignature(\n \"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\",\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n bool _success = true;\n\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/precompile-usages/PCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUSortValidators is PrecompiledUsage {\n /// @dev Gets the address of the precompile of sorting validators\n function precompileSortValidatorsAddress() public view virtual returns (address) {\n return address(0x66);\n }\n\n /**\n * @dev Sorts candidates descending by their weights by calling precompile contract.\n *\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\n */\n function _pcSortCandidates(\n address[] memory _candidates,\n uint256[] memory _weights\n ) internal view virtual returns (address[] memory _result) {\n address _smc = precompileSortValidatorsAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\"sortValidators(address[],uint256[])\", _candidates, _weights);\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\n return address(0x67);\n }\n\n /**\n * @dev Validates the two submitted block header if they are produced by the same address\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal view virtual returns (bool _validEvidence) {\n address _smc = precompileValidateDoubleSignAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\n \"validatingDoubleSignProof(address,bytes,bytes)\",\n _consensusAddr,\n _header1,\n _header2\n );\n uint _payloadLength = _payload.length;\n uint[1] memory _output;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n }\n\n if (!_success) revert ErrCallPrecompiled();\n return (_output[0] != 0);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateFastFinality.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateFastFinality is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateFastFinalityAddress() public view virtual returns (address) {\n return address(0x69);\n }\n\n /**\n * @dev Validates the proof of malicious voting on fast finality\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateFastFinalityEvidence(\n bytes memory voterPublicKey,\n uint256 targetBlockNumber,\n bytes32[2] memory targetBlockHash,\n bytes[][2] memory listOfPublicKey,\n bytes[2] memory aggregatedSignature\n ) internal view virtual returns (bool validEvidence) {\n address smc = precompileValidateFastFinalityAddress();\n bool success = true;\n\n bytes memory payload = abi.encodeWithSignature(\n \"validateFinalityVoteProof(bytes,uint256,bytes32[2],bytes[][2],bytes[2])\",\n voterPublicKey,\n targetBlockNumber,\n targetBlockHash,\n listOfPublicKey,\n aggregatedSignature\n );\n uint payloadLength = payload.length;\n uint[1] memory output;\n\n assembly {\n let payloadStart := add(payload, 0x20)\n if iszero(staticcall(gas(), smc, payloadStart, payloadLength, output, 0x20)) {\n success := 0\n }\n\n if iszero(returndatasize()) {\n success := 0\n }\n }\n\n if (!success) revert ErrCallPrecompiled();\n return (output[0] != 0);\n }\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/fast-finality/FastFinalityTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport { IRoninValidatorSet } from \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport { IFastFinalityTracking } from \"../..//interfaces/IFastFinalityTracking.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../utils/CommonErrors.sol\";\n\ncontract FastFinalityTracking is IFastFinalityTracking, Initializable, HasContracts {\n /// @dev Mapping from epoch number => consensus address => number of QC vote\n mapping(uint256 => mapping(address => uint256)) internal _tracker;\n /// @dev The latest block that tracked the QC vote\n uint256 internal _latestTrackingBlock;\n\n modifier oncePerBlock() {\n if (block.number <= _latestTrackingBlock) {\n revert ErrOncePerBlock();\n }\n\n _latestTrackingBlock = block.number;\n _;\n }\n\n modifier onlyCoinbase() {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address validatorContract) external initializer {\n _setContract(ContractType.VALIDATOR, validatorContract);\n }\n\n /**\n * @inheritdoc IFastFinalityTracking\n */\n function recordFinality(address[] calldata voters) external override oncePerBlock onlyCoinbase {\n uint256 currentEpoch = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).epochOf(block.number);\n\n for (uint i; i < voters.length; ) {\n unchecked {\n ++_tracker[currentEpoch][voters[i]];\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IFastFinalityTracking\n */\n function getManyFinalityVoteCounts(\n uint256 epoch,\n address[] calldata addrs\n ) external view override returns (uint256[] memory voteCounts) {\n uint256 length = addrs.length;\n voteCounts = new uint256[](length);\n for (uint i; i < length; ) {\n voteCounts[i] = _tracker[epoch][addrs[i]];\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeReward.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { Initializable } from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport { BridgeTrackingHelper } from \"../../extensions/bridge-operator-governance/BridgeTrackingHelper.sol\";\nimport { ContractType, HasContracts } from \"../../extensions/collections/HasContracts.sol\";\nimport { RONTransferHelper } from \"../../extensions/RONTransferHelper.sol\";\nimport { IRoninValidatorSet } from \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport { IBridgeManager } from \"../../interfaces/bridge/IBridgeManager.sol\";\nimport { IBridgeTracking } from \"../../interfaces/bridge/IBridgeTracking.sol\";\nimport { IBridgeReward } from \"../../interfaces/bridge/IBridgeReward.sol\";\nimport { IBridgeSlash } from \"../../interfaces/bridge/IBridgeSlash.sol\";\nimport { Math } from \"../../libraries/Math.sol\";\nimport { TUint256Slot } from \"../../types/Types.sol\";\nimport { ErrSyncTooFarPeriod, ErrInvalidArguments, ErrLengthMismatch, ErrUnauthorizedCall } from \"../../utils/CommonErrors.sol\";\n\ncontract BridgeReward is IBridgeReward, BridgeTrackingHelper, HasContracts, RONTransferHelper, Initializable {\n /// @dev value is equal to keccak256(\"@ronin.dpos.gateway.BridgeReward.rewardInfo.slot\") - 1\n bytes32 private constant REWARD_INFO_SLOT = 0x518cfd198acbffe95e740cfce1af28a3f7de51f0d784893d3d72c5cc59d7062a;\n /// @dev value is equal to keccak256(\"@ronin.dpos.gateway.BridgeReward.rewardPerPeriod.slot\") - 1\n TUint256Slot private constant REWARD_PER_PERIOD_SLOT =\n TUint256Slot.wrap(0x90f7d557245e5dd9485f463e58974fa7cdc93c0abbd0a1afebb8f9640ec73910);\n /// @dev value is equal to keccak256(\"@ronin.dpos.gateway.BridgeReward.latestRewardedPeriod.slot\") - 1\n TUint256Slot private constant LATEST_REWARDED_PERIOD_SLOT =\n TUint256Slot.wrap(0x2417f25874c1cdc139a787dd21df976d40d767090442b3a2496917ecfc93b619);\n /// @dev value is equal to keccak256(\"@ronin.dpos.gateway.BridgeReward.totalRewardToppedUp.slot\") - 1\n TUint256Slot private constant TOTAL_REWARDS_TOPPED_UP_SLOT =\n TUint256Slot.wrap(0x9a8c9f129792436c37b7bd2d79c56132fc05bf26cc8070794648517c2a0c6c64);\n /// @dev value is equal to keccak256(\"@ronin.dpos.gateway.BridgeReward.totalRewardScattered.slot\") - 1\n TUint256Slot private constant TOTAL_REWARDS_SCATTERED_SLOT =\n TUint256Slot.wrap(0x3663384f6436b31a97d9c9a02f64ab8b73ead575c5b6224fa0800a6bd57f62f4);\n\n address private immutable _self;\n\n constructor() payable {\n _self = address(this);\n _disableInitializers();\n }\n\n function initialize(\n address bridgeManagerContract,\n address bridgeTrackingContract,\n address bridgeSlashContract,\n address validatorSetContract,\n address dposGA,\n uint256 rewardPerPeriod\n ) external payable initializer {\n _setContract(ContractType.BRIDGE_MANAGER, bridgeManagerContract);\n _setContract(ContractType.BRIDGE_TRACKING, bridgeTrackingContract);\n _setContract(ContractType.BRIDGE_SLASH, bridgeSlashContract);\n _setContract(ContractType.VALIDATOR, validatorSetContract);\n _setContract(ContractType.GOVERNANCE_ADMIN, dposGA);\n LATEST_REWARDED_PERIOD_SLOT.store(type(uint256).max);\n _setRewardPerPeriod(rewardPerPeriod);\n _receiveRON();\n }\n\n /**\n * @dev Helper for running upgrade script, required to only revoked once by the DPoS's governance admin.\n * The following must be assured after initializing REP2: `_lastSyncPeriod` == `{BridgeReward}.latestRewardedPeriod` == `currentPeriod()`\n */\n function initializeREP2() external onlyContract(ContractType.GOVERNANCE_ADMIN) {\n require(getLatestRewardedPeriod() == type(uint256).max, \"already init rep 2\");\n LATEST_REWARDED_PERIOD_SLOT.store(IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod() - 1);\n _setContract(ContractType.GOVERNANCE_ADMIN, address(0));\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function receiveRON() external payable {\n _receiveRON();\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function syncReward(uint256 periodLength) external {\n if (!_isBridgeOperator(msg.sender)) revert ErrUnauthorizedCall(msg.sig);\n\n uint256 latestRewardedPeriod = getLatestRewardedPeriod();\n uint256 currentPeriod = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n\n if (currentPeriod <= latestRewardedPeriod) revert ErrInvalidArguments(msg.sig);\n if (latestRewardedPeriod + periodLength > currentPeriod) revert ErrInvalidArguments(msg.sig);\n\n LATEST_REWARDED_PERIOD_SLOT.addAssign(periodLength);\n\n address[] memory operators = IBridgeManager(getContract(ContractType.BRIDGE_MANAGER)).getBridgeOperators();\n IBridgeTracking bridgeTrackingContract = IBridgeTracking(getContract(ContractType.BRIDGE_TRACKING));\n\n for (uint256 i = 1; i <= periodLength; ) {\n unchecked {\n _syncReward({\n operators: operators,\n ballots: bridgeTrackingContract.getManyTotalBallots(latestRewardedPeriod, operators),\n totalBallot: bridgeTrackingContract.totalBallot(latestRewardedPeriod),\n totalVote: bridgeTrackingContract.totalVote(latestRewardedPeriod),\n period: latestRewardedPeriod += i\n });\n\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IBridgeReward\n *\n * @dev The `period` a.k.a. `latestSyncedPeriod` must equal to `latestRewardedPeriod` + 1.\n */\n function execSyncReward(\n address[] calldata operators,\n uint256[] calldata ballots,\n uint256 totalBallot,\n uint256 totalVote,\n uint256 period\n ) external onlyContract(ContractType.BRIDGE_TRACKING) {\n if (operators.length != ballots.length) revert ErrLengthMismatch(msg.sig);\n if (operators.length == 0) return;\n\n // Only sync the period that is after the latest rewarded period, i.e. `latestSyncedPeriod == latestRewardedPeriod + 1`.\n unchecked {\n uint256 latestRewardedPeriod = getLatestRewardedPeriod();\n if (period < latestRewardedPeriod + 1) revert ErrInvalidArguments(msg.sig);\n else if (period > latestRewardedPeriod + 1) revert ErrSyncTooFarPeriod(period, latestRewardedPeriod);\n }\n LATEST_REWARDED_PERIOD_SLOT.store(period);\n\n _syncReward({\n operators: operators,\n ballots: ballots,\n totalBallot: totalBallot,\n totalVote: totalVote,\n period: period\n });\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function getTotalRewardToppedUp() external view returns (uint256) {\n return TOTAL_REWARDS_TOPPED_UP_SLOT.load();\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function getTotalRewardScattered() external view returns (uint256) {\n return TOTAL_REWARDS_SCATTERED_SLOT.load();\n }\n\n /**\n * @dev Internal function to receive RON tokens as rewards and update the total topped-up rewards amount.\n */\n function _receiveRON() internal {\n // prevent transfer RON directly to logic contract\n if (address(this) == _self) revert ErrUnauthorizedCall(msg.sig);\n\n emit SafeReceived(msg.sender, TOTAL_REWARDS_TOPPED_UP_SLOT.load(), msg.value);\n TOTAL_REWARDS_TOPPED_UP_SLOT.addAssign(msg.value);\n }\n\n /**\n * @dev Internal function to synchronize and distribute rewards to bridge operators for a given period.\n * @param operators An array containing the addresses of bridge operators to receive rewards.\n * @param ballots An array containing the individual ballot counts for each bridge operator.\n * @param totalBallot The total number of available ballots for the period.\n * @param totalVote The total number of votes recorded for the period.\n * @param period The period for which the rewards are being synchronized.\n */\n function _syncReward(\n address[] memory operators,\n uint256[] memory ballots,\n uint256 totalBallot,\n uint256 totalVote,\n uint256 period\n ) internal {\n uint256 numBridgeOperators = operators.length;\n uint256 rewardPerPeriod = getRewardPerPeriod();\n uint256[] memory slashedDurationList = _getSlashInfo(operators);\n // Validate should share the reward equally\n bool shouldShareEqually = _shouldShareEqually(totalBallot, totalVote, ballots);\n\n uint256 reward;\n bool shouldSlash;\n uint256 sumRewards;\n\n for (uint256 i; i < numBridgeOperators; ) {\n (reward, shouldSlash) = _calcRewardAndCheckSlashedStatus({\n shouldShareEqually: shouldShareEqually,\n numBridgeOperators: numBridgeOperators,\n rewardPerPeriod: rewardPerPeriod,\n ballot: ballots[i],\n totalBallot: totalBallot,\n period: period,\n slashUntilPeriod: slashedDurationList[i]\n });\n\n sumRewards += shouldSlash ? 0 : reward;\n _updateRewardAndTransfer({ period: period, operator: operators[i], reward: reward, shouldSlash: shouldSlash });\n\n unchecked {\n ++i;\n }\n }\n\n TOTAL_REWARDS_SCATTERED_SLOT.addAssign(sumRewards);\n }\n\n /**\n * @dev Returns whether should share the reward equally, in case of bridge tracking returns\n * informed data or there is no ballot in a day.\n *\n * Emit a {BridgeTrackingIncorrectlyResponded} event when in case of incorrect data.\n */\n function _shouldShareEqually(\n uint256 totalBallot,\n uint256 totalVote,\n uint256[] memory ballots\n ) internal returns (bool shareEqually) {\n bool valid = _isValidBridgeTrackingResponse(totalBallot, totalVote, ballots);\n if (!valid) {\n emit BridgeTrackingIncorrectlyResponded();\n }\n\n return !valid || totalBallot == 0;\n }\n\n /**\n * @dev Internal function to calculate the reward for a bridge operator and check its slashing status.\n * @param shouldShareEqually A boolean indicating whether the reward should be shared equally among bridge operators.\n * @param numBridgeOperators The total number of bridge operators for proportional reward calculation.\n * @param rewardPerPeriod The total reward available for the period.\n * @param ballot The individual ballot count of the bridge operator for the period.\n * @param totalBallot The total number of available ballots for the period.\n * @param period The period for which the reward is being calculated.\n * @param slashUntilPeriod The period until which slashing is effective for the bridge operator.\n * @return reward The calculated reward for the bridge operator.\n * @return shouldSlash A boolean indicating whether the bridge operator should be slashed for the current period.\n */\n function _calcRewardAndCheckSlashedStatus(\n bool shouldShareEqually,\n uint256 numBridgeOperators,\n uint256 rewardPerPeriod,\n uint256 ballot,\n uint256 totalBallot,\n uint256 period,\n uint256 slashUntilPeriod\n ) internal pure returns (uint256 reward, bool shouldSlash) {\n shouldSlash = _shouldSlashedThisPeriod(period, slashUntilPeriod);\n reward = _calcReward(shouldShareEqually, numBridgeOperators, rewardPerPeriod, ballot, totalBallot);\n }\n\n /**\n * @dev Internal function to check if a specific period should be considered as slashed based on the slash duration.\n * @param period The period to check if it should be slashed.\n * @param slashDuration The duration until which periods should be considered as slashed.\n * @return shouldSlashed A boolean indicating whether the specified period should be slashed.\n * @notice This function is used internally to determine if a particular period should be marked as slashed based on the slash duration.\n */\n function _shouldSlashedThisPeriod(uint256 period, uint256 slashDuration) internal pure returns (bool) {\n return period <= slashDuration;\n }\n\n /**\n * @dev Internal function to calculate the reward for a bridge operator based on the provided parameters.\n * @param shouldShareEqually A boolean indicating whether the reward should be shared equally among bridge operators.\n * @param numBridgeOperators The total number of bridge operators for proportional reward calculation.\n * @param rewardPerPeriod The total reward available for the period.\n * @param ballot The individual ballot count of the bridge operator for the period.\n * @param totalBallot The total number of available ballots for the period.\n * @return reward The calculated reward for the bridge operator.\n */\n function _calcReward(\n bool shouldShareEqually,\n uint256 numBridgeOperators,\n uint256 rewardPerPeriod,\n uint256 ballot,\n uint256 totalBallot\n ) internal pure returns (uint256 reward) {\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\n // Else shares the bridge operators reward proportionally\n reward = shouldShareEqually ? rewardPerPeriod / numBridgeOperators : (rewardPerPeriod * ballot) / totalBallot;\n }\n\n /**\n * @dev Transfer `reward` to a `operator` or only emit event based on the operator `slashed` status.\n */\n function _updateRewardAndTransfer(uint256 period, address operator, uint256 reward, bool shouldSlash) private {\n BridgeRewardInfo storage _iRewardInfo = _getRewardInfo()[operator];\n\n if (shouldSlash) {\n _iRewardInfo.slashed += reward;\n emit BridgeRewardSlashed(period, operator, reward);\n } else {\n _iRewardInfo.claimed += reward;\n if (_unsafeSendRONLimitGas({ recipient: payable(operator), amount: reward, gas: 0 })) {\n emit BridgeRewardScattered(period, operator, reward);\n } else {\n emit BridgeRewardScatterFailed(period, operator, reward);\n }\n }\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function getRewardPerPeriod() public view returns (uint256) {\n return REWARD_PER_PERIOD_SLOT.load();\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function getLatestRewardedPeriod() public view returns (uint256) {\n return LATEST_REWARDED_PERIOD_SLOT.load();\n }\n\n /**\n * @inheritdoc IBridgeReward\n */\n function setRewardPerPeriod(uint256 rewardPerPeriod) external onlyContract(ContractType.BRIDGE_MANAGER) {\n _setRewardPerPeriod(rewardPerPeriod);\n }\n\n /**\n * @dev Internal function for setting the total reward per period.\n * Emit an {UpdatedRewardPerPeriod} event after set.\n */\n function _setRewardPerPeriod(uint256 rewardPerPeriod) internal {\n REWARD_PER_PERIOD_SLOT.store(rewardPerPeriod);\n emit UpdatedRewardPerPeriod(rewardPerPeriod);\n }\n\n /**\n * @dev Internal helper for querying slash info of a list of operators.\n */\n function _getSlashInfo(address[] memory operatorList) internal returns (uint256[] memory _slashedDuration) {\n return IBridgeSlash(getContract(ContractType.BRIDGE_SLASH)).getSlashUntilPeriodOf(operatorList);\n }\n\n /**\n * @dev Internal helper for querying whether an address is an operator.\n */\n function _isBridgeOperator(address operator) internal view returns (bool) {\n return IBridgeManager(getContract(ContractType.BRIDGE_MANAGER)).isBridgeOperator(operator);\n }\n\n /**\n * @dev Internal function to access the mapping from bridge operator => BridgeRewardInfo.\n * @return rewardInfo the mapping from bridge operator => BridgeRewardInfo.\n */\n function _getRewardInfo() internal pure returns (mapping(address => BridgeRewardInfo) storage rewardInfo) {\n assembly (\"memory-safe\") {\n rewardInfo.slot := REWARD_INFO_SLOT\n }\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { Initializable } from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport { BridgeTrackingHelper } from \"../../extensions/bridge-operator-governance/BridgeTrackingHelper.sol\";\nimport { IHasContracts, HasContracts } from \"../../extensions/collections/HasContracts.sol\";\nimport { IBridgeSlash } from \"../../interfaces/bridge/IBridgeSlash.sol\";\nimport { IERC165, IBridgeManagerCallback } from \"../../interfaces/bridge/IBridgeManagerCallback.sol\";\nimport { IBridgeTracking } from \"../../interfaces/bridge/IBridgeTracking.sol\";\nimport { IRoninValidatorSet } from \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport { Math } from \"../../libraries/Math.sol\";\nimport { ContractType } from \"../../utils/ContractType.sol\";\nimport { IdentityGuard } from \"../../utils/IdentityGuard.sol\";\nimport { ErrLengthMismatch } from \"../../utils/CommonErrors.sol\";\n\n/**\n * @title BridgeSlash\n * @dev A contract that implements slashing functionality for bridge operators based on their availability.\n */\ncontract BridgeSlash is\n IBridgeSlash,\n IBridgeManagerCallback,\n BridgeTrackingHelper,\n IdentityGuard,\n Initializable,\n HasContracts\n{\n /// @inheritdoc IBridgeSlash\n uint256 public constant TIER_1_PENALTY_DURATION = 1;\n /// @inheritdoc IBridgeSlash\n uint256 public constant TIER_2_PENALTY_DURATION = 5;\n /// @inheritdoc IBridgeSlash\n uint256 public constant MINIMUM_VOTE_THRESHOLD = 50;\n /// @inheritdoc IBridgeSlash\n uint256 public constant REMOVE_DURATION_THRESHOLD = 30;\n\n /// @dev Tier 1 slashing threshold ratio is 10%\n uint256 private constant TIER_1_THRESHOLD = 10_00;\n /// @dev Tier 2 slashing threshold ratio is 30%\n uint256 private constant TIER_2_THRESHOLD = 30_00;\n /// @dev Max percentage 100%. Values [0; 100_00] reflexes [0; 100%]\n uint256 private constant PERCENTAGE_FRACTION = 100_00;\n /// @dev This value is set to the maximum value of uint128 to indicate a permanent slash duration.\n uint256 private constant SLASH_PERMANENT_DURATION = type(uint128).max;\n /// @dev value is equal to keccak256(\"@ronin.dpos.gateway.BridgeSlash.bridgeSlashInfos.slot\") - 1\n bytes32 private constant BRIDGE_SLASH_INFOS_SLOT = 0xd08d185790a07c7b9b721e2713c8580010a57f31c72c16f6e80b831d0ee45bfe;\n\n /// @dev The period that the contract allows slashing.\n uint256 internal _startedAtPeriod;\n\n /**\n * @dev The modifier verifies if the `totalVote` is non-zero, indicating the presence of ballots for the period.\n * @param totalVote The total number of ballots for the period.\n */\n modifier onlyPeriodHasEnoughVotes(uint256 totalVote) {\n if (totalVote <= MINIMUM_VOTE_THRESHOLD) return;\n _;\n }\n\n modifier skipOnNotStarted(uint256 period) {\n if (period < _startedAtPeriod) return;\n _;\n }\n\n constructor() payable {\n _disableInitializers();\n }\n\n function initialize(\n address validatorContract,\n address bridgeManagerContract,\n address bridgeTrackingContract,\n address dposGA\n ) external initializer {\n _setContract(ContractType.VALIDATOR, validatorContract);\n _setContract(ContractType.BRIDGE_MANAGER, bridgeManagerContract);\n _setContract(ContractType.BRIDGE_TRACKING, bridgeTrackingContract);\n _setContract(ContractType.GOVERNANCE_ADMIN, dposGA);\n _startedAtPeriod = type(uint256).max;\n }\n\n /**\n * @dev Helper for running upgrade script, required to only revoked once by the DPoS's governance admin.\n */\n function initializeREP2() external onlyContract(ContractType.GOVERNANCE_ADMIN) {\n require(_startedAtPeriod == type(uint256).max, \"already init rep 2\");\n _startedAtPeriod = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod() + 1;\n _setContract(ContractType.GOVERNANCE_ADMIN, address(0));\n }\n\n /**\n * @inheritdoc IBridgeManagerCallback\n */\n function onBridgeOperatorsAdded(\n address[] calldata bridgeOperators,\n bool[] memory addeds\n ) external onlyContract(ContractType.BRIDGE_MANAGER) returns (bytes4) {\n uint256 length = bridgeOperators.length;\n if (length != addeds.length) revert ErrLengthMismatch(msg.sig);\n if (length == 0) {\n return IBridgeManagerCallback.onBridgeOperatorsAdded.selector;\n }\n\n mapping(address => BridgeSlashInfo) storage _bridgeSlashInfos = _getBridgeSlashInfos();\n uint256 currentPeriod = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n\n for (uint256 i; i < length; ) {\n unchecked {\n if (addeds[i]) {\n _bridgeSlashInfos[bridgeOperators[i]].newlyAddedAtPeriod = uint128(currentPeriod);\n }\n\n ++i;\n }\n }\n\n return IBridgeManagerCallback.onBridgeOperatorsAdded.selector;\n }\n\n /**\n * @inheritdoc IBridgeManagerCallback\n */\n function onBridgeOperatorUpdated(\n address currentBridgeOperator,\n address newBridgeOperator\n ) external onlyContract(ContractType.BRIDGE_MANAGER) returns (bytes4) {\n mapping(address => BridgeSlashInfo) storage _bridgeSlashInfos = _getBridgeSlashInfos();\n\n _bridgeSlashInfos[newBridgeOperator] = _bridgeSlashInfos[currentBridgeOperator];\n delete _bridgeSlashInfos[currentBridgeOperator];\n\n return IBridgeManagerCallback.onBridgeOperatorUpdated.selector;\n }\n\n /**\n * @inheritdoc IBridgeSlash\n */\n function execSlashBridgeOperators(\n address[] memory operators,\n uint256[] memory ballots,\n uint256 totalBallot,\n uint256 totalVote,\n uint256 period\n ) external onlyContract(ContractType.BRIDGE_TRACKING) skipOnNotStarted(period) onlyPeriodHasEnoughVotes(totalVote) {\n if (operators.length != ballots.length) revert ErrLengthMismatch(msg.sig);\n if (operators.length == 0) return;\n if (!_isValidBridgeTrackingResponse(totalBallot, totalVote, ballots)) {\n emit BridgeTrackingIncorrectlyResponded();\n return;\n }\n\n // Get penalty durations for each slash tier.\n uint256[] memory penaltyDurations = _getPenaltyDurations();\n // Get the storage mapping for bridge slash information.\n mapping(address => BridgeSlashInfo) storage _bridgeSlashInfos = _getBridgeSlashInfos();\n\n // Declare variables for iteration.\n BridgeSlashInfo memory status;\n uint256 slashUntilPeriod;\n address bridgeOperator;\n Tier tier;\n\n for (uint256 i; i < operators.length; ) {\n bridgeOperator = operators[i];\n status = _bridgeSlashInfos[bridgeOperator];\n\n // Check if the bridge operator was added before the current period.\n // Bridge operators added in current period will not be slashed.\n if (status.newlyAddedAtPeriod < period) {\n // Determine the slash tier for the bridge operator based on their ballots.\n tier = _getSlashTier(ballots[i], totalVote);\n\n slashUntilPeriod = _calcSlashUntilPeriod(tier, period, status.slashUntilPeriod, penaltyDurations);\n\n // Check if the slash duration exceeds the threshold for removal.\n if (_isSlashDurationMetRemovalThreshold(slashUntilPeriod, period)) {\n slashUntilPeriod = SLASH_PERMANENT_DURATION;\n emit RemovalRequested(period, bridgeOperator);\n }\n\n // Emit the Slashed event if the tier is not Tier 0 and bridge operator will not be removed.\n // Update the slash until period number for the bridge operator if the tier is not Tier 0.\n if (tier != Tier.Tier0) {\n if (slashUntilPeriod != SLASH_PERMANENT_DURATION) {\n emit Slashed(tier, bridgeOperator, period, slashUntilPeriod);\n }\n\n // Store updated slash until period\n _bridgeSlashInfos[bridgeOperator].slashUntilPeriod = uint128(slashUntilPeriod);\n }\n }\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IBridgeManagerCallback\n */\n function onBridgeOperatorsRemoved(\n address[] calldata,\n bool[] calldata\n ) external view onlyContract(ContractType.BRIDGE_MANAGER) returns (bytes4) {\n return IBridgeManagerCallback.onBridgeOperatorsAdded.selector;\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == type(IBridgeManagerCallback).interfaceId || interfaceId == type(IERC165).interfaceId;\n }\n\n /**\n * @inheritdoc IBridgeSlash\n */\n function getSlashUntilPeriodOf(\n address[] calldata bridgeOperators\n ) external view returns (uint256[] memory untilPeriods) {\n uint256 length = bridgeOperators.length;\n untilPeriods = new uint256[](length);\n mapping(address => BridgeSlashInfo) storage _bridgeSlashInfos = _getBridgeSlashInfos();\n\n for (uint256 i; i < length; ) {\n untilPeriods[i] = _bridgeSlashInfos[bridgeOperators[i]].slashUntilPeriod;\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IBridgeSlash\n */\n function getAddedPeriodOf(address[] calldata bridgeOperators) external view returns (uint256[] memory addedPeriods) {\n uint256 length = bridgeOperators.length;\n addedPeriods = new uint256[](length);\n mapping(address => BridgeSlashInfo) storage _bridgeSlashInfos = _getBridgeSlashInfos();\n\n for (uint256 i; i < length; ) {\n addedPeriods[i] = _bridgeSlashInfos[bridgeOperators[i]].newlyAddedAtPeriod;\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IBridgeSlash\n */\n function getPenaltyDurations() external pure returns (uint256[] memory penaltyDurations) {\n penaltyDurations = _getPenaltyDurations();\n }\n\n /**\n * @inheritdoc IBridgeSlash\n */\n function getSlashTier(uint256 ballot, uint256 totalVote) external pure returns (Tier tier) {\n tier = _getSlashTier(ballot, totalVote);\n }\n\n /**\n * @dev Checks if the slash duration exceeds the threshold for removal and handles it accordingly.\n * @param slashUntilPeriod The slash until period number.\n * @param period The current period.\n * @return met A boolean indicates that the threshold for removal is met.\n */\n function _isSlashDurationMetRemovalThreshold(\n uint256 slashUntilPeriod,\n uint256 period\n ) internal pure returns (bool met) {\n met = slashUntilPeriod - (period - 1) >= REMOVE_DURATION_THRESHOLD;\n }\n\n /**\n * @dev Calculates the slash until period based on the specified tier, current period, and slash until period.\n * @param tier The slash tier representing the severity of the slash.\n * @param period The current period in which the calculation is performed.\n * @param slashUntilPeriod The existing slash until period.\n * @param penaltyDurations An array of penalty durations for each slash tier.\n * @return newSlashUntilPeriod The newly calculated slash until period.\n */\n function _calcSlashUntilPeriod(\n Tier tier,\n uint256 period,\n uint256 slashUntilPeriod,\n uint256[] memory penaltyDurations\n ) internal pure returns (uint256 newSlashUntilPeriod) {\n // Calculate the slash until period number.\n newSlashUntilPeriod = penaltyDurations[uint8(tier)] + Math.max(period - 1, slashUntilPeriod);\n }\n\n /**\n * @dev Internal function to determine the slashing tier based on the given ballot count and total votes.\n * @param ballot The individual ballot count of a bridge operator.\n * @param totalVote The total number of votes recorded for the bridge operator.\n * @return tier The calculated slashing tier for the bridge operator.\n * @notice The `ratio` is calculated as the percentage of uncast votes (totalVote - ballot) relative to the total votes.\n */\n function _getSlashTier(uint256 ballot, uint256 totalVote) internal pure virtual returns (Tier tier) {\n uint256 ratio = ((totalVote - ballot) * PERCENTAGE_FRACTION) / totalVote;\n tier = ratio > TIER_2_THRESHOLD ? Tier.Tier2 : ratio > TIER_1_THRESHOLD ? Tier.Tier1 : Tier.Tier0;\n }\n\n /**\n * @dev Internal function to access the mapping from bridge operator => BridgeSlashInfo.\n * @return bridgeSlashInfos the mapping from bridge operator => BridgeSlashInfo.\n */\n function _getBridgeSlashInfos() internal pure returns (mapping(address => BridgeSlashInfo) storage bridgeSlashInfos) {\n assembly (\"memory-safe\") {\n bridgeSlashInfos.slot := BRIDGE_SLASH_INFOS_SLOT\n }\n }\n\n /**\n * @dev Internal function to retrieve the penalty durations for each slashing tier.\n * @return penaltyDurations An array containing the penalty durations for Tier0, Tier1, and Tier2 in that order.\n */\n function _getPenaltyDurations() internal pure virtual returns (uint256[] memory penaltyDurations) {\n // reserve index 0\n penaltyDurations = new uint256[](3);\n penaltyDurations[uint8(Tier.Tier1)] = TIER_1_PENALTY_DURATION;\n penaltyDurations[uint8(Tier.Tier2)] = TIER_2_PENALTY_DURATION;\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../interfaces/bridge/IBridgeTracking.sol\";\nimport { IBridgeManager } from \"../../interfaces/bridge/IBridgeManager.sol\";\nimport { IBridgeSlash } from \"../../interfaces/bridge/IBridgeSlash.sol\";\nimport { IBridgeReward } from \"../../interfaces/bridge/IBridgeReward.sol\";\nimport { IRoninValidatorSet } from \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport { HasBridgeDeprecated, HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\ncontract BridgeTracking is HasBridgeDeprecated, HasValidatorDeprecated, HasContracts, Initializable, IBridgeTracking {\n struct PeriodVotingMetric {\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\n uint256 totalRequest;\n uint256 totalBallot;\n mapping(address => uint256) totalBallotOf;\n address[] voters;\n }\n\n struct PeriodVotingMetricTimeWrapper {\n uint256 lastEpoch;\n Request[] requests;\n PeriodVotingMetric data;\n }\n\n struct ReceiptTrackingInfo {\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\n uint256 approvedPeriod;\n /// @dev The address list of voters\n address[] voters;\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\n mapping(address => bool) voted;\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\n uint256 trackedPeriod;\n }\n\n /// @dev The block that the contract allows incoming mutable calls.\n uint256 internal _startedAtBlock;\n\n /// @dev The temporary info of votes and ballots\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\n /// @dev Mapping from period number => vote stats based on period\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\n /// @dev Mapping from vote kind => receipt id => receipt stats\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\n /// @dev The latest period that get synced with bridge's slashing and rewarding contract\n uint256 internal _lastSyncPeriod;\n\n modifier skipOnNotStarted() {\n _skipOnNotStarted();\n _;\n }\n\n /**\n * @dev Returns the whole transaction in case the current block is less than start block.\n */\n function _skipOnNotStarted() private view {\n if (block.number < _startedAtBlock) {\n assembly {\n return(0, 0)\n }\n }\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(address bridgeContract, address validatorContract, uint256 startedAtBlock_) external initializer {\n _setContract(ContractType.BRIDGE, bridgeContract);\n _setContract(ContractType.VALIDATOR, validatorContract);\n _startedAtBlock = startedAtBlock_;\n }\n\n function initializeV2() external reinitializer(2) {\n _setContract(ContractType.BRIDGE, ______deprecatedBridge);\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\n\n delete ______deprecatedBridge;\n delete ______deprecatedValidator;\n }\n\n function initializeV3(\n address bridgeManager,\n address bridgeSlash,\n address bridgeReward,\n address dposGA\n ) external reinitializer(3) {\n _setContract(ContractType.BRIDGE_MANAGER, bridgeManager);\n _setContract(ContractType.BRIDGE_SLASH, bridgeSlash);\n _setContract(ContractType.BRIDGE_REWARD, bridgeReward);\n _setContract(ContractType.GOVERNANCE_ADMIN, dposGA);\n _lastSyncPeriod = type(uint256).max;\n }\n\n /**\n * @dev Helper for running upgrade script, required to only revoked once by the DPoS's governance admin.\n * The following must be assured after initializing REP2:\n * `_lastSyncPeriod`\n * == `{BridgeReward}.latestRewardedPeriod + 1`\n * == `{BridgeSlash}._startedAtPeriod - 1`\n * == `currentPeriod()`\n */\n function initializeREP2() external onlyContract(ContractType.GOVERNANCE_ADMIN) {\n require(_lastSyncPeriod == type(uint256).max, \"already init rep 2\");\n _lastSyncPeriod = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n _setContract(ContractType.GOVERNANCE_ADMIN, address(0));\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function startedAtBlock() external view override returns (uint256) {\n return _startedAtBlock;\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalVote(uint256 period) public view override returns (uint256 totalVote_) {\n totalVote_ = _periodMetric[period].totalRequest;\n if (_isBufferCountedForPeriod(period)) {\n totalVote_ += _bufferMetric.requests.length;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallot(uint256 period) public view override returns (uint256 totalBallot_) {\n totalBallot_ = _periodMetric[period].totalBallot;\n if (_isBufferCountedForPeriod(period)) {\n totalBallot_ += _bufferMetric.data.totalBallot;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function getManyTotalBallots(\n uint256 period,\n address[] calldata operators\n ) external view override returns (uint256[] memory _res) {\n _res = _getManyTotalBallots(period, operators);\n }\n\n function _getManyTotalBallots(\n uint256 period,\n address[] memory operators\n ) internal view returns (uint256[] memory res) {\n uint256 length = operators.length;\n res = new uint256[](length);\n bool isBufferCounted = _isBufferCountedForPeriod(period);\n for (uint i = 0; i < length; ) {\n res[i] = _totalBallotOf(period, operators[i], isBufferCounted);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallotOf(uint256 period, address bridgeOperator) public view override returns (uint256) {\n return _totalBallotOf(period, bridgeOperator, _isBufferCountedForPeriod(period));\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function handleVoteApproved(\n VoteKind kind,\n uint256 requestId\n ) external override onlyContract(ContractType.BRIDGE) skipOnNotStarted {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[kind][requestId];\n\n // Only records for the receipt which not approved\n if (_receiptInfo.approvedPeriod == 0) {\n _trySyncBuffer();\n uint256 currentPeriod = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n _receiptInfo.approvedPeriod = currentPeriod;\n\n Request storage _bufferRequest = _bufferMetric.requests.push();\n _bufferRequest.kind = kind;\n _bufferRequest.id = requestId;\n\n address[] storage _voters = _receiptInfo.voters;\n for (uint i = 0; i < _voters.length; ) {\n _increaseBallot(kind, requestId, _voters[i], currentPeriod);\n\n unchecked {\n ++i;\n }\n }\n\n delete _receiptInfo.voters;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function recordVote(\n VoteKind kind,\n uint256 requestId,\n address operator\n ) external override onlyContract(ContractType.BRIDGE) skipOnNotStarted {\n uint256 period = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n _trySyncBuffer();\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[kind][requestId];\n\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\n // The ballot metric will be increased later in the {handleVoteApproved} method.\n if (_receiptInfo.approvedPeriod == 0) {\n _receiptInfo.voters.push(operator);\n return;\n }\n\n _increaseBallot(kind, requestId, operator, period);\n\n uint256 lastSyncPeriod = _lastSyncPeriod;\n // When switching to new period, wrap up vote info, then slash and distribute reward accordingly.\n if (lastSyncPeriod < period) {\n _lastSyncPeriod = period;\n\n address[] memory allOperators = IBridgeManager(getContract(ContractType.BRIDGE_MANAGER)).getBridgeOperators();\n uint256[] memory ballots = _getManyTotalBallots(lastSyncPeriod, allOperators);\n\n uint256 totalVote_ = totalVote(lastSyncPeriod);\n uint256 totalBallot_ = totalBallot(lastSyncPeriod);\n\n address bridgeSlashContract = getContract(ContractType.BRIDGE_SLASH);\n (bool success, bytes memory returnOrRevertData) = bridgeSlashContract.call(\n abi.encodeCall(\n IBridgeSlash.execSlashBridgeOperators,\n (allOperators, ballots, totalBallot_, totalVote_, lastSyncPeriod)\n )\n );\n if (!success) {\n emit ExternalCallFailed(\n bridgeSlashContract,\n IBridgeSlash.execSlashBridgeOperators.selector,\n returnOrRevertData\n );\n }\n\n address bridgeRewardContract = getContract(ContractType.BRIDGE_REWARD);\n (success, returnOrRevertData) = bridgeRewardContract.call(\n abi.encodeCall(IBridgeReward.execSyncReward, (allOperators, ballots, totalBallot_, totalVote_, lastSyncPeriod))\n );\n if (!success) {\n emit ExternalCallFailed(bridgeRewardContract, IBridgeReward.execSyncReward.selector, returnOrRevertData);\n }\n }\n }\n\n /**\n * @dev Increases the ballot for the operator at a period.\n */\n function _increaseBallot(VoteKind kind, uint256 requestId, address operator, uint256 currentPeriod) internal {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[kind][requestId];\n if (_receiptInfo.voted[operator]) {\n return;\n }\n\n _receiptInfo.voted[operator] = true;\n\n uint256 trackedPeriod = _receiptInfo.trackedPeriod;\n\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\n // If the receipt is not tracked in a period, increase metric in buffer.\n unchecked {\n if (trackedPeriod == 0) {\n if (_bufferMetric.data.totalBallotOf[operator] == 0) {\n _bufferMetric.data.voters.push(operator);\n }\n _bufferMetric.data.totalBallot++;\n _bufferMetric.data.totalBallotOf[operator]++;\n }\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\n else if (trackedPeriod == currentPeriod) {\n PeriodVotingMetric storage _metric = _periodMetric[trackedPeriod];\n _metric.totalBallot++;\n _metric.totalBallotOf[operator]++;\n }\n }\n }\n\n /**\n * @dev See `totalBallotOf`.\n */\n function _totalBallotOf(\n uint256 period,\n address operator,\n bool mustCountLastStats\n ) internal view returns (uint256 _totalBallot) {\n _totalBallot = _periodMetric[period].totalBallotOf[operator];\n if (mustCountLastStats) {\n _totalBallot += _bufferMetric.data.totalBallotOf[operator];\n }\n }\n\n /**\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\n *\n * Requirements:\n * - The epoch after the buffer epoch is wrapped up.\n */\n function _trySyncBuffer() internal {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 currentEpoch = validatorContract.epochOf(block.number);\n if (_bufferMetric.lastEpoch < currentEpoch) {\n (, uint256 trackedPeriod) = validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\n _bufferMetric.lastEpoch = currentEpoch;\n\n // Copy numbers of totals\n PeriodVotingMetric storage _metric = _periodMetric[trackedPeriod];\n _metric.totalRequest += _bufferMetric.requests.length;\n _metric.totalBallot += _bufferMetric.data.totalBallot;\n\n // Copy voters info and voters' ballot\n for (uint i = 0; i < _bufferMetric.data.voters.length; ) {\n address voter = _bufferMetric.data.voters[i];\n _metric.totalBallotOf[voter] += _bufferMetric.data.totalBallotOf[voter];\n delete _bufferMetric.data.totalBallotOf[voter]; // need to manually delete each element, due to mapping\n\n unchecked {\n ++i;\n }\n }\n\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\n for (uint i = 0; i < _bufferMetric.requests.length; ) {\n Request storage _bufferRequest = _bufferMetric.requests[i];\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\n _receiptInfo.trackedPeriod = trackedPeriod;\n\n unchecked {\n ++i;\n }\n }\n\n delete _bufferMetric.requests;\n delete _bufferMetric.data;\n }\n }\n\n /**\n * @dev Returns whether the buffer stats must be counted or not.\n */\n function _isBufferCountedForPeriod(uint256 queriedPeriod) internal view returns (bool) {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 currentEpoch = validatorContract.epochOf(block.number);\n (bool filled, uint256 periodOfNextTemporaryEpoch) = validatorContract.tryGetPeriodOfEpoch(\n _bufferMetric.lastEpoch + 1\n );\n return filled && queriedPeriod == periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < currentEpoch;\n }\n}\n" + }, + "contracts/ronin/gateway/RoninGatewayV3.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/GatewayV3.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/MinimumWithdrawal.sol\";\nimport \"../../interfaces/IERC20Mintable.sol\";\nimport \"../../interfaces/IERC721Mintable.sol\";\nimport \"../../interfaces/bridge/IBridgeTracking.sol\";\nimport \"../../interfaces/IRoninGatewayV3.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\nimport \"../../interfaces/bridge/IBridgeManager.sol\";\n\ncontract RoninGatewayV3 is\n GatewayV3,\n Initializable,\n MinimumWithdrawal,\n AccessControlEnumerable,\n VoteStatusConsumer,\n IRoninGatewayV3,\n HasContracts\n{\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @custom:deprecated Previously `withdrawalMigrated` (non-zero value)\n bool private ___deprecated4;\n /// @dev Total withdrawal\n uint256 public withdrawalCount;\n /// @dev Mapping from chain id => deposit id => deposit vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) public depositVote;\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\n mapping(uint256 => IsolatedGovernance.Vote) public mainchainWithdrewVote;\n /// @dev Mapping from withdrawal id => withdrawal receipt\n mapping(uint256 => Transfer.Receipt) public withdrawal;\n /// @dev Mapping from withdrawal id => validator address => signatures\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\n /// @dev Mapping from token address => chain id => mainchain token address\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\n\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\n address private ____deprecated0;\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\n address private ____deprecated1;\n\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\n mapping(uint256 => IsolatedGovernance.Vote) public withdrawalStatVote;\n\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\n address private ____deprecated2;\n\n uint256 internal _trustedNum;\n uint256 internal _trustedDenom;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n modifier onlyBridgeOperator() {\n _requireBridgeOperator();\n _;\n }\n\n /**\n * @dev Reverts if the method caller is not bridge operator.\n */\n function _requireBridgeOperator() internal view {\n if (!IBridgeManager(getContract(ContractType.BRIDGE_MANAGER)).isBridgeOperator(msg.sender))\n revert ErrUnauthorized(msg.sig, RoleAccess.__DEPRECATED_BRIDGE_OPERATOR);\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n uint256 _numerator,\n uint256 _denominator,\n uint256 _trustedNumerator,\n uint256 _trustedDenominator,\n address[] calldata /* _withdrawalMigrators */,\n // _packedAddresses[0]: roninTokens\n // _packedAddresses[1]: mainchainTokens\n address[][2] calldata _packedAddresses,\n // _packedNumbers[0]: chainIds\n // _packedNumbers[1]: minimumThresholds\n uint256[][2] calldata _packedNumbers,\n Token.Standard[] calldata _standards\n ) external virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n _setThreshold(_numerator, _denominator);\n _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n if (_packedAddresses[0].length > 0) {\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\n }\n }\n\n function initializeV2() external reinitializer(2) {\n _setContract(ContractType.VALIDATOR, ____deprecated0);\n _setContract(ContractType.BRIDGE_TRACKING, ____deprecated1);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ____deprecated2);\n delete ____deprecated0;\n delete ____deprecated1;\n delete ____deprecated2;\n }\n\n function initializeV3(address bridgeAdmin) external reinitializer(3) {\n _setContract(ContractType.BRIDGE_MANAGER, bridgeAdmin);\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function getWithdrawalSignatures(\n uint256 withdrawalId,\n address[] calldata operators\n ) external view returns (bytes[] memory _signatures) {\n _signatures = new bytes[](operators.length);\n for (uint256 _i = 0; _i < operators.length; ) {\n _signatures[_i] = _withdrawalSig[withdrawalId][operators[_i]];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function depositFor(Transfer.Receipt calldata _receipt) external whenNotPaused onlyBridgeOperator {\n address _sender = msg.sender;\n _depositFor(_receipt, _sender, minimumVoteWeight());\n IBridgeTracking(getContract(ContractType.BRIDGE_TRACKING)).recordVote(\n IBridgeTracking.VoteKind.Deposit,\n _receipt.id,\n _sender\n );\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function tryBulkAcknowledgeMainchainWithdrew(\n uint256[] calldata _withdrawalIds\n ) external onlyBridgeOperator returns (bool[] memory _executedReceipts) {\n address _governor = msg.sender;\n uint256 _minVoteWeight = minimumVoteWeight();\n\n uint256 _withdrawalId;\n _executedReceipts = new bool[](_withdrawalIds.length);\n IBridgeTracking _bridgeTrackingContract = IBridgeTracking(getContract(ContractType.BRIDGE_TRACKING));\n for (uint256 _i; _i < _withdrawalIds.length; ) {\n _withdrawalId = _withdrawalIds[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\n if (mainchainWithdrew(_withdrawalId)) {\n _executedReceipts[_i] = true;\n } else {\n IsolatedGovernance.Vote storage _vote = mainchainWithdrewVote[_withdrawalId];\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\n bytes32 _hash = _withdrawal.hash();\n VoteStatus _status = _castIsolatedVote(_vote, _governor, _minVoteWeight, _hash);\n if (_status == VoteStatus.Approved) {\n _vote.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\n emit MainchainWithdrew(_hash, _withdrawal);\n }\n }\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function tryBulkDepositFor(\n Transfer.Receipt[] calldata _receipts\n ) external whenNotPaused onlyBridgeOperator returns (bool[] memory _executedReceipts) {\n address _sender = msg.sender;\n\n Transfer.Receipt memory _receipt;\n _executedReceipts = new bool[](_receipts.length);\n uint256 _minVoteWeight = minimumVoteWeight();\n IBridgeTracking _bridgeTrackingContract = IBridgeTracking(getContract(ContractType.BRIDGE_TRACKING));\n for (uint256 _i; _i < _receipts.length; ) {\n _receipt = _receipts[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\n _executedReceipts[_i] = true;\n } else {\n _depositFor(_receipt, _sender, _minVoteWeight);\n }\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\n _requestWithdrawalFor(_request, msg.sender, _chainId);\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\n if (_requests.length == 0) revert ErrEmptyArray();\n\n for (uint256 _i; _i < _requests.length; ) {\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\n if (mainchainWithdrew(_withdrawalId)) revert ErrWithdrawnOnMainchainAlready();\n\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\n if (_receipt.ronin.chainId != block.chainid) {\n revert ErrInvalidChainId(msg.sig, _receipt.ronin.chainId, block.chainid);\n }\n\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function bulkSubmitWithdrawalSignatures(\n uint256[] calldata withdrawals,\n bytes[] calldata signatures\n ) external whenNotPaused onlyBridgeOperator {\n address operator = msg.sender;\n\n if (!(withdrawals.length > 0 && withdrawals.length == signatures.length)) {\n revert ErrLengthMismatch(msg.sig);\n }\n\n uint256 _minVoteWeight = minimumVoteWeight();\n\n uint256 id;\n IBridgeTracking _bridgeTrackingContract = IBridgeTracking(getContract(ContractType.BRIDGE_TRACKING));\n for (uint256 _i; _i < withdrawals.length; ) {\n id = withdrawals[_i];\n _withdrawalSig[id][operator] = signatures[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, id, operator);\n\n IsolatedGovernance.Vote storage _proposal = withdrawalStatVote[id];\n VoteStatus _status = _castIsolatedVote(_proposal, operator, _minVoteWeight, bytes32(id));\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, id);\n }\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) external onlyAdmin {\n if (_roninTokens.length == 0) revert ErrLengthMismatch(msg.sig);\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function depositVoted(uint256 _chainId, uint256 _depositId, address _voter) external view returns (bool) {\n return depositVote[_chainId][_depositId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\n }\n\n /**\n * @inheritdoc IRoninGatewayV3\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\n _token = _mainchainToken[_roninToken][_chainId];\n if (_token.tokenAddr == address(0)) revert ErrUnsupportedToken();\n }\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) internal {\n if (!(_roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length))\n revert ErrLengthMismatch(msg.sig);\n\n for (uint256 _i; _i < _roninTokens.length; ) {\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\n\n unchecked {\n ++_i;\n }\n }\n\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Emits the `Deposited` once the assets are released.\n *\n */\n function _depositFor(Transfer.Receipt memory receipt, address operator, uint256 minVoteWeight) internal {\n uint256 id = receipt.id;\n receipt.info.validate();\n if (receipt.kind != Transfer.Kind.Deposit) revert ErrInvalidReceiptKind();\n\n if (receipt.ronin.chainId != block.chainid) revert ErrInvalidChainId(msg.sig, receipt.ronin.chainId, block.chainid);\n\n MappedToken memory _token = getMainchainToken(receipt.ronin.tokenAddr, receipt.mainchain.chainId);\n\n if (!(_token.erc == receipt.info.erc && _token.tokenAddr == receipt.mainchain.tokenAddr))\n revert ErrInvalidReceipt();\n\n IsolatedGovernance.Vote storage _proposal = depositVote[receipt.mainchain.chainId][id];\n bytes32 _receiptHash = receipt.hash();\n VoteStatus _status = _castIsolatedVote(_proposal, operator, minVoteWeight, _receiptHash);\n emit DepositVoted(operator, id, receipt.mainchain.chainId, _receiptHash);\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n receipt.info.handleAssetTransfer(payable(receipt.ronin.addr), receipt.ronin.tokenAddr, IWETH(address(0)));\n IBridgeTracking(getContract(ContractType.BRIDGE_TRACKING)).handleVoteApproved(\n IBridgeTracking.VoteKind.Deposit,\n receipt.id\n );\n emit Deposited(_receiptHash, receipt);\n }\n }\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Requirements:\n * - The token info is valid.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _requestWithdrawalFor(Transfer.Request calldata _request, address _requester, uint256 _chainId) internal {\n _request.info.validate();\n _checkWithdrawal(_request);\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\n if (_request.info.erc != _token.erc) revert ErrInvalidTokenStandard();\n\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\n }\n\n /**\n * @dev Stores the withdrawal request as a receipt.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _storeAsReceipt(\n Transfer.Request calldata _request,\n uint256 _chainId,\n address _requester,\n address _mainchainTokenAddr\n ) internal returns (uint256 _withdrawalId) {\n _withdrawalId = withdrawalCount++;\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\n _requester,\n _withdrawalId,\n _mainchainTokenAddr,\n _chainId\n );\n withdrawal[_withdrawalId] = _receipt;\n emit WithdrawalRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Don't send me RON.\n */\n function _fallback() internal virtual {\n revert ErrInvalidRequest();\n }\n\n /**\n * @inheritdoc GatewayV3\n */\n function _getTotalWeight() internal view virtual override returns (uint256) {\n return IBridgeManager(getContract(ContractType.BRIDGE_MANAGER)).getTotalWeight();\n }\n\n /**\n * @dev Casts and updates the vote result.\n *\n * Requirements:\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n */\n function _castIsolatedVote(\n IsolatedGovernance.Vote storage _v,\n address _voter,\n uint256 _minVoteWeight,\n bytes32 _hash\n ) internal virtual returns (VoteStatus _status) {\n _v.castVote(_voter, _hash);\n uint256 _totalWeight = _getVoteWeight(_v, _hash);\n return _v.syncVoteStatus(_minVoteWeight, _totalWeight, _hash);\n }\n\n /**\n * @dev Returns the vote weight for a specified hash.\n */\n function _getVoteWeight(\n IsolatedGovernance.Vote storage _v,\n bytes32 _hash\n ) internal view returns (uint256 _totalWeight) {\n (, address[] memory bridgeOperators, uint96[] memory weights) = IBridgeManager(\n getContract(ContractType.BRIDGE_MANAGER)\n ).getFullBridgeOperatorInfos();\n uint256 length = bridgeOperators.length;\n unchecked {\n for (uint _i; _i < length; ++_i) {\n if (_v.voteHashOf[bridgeOperators[_i]] == _hash) {\n _totalWeight += weights[_i];\n }\n }\n }\n }\n\n function setTrustedThreshold(\n uint256 _trustedNumerator,\n uint256 _trustedDenominator\n ) external virtual onlyAdmin returns (uint256, uint256) {\n return _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n }\n\n /**\n * @dev Returns the threshold about trusted org.\n */\n function getTrustedThreshold() external view virtual returns (uint256 trustedNum_, uint256 trustedDenom_) {\n return (_trustedNum, _trustedDenom);\n }\n\n /**\n * @dev Sets trusted threshold and returns the old one.\n *\n * Emits the `TrustedThresholdUpdated` event.\n *\n */\n function _setTrustedThreshold(\n uint256 _trustedNumerator,\n uint256 _trustedDenominator\n ) internal virtual returns (uint256 _previousTrustedNum, uint256 _previousTrustedDenom) {\n if (_trustedNumerator > _trustedDenominator) revert ErrInvalidTrustedThreshold();\n\n _previousTrustedNum = _num;\n _previousTrustedDenom = _denom;\n _trustedNum = _trustedNumerator;\n _trustedDenom = _trustedDenominator;\n unchecked {\n emit TrustedThresholdUpdated(\n nonce++,\n _trustedNumerator,\n _trustedDenominator,\n _previousTrustedNum,\n _previousTrustedDenom\n );\n }\n }\n\n /**\n * @dev Returns minimum trusted vote weight.\n */\n function _minimumTrustedVoteWeight(uint256 _totalTrustedWeight) internal view virtual returns (uint256) {\n return (_trustedNum * _totalTrustedWeight + _trustedDenom - 1) / _trustedDenom;\n }\n}\n" + }, + "contracts/ronin/Maintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IMaintenance.sol\";\nimport \"../interfaces/IProfile.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../extensions/collections/HasContracts.sol\";\nimport \"../libraries/Math.sol\";\nimport { HasValidatorDeprecated } from \"../utils/DeprecatedSlots.sol\";\nimport { ErrUnauthorized, RoleAccess } from \"../utils/CommonErrors.sol\";\n\ncontract Maintenance is IMaintenance, HasContracts, HasValidatorDeprecated, Initializable {\n using Math for uint256;\n\n /// @dev Mapping from candidate id => maintenance schedule.\n mapping(address => Schedule) internal _schedule;\n\n /// @dev The min duration to maintenance in blocks.\n uint256 internal _minMaintenanceDurationInBlock;\n /// @dev The max duration to maintenance in blocks.\n uint256 internal _maxMaintenanceDurationInBlock;\n /// @dev The offset to the min block number that the schedule can start.\n uint256 internal _minOffsetToStartSchedule;\n /// @dev The offset to the max block number that the schedule can start.\n uint256 internal _maxOffsetToStartSchedule;\n /// @dev The max number of scheduled maintenances.\n uint256 internal _maxSchedule;\n /// @dev The cooldown time to request new schedule.\n uint256 internal _cooldownSecsToMaintain;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address validatorContract,\n uint256 minMaintenanceDurationInBlock_,\n uint256 maxMaintenanceDurationInBlock_,\n uint256 minOffsetToStartSchedule_,\n uint256 maxOffsetToStartSchedule_,\n uint256 maxSchedule_,\n uint256 cooldownSecsToMaintain_\n ) external initializer {\n _setContract(ContractType.VALIDATOR, validatorContract);\n _setMaintenanceConfig(\n minMaintenanceDurationInBlock_,\n maxMaintenanceDurationInBlock_,\n minOffsetToStartSchedule_,\n maxOffsetToStartSchedule_,\n maxSchedule_,\n cooldownSecsToMaintain_\n );\n }\n\n function initializeV2() external reinitializer(2) {\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\n delete ______deprecatedValidator;\n }\n\n function initializeV3(address profileContract_) external reinitializer(3) {\n _setContract(ContractType.PROFILE, profileContract_);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function minMaintenanceDurationInBlock() external view returns (uint256) {\n return _minMaintenanceDurationInBlock;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256) {\n return _maxMaintenanceDurationInBlock;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function minOffsetToStartSchedule() external view returns (uint256) {\n return _minOffsetToStartSchedule;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function maxOffsetToStartSchedule() external view returns (uint256) {\n return _maxOffsetToStartSchedule;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function maxSchedule() external view returns (uint256) {\n return _maxSchedule;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function cooldownSecsToMaintain() external view returns (uint256) {\n return _cooldownSecsToMaintain;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function setMaintenanceConfig(\n uint256 minMaintenanceDurationInBlock_,\n uint256 maxMaintenanceDurationInBlock_,\n uint256 minOffsetToStartSchedule_,\n uint256 maxOffsetToStartSchedule_,\n uint256 maxSchedule_,\n uint256 cooldownSecsToMaintain_\n ) external onlyAdmin {\n _setMaintenanceConfig(\n minMaintenanceDurationInBlock_,\n maxMaintenanceDurationInBlock_,\n minOffsetToStartSchedule_,\n maxOffsetToStartSchedule_,\n maxSchedule_,\n cooldownSecsToMaintain_\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external override {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n address candidateId = __css2cid(consensusAddr);\n\n if (!validatorContract.isBlockProducer(consensusAddr)) revert ErrUnauthorized(msg.sig, RoleAccess.BLOCK_PRODUCER);\n if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender))\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\n if (_checkScheduledById(candidateId)) revert ErrAlreadyScheduled();\n if (!_checkCooldownEndedById(candidateId)) revert ErrCooldownTimeNotYetEnded();\n if (totalSchedule() >= _maxSchedule) revert ErrTotalOfSchedulesExceeded();\n if (!startedAtBlock.inRange(block.number + _minOffsetToStartSchedule, block.number + _maxOffsetToStartSchedule)) {\n revert ErrStartBlockOutOfRange();\n }\n if (startedAtBlock >= endedAtBlock) revert ErrStartBlockOutOfRange();\n\n uint256 maintenanceElapsed = endedAtBlock - startedAtBlock + 1;\n\n if (!maintenanceElapsed.inRange(_minMaintenanceDurationInBlock, _maxMaintenanceDurationInBlock)) {\n revert ErrInvalidMaintenanceDuration();\n }\n if (!validatorContract.epochEndingAt(startedAtBlock - 1)) revert ErrStartBlockOutOfRange();\n if (!validatorContract.epochEndingAt(endedAtBlock)) revert ErrEndBlockOutOfRange();\n\n Schedule storage _sSchedule = _schedule[candidateId];\n _sSchedule.from = startedAtBlock;\n _sSchedule.to = endedAtBlock;\n _sSchedule.lastUpdatedBlock = block.number;\n _sSchedule.requestTimestamp = block.timestamp;\n emit MaintenanceScheduled(consensusAddr, _sSchedule);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function cancelSchedule(TConsensus consensusAddr) external override {\n if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(consensusAddr, msg.sender)) {\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\n }\n\n address candidateId = __css2cid(consensusAddr);\n\n if (!_checkScheduledById(candidateId)) revert ErrUnexistedSchedule();\n if (_checkMaintainedById(candidateId, block.number)) revert ErrAlreadyOnMaintenance();\n\n Schedule storage _sSchedule = _schedule[candidateId];\n delete _sSchedule.from;\n delete _sSchedule.to;\n _sSchedule.lastUpdatedBlock = block.number;\n emit MaintenanceScheduleCancelled(consensusAddr);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function getSchedule(TConsensus consensusAddr) external view override returns (Schedule memory) {\n return _schedule[__css2cid(consensusAddr)];\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintained(\n TConsensus[] calldata addrList,\n uint256 atBlock\n ) external view override returns (bool[] memory) {\n address[] memory idList = __css2cidBatch(addrList);\n return _checkManyMaintainedById(idList, atBlock);\n }\n\n function checkManyMaintainedById(\n address[] calldata idList,\n uint256 atBlock\n ) external view override returns (bool[] memory) {\n return _checkManyMaintainedById(idList, atBlock);\n }\n\n function _checkManyMaintainedById(\n address[] memory idList,\n uint256 atBlock\n ) internal view returns (bool[] memory resList) {\n resList = new bool[](idList.length);\n for (uint i = 0; i < idList.length; ) {\n resList[i] = _checkMaintainedById(idList[i], atBlock);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintainedInBlockRange(\n TConsensus[] calldata addrList,\n uint256 fromBlock,\n uint256 toBlock\n ) external view override returns (bool[] memory) {\n address[] memory idList = __css2cidBatch(addrList);\n return _checkManyMaintainedInBlockRangeById(idList, fromBlock, toBlock);\n }\n\n function checkManyMaintainedInBlockRangeById(\n address[] calldata idList,\n uint256 fromBlock,\n uint256 toBlock\n ) external view override returns (bool[] memory) {\n return _checkManyMaintainedInBlockRangeById(idList, fromBlock, toBlock);\n }\n\n function _checkManyMaintainedInBlockRangeById(\n address[] memory idList,\n uint256 fromBlock,\n uint256 toBlock\n ) internal view returns (bool[] memory resList) {\n resList = new bool[](idList.length);\n for (uint i = 0; i < idList.length; ) {\n resList[i] = _maintainingInBlockRange(idList[i], fromBlock, toBlock);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function totalSchedule() public view override returns (uint256 count) {\n address[] memory validatorIds = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).getValidators();\n unchecked {\n for (uint i = 0; i < validatorIds.length; i++) {\n if (_checkScheduledById(validatorIds[i])) {\n count++;\n }\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintained(TConsensus consensusAddr, uint256 atBlock) external view override returns (bool) {\n return _checkMaintainedById(__css2cid(consensusAddr), atBlock);\n }\n\n function checkMaintainedById(address candidateId, uint256 atBlock) external view override returns (bool) {\n return _checkMaintainedById(candidateId, atBlock);\n }\n\n function _checkMaintainedById(address candidateId, uint256 atBlock) internal view returns (bool) {\n Schedule storage _s = _schedule[candidateId];\n return _s.from <= atBlock && atBlock <= _s.to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintainedInBlockRange(\n TConsensus consensusAddr,\n uint256 fromBlock,\n uint256 toBlock\n ) public view override returns (bool) {\n return _maintainingInBlockRange(__css2cid(consensusAddr), fromBlock, toBlock);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkScheduled(TConsensus consensusAddr) external view override returns (bool) {\n return _checkScheduledById(__css2cid(consensusAddr));\n }\n\n function _checkScheduledById(address candidateId) internal view returns (bool) {\n return block.number <= _schedule[candidateId].to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkCooldownEnded(TConsensus consensusAddr) external view override returns (bool) {\n return _checkCooldownEndedById(__css2cid(consensusAddr));\n }\n\n function _checkCooldownEndedById(address candidateId) internal view returns (bool) {\n return block.timestamp > _schedule[candidateId].requestTimestamp + _cooldownSecsToMaintain;\n }\n\n /**\n * @dev Sets the min block period and max block period to maintenance.\n *\n * Requirements:\n * - The max period is larger than the min period.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function _setMaintenanceConfig(\n uint256 minMaintenanceDurationInBlock_,\n uint256 maxMaintenanceDurationInBlock_,\n uint256 minOffsetToStartSchedule_,\n uint256 maxOffsetToStartSchedule_,\n uint256 maxSchedule_,\n uint256 cooldownSecsToMaintain_\n ) internal {\n if (minMaintenanceDurationInBlock_ >= maxMaintenanceDurationInBlock_) revert ErrInvalidMaintenanceDurationConfig();\n if (minOffsetToStartSchedule_ >= maxOffsetToStartSchedule_) revert ErrInvalidOffsetToStartScheduleConfigs();\n\n _minMaintenanceDurationInBlock = minMaintenanceDurationInBlock_;\n _maxMaintenanceDurationInBlock = maxMaintenanceDurationInBlock_;\n _minOffsetToStartSchedule = minOffsetToStartSchedule_;\n _maxOffsetToStartSchedule = maxOffsetToStartSchedule_;\n _maxSchedule = maxSchedule_;\n _cooldownSecsToMaintain = cooldownSecsToMaintain_;\n emit MaintenanceConfigUpdated(\n minMaintenanceDurationInBlock_,\n maxMaintenanceDurationInBlock_,\n minOffsetToStartSchedule_,\n maxOffsetToStartSchedule_,\n maxSchedule_,\n cooldownSecsToMaintain_\n );\n }\n\n /**\n * @dev Check if the validator was maintaining in the current period.\n *\n * Note: This method should be called at the end of the period.\n */\n function _maintainingInBlockRange(\n address candidateId,\n uint256 fromBlock,\n uint256 toBlock\n ) private view returns (bool) {\n Schedule storage s = _schedule[candidateId];\n return Math.twoRangeOverlap(fromBlock, toBlock, s.from, s.to);\n }\n\n function __css2cid(TConsensus consensusAddr) internal view returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n}\n" + }, + "contracts/ronin/profile/Profile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"./ProfileXComponents.sol\";\nimport { ErrUnauthorized, RoleAccess } from \"../../utils/CommonErrors.sol\";\nimport { ContractType } from \"../../utils/ContractType.sol\";\n\npragma solidity ^0.8.9;\n\ncontract Profile is IProfile, ProfileXComponents, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address validatorContract) external initializer {\n _setContract(ContractType.VALIDATOR, validatorContract);\n }\n\n function initializeV2(address stakingContract) external reinitializer(2) {\n _setContract(ContractType.STAKING, stakingContract);\n }\n\n function initializeV3(address trustedOrgContract) external reinitializer(3) {\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, trustedOrgContract);\n\n // TODO(bao): handle renounced validators\n address[] memory validatorCandidates = IRoninValidatorSet(getContract(ContractType.VALIDATOR))\n .getValidatorCandidates();\n TConsensus[] memory consensuses;\n assembly (\"memory-safe\") {\n consensuses := validatorCandidates\n }\n for (uint256 i; i < validatorCandidates.length; ++i) {\n _consensus2Id[consensuses[i]] = validatorCandidates[i];\n }\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getId2Profile(address id) external view returns (CandidateProfile memory) {\n return _id2Profile[id];\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList) {\n consensusList = new TConsensus[](idList.length);\n unchecked {\n for (uint i; i < idList.length; ++i) {\n consensusList[i] = _id2Profile[idList[i]].consensus;\n }\n }\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getConsensus2Id(TConsensus consensus) external view returns (address id) {\n id = _consensus2Id[consensus];\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getManyConsensus2Id(TConsensus[] calldata consensusList) external view returns (address[] memory idList) {\n idList = new address[](consensusList.length);\n unchecked {\n for (uint i; i < consensusList.length; ++i) {\n idList[i] = _consensus2Id[consensusList[i]];\n }\n }\n }\n\n /**\n * @inheritdoc IProfile\n */\n function addNewProfile(CandidateProfile memory profile) external onlyAdmin {\n CandidateProfile storage _profile = _id2Profile[profile.id];\n if (_profile.id != address(0)) revert ErrExistentProfile();\n _addNewProfile(_profile, profile);\n }\n\n /**\n * @inheritdoc IProfile\n *\n * @dev Side-effects on other contracts:\n * - Update Staking contract:\n * + [x] Update (id => PoolDetail) mapping in {BaseStaking.sol}.\n * + [x] Update `_adminOfActivePoolMapping` in {BaseStaking.sol}.\n * - Update Validator contract:\n * + [x] Update (id => ValidatorCandidate) mapping\n */\n function requestChangeAdminAddress(address id, address newAdminAddr) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _checkNonZeroAndNonDuplicated(RoleAccess.ADMIN, newAdminAddr);\n _setAdmin(_profile, newAdminAddr);\n\n IStaking stakingContract = IStaking(getContract(ContractType.STAKING));\n stakingContract.execChangeAdminAddress(id, newAdminAddr);\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n validatorContract.execChangeAdminAddress(id, newAdminAddr);\n\n emit ProfileAddressChanged(id, RoleAccess.ADMIN);\n }\n\n /**\n * @inheritdoc IProfile\n *\n * @dev Side-effects on other contracts:\n * - Update in Staking contract for Consensus address mapping:\n * + [x] Keep the same previous pool address.\n * - Update in Validator contract for:\n * + [x] Consensus Address mapping\n * + [x] Bridge Address mapping\n * + [x] Jail mapping\n * + [x] Pending reward mapping\n * + [x] Schedule mapping\n * - Update in Slashing contract for:\n * + [x] Handling slash indicator\n * + [x] Handling slash fast finality\n * + [x] Handling slash double sign\n * - Update in Proposal contract for:\n * + [ ] Refund of emergency exit mapping\n * + [ ] ...\n * - Update Trusted Org contracts:\n * + [x] Remove and delete weight of the old consensus\n * + [x] Replace and add weight for the new consensus\n */\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _checkNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(newConsensusAddr));\n\n TConsensus oldConsensusAddr = _profile.consensus;\n _setConsensus(_profile, newConsensusAddr);\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n validatorContract.execChangeConsensusAddress(id, newConsensusAddr);\n\n IRoninTrustedOrganization trustedOrgContract = IRoninTrustedOrganization(\n getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)\n );\n trustedOrgContract.execChangeConsensusAddressForTrustedOrg({\n oldConsensusAddr: oldConsensusAddr,\n newConsensusAddr: newConsensusAddr\n });\n\n emit ProfileAddressChanged(id, RoleAccess.CONSENSUS);\n }\n\n /**\n * @inheritdoc IProfile\n *\n * @dev Side-effects on other contracts:\n * - Update Validator contract:\n * + [x] Update (id => ValidatorCandidate) mapping\n * - Update governance admin:\n * + [-] Update recipient in the EmergencyExitBallot to the newTreasury.\n * Cannot impl since we cannot cancel the previous the ballot and\n * create a new ballot on behalf of the validator contract.\n */\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _checkNonZeroAndNonDuplicated(RoleAccess.TREASURY, newTreasury);\n _setTreasury(_profile, newTreasury);\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n validatorContract.execChangeTreasuryAddress(id, newTreasury);\n\n emit ProfileAddressChanged(id, RoleAccess.TREASURY);\n }\n\n /**\n * @inheritdoc IProfile\n */\n function changePubkey(address id, bytes memory pubkey) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _checkNonDuplicatedPubkey(pubkey);\n _setPubkey(_profile, pubkey);\n\n emit PubkeyChanged(id, pubkey);\n }\n\n function _requireCandidateAdmin(CandidateProfile storage sProfile) internal view {\n if (\n msg.sender != sProfile.admin ||\n !IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(sProfile.consensus, msg.sender)\n ) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\n }\n}\n" + }, + "contracts/ronin/profile/ProfileHandler.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../udvts/Types.sol\";\nimport \"../../utils/RoleAccess.sol\";\nimport { ProfileStorage } from \"./ProfileStorage.sol\";\n\nabstract contract ProfileHandler is ProfileStorage {\n /**\n * @dev Checks each element in the new profile and reverts if there is duplication with any existing profile.\n */\n function _checkDuplicatedInRegistry(CandidateProfile memory profile) internal view {\n _checkNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(profile.consensus));\n _checkNonZeroAndNonDuplicated(RoleAccess.CANDIDATE_ADMIN, profile.admin);\n _checkNonZeroAndNonDuplicated(RoleAccess.TREASURY, profile.treasury);\n _checkNonDuplicated(RoleAccess.TREASURY, profile.__reservedGovernor);\n _checkNonDuplicatedPubkey(profile.pubkey);\n }\n\n function _checkNonZeroAndNonDuplicated(RoleAccess addressType, address addr) internal view {\n if (addr == address(0)) revert ErrZeroAddress(addressType);\n _checkNonDuplicated(addressType, addr);\n }\n\n function _checkNonDuplicated(RoleAccess addressType, address addr) internal view {\n if (_registry[uint256(uint160(addr))]) {\n revert ErrDuplicatedInfo(addressType, uint256(uint160(addr)));\n }\n }\n\n function _checkNonDuplicatedPubkey(bytes memory pubkey) internal view {\n if (_registry[_hashPubkey(pubkey)]) {\n revert ErrDuplicatedPubkey(pubkey);\n }\n }\n}" + }, + "contracts/ronin/profile/ProfileStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../udvts/Types.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { IProfile } from \"../../interfaces/IProfile.sol\";\n\nabstract contract ProfileStorage is IProfile, HasContracts {\n /// @dev Mapping from id address => candidate profile.\n mapping(address => CandidateProfile) internal _id2Profile;\n\n /**\n * @dev Mapping from any address or keccak256(pubkey) => whether it is already registered.\n * This registry can only be toggled to `true` and NOT vice versa. All registered values\n * cannot be reused.\n */\n mapping(uint256 => bool) internal _registry;\n\n /// @dev Mapping from consensus address => id address.\n mapping(TConsensus => address) internal _consensus2Id;\n\n /// @dev Upgradeable gap.\n bytes32[48] __gap;\n\n /**\n * @dev Add a profile from memory to storage.\n */\n function _addNewProfile(CandidateProfile storage _profile, CandidateProfile memory newProfile) internal {\n _profile.id = newProfile.id;\n\n _setConsensus(_profile, newProfile.consensus);\n _setAdmin(_profile, newProfile.admin);\n _setTreasury(_profile, newProfile.treasury);\n _setGovernor(_profile, newProfile.__reservedGovernor);\n _setPubkey(_profile, newProfile.pubkey);\n\n emit ProfileAdded(newProfile.id);\n }\n\n function _setConsensus(CandidateProfile storage _profile, TConsensus consensus) internal {\n delete _consensus2Id[_profile.consensus];\n _consensus2Id[consensus] = _profile.id;\n\n _profile.consensus = consensus;\n _registry[uint256(uint160(TConsensus.unwrap(consensus)))] = true;\n }\n\n function _setAdmin(CandidateProfile storage _profile, address admin) internal {\n _profile.admin = admin;\n _registry[uint256(uint160(admin))] = true;\n }\n\n function _setTreasury(CandidateProfile storage _profile, address payable treasury) internal {\n _profile.treasury = treasury;\n _registry[uint256(uint160(address(treasury)))] = true;\n }\n\n /**\n * @dev Allow to registry a profile without governor address since not all validators are governing validators.\n */\n function _setGovernor(CandidateProfile storage _profile, address governor) internal {\n _profile.__reservedGovernor = governor;\n if (governor != address(0)) {\n _registry[uint256(uint160(governor))] = true;\n }\n }\n\n function _setPubkey(CandidateProfile storage _profile, bytes memory pubkey) internal {\n _profile.pubkey = pubkey;\n _registry[_hashPubkey(pubkey)] = true;\n }\n\n /**\n * @dev Get an existed profile struct from `id`. Revert if the profile does not exists.\n */\n function _getId2ProfileHelper(address id) internal view returns (CandidateProfile storage _profile) {\n _profile = _id2Profile[id];\n if (_profile.id == address(0)) revert ErrNonExistentProfile();\n }\n\n /**\n * @dev Returns hash of a public key.\n */\n function _hashPubkey(bytes memory pubkey) internal pure returns (uint256) {\n return uint256(keccak256(pubkey));\n }\n}\n" + }, + "contracts/ronin/profile/ProfileXComponents.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"../../interfaces/IProfile.sol\";\nimport { ContractType } from \"../../utils/ContractType.sol\";\nimport \"./ProfileHandler.sol\";\n\npragma solidity ^0.8.9;\n\nabstract contract ProfileXComponents is IProfile, ProfileHandler {\n /**\n * @inheritdoc IProfile\n */\n function execApplyValidatorCandidate(\n address admin,\n address id,\n address treasury,\n bytes calldata pubkey\n ) external override onlyContract(ContractType.STAKING) {\n // Check existent profile\n CandidateProfile storage _profile = _id2Profile[id];\n if (_profile.id != address(0)) revert ErrExistentProfile();\n\n // Validate the info and add the profile\n CandidateProfile memory profile = CandidateProfile({\n id: id,\n consensus: TConsensus.wrap(id),\n admin: admin,\n treasury: payable(treasury),\n __reservedGovernor: address(0),\n pubkey: pubkey\n });\n _checkDuplicatedInRegistry(profile);\n _addNewProfile(_profile, profile);\n }\n}\n" + }, + "contracts/ronin/RoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/sequential-governance/governance-proposal/GovernanceProposal.sol\";\nimport \"../extensions/collections/HasContracts.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../libraries/EmergencyExitBallot.sol\";\nimport { ErrorHandler } from \"../libraries/ErrorHandler.sol\";\nimport { IsolatedGovernance } from \"../libraries/IsolatedGovernance.sol\";\nimport { HasValidatorDeprecated } from \"../utils/DeprecatedSlots.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract RoninGovernanceAdmin is\n HasContracts,\n IRoninGovernanceAdmin,\n GovernanceAdmin,\n GovernanceProposal,\n HasValidatorDeprecated\n{\n using ErrorHandler for bool;\n using Proposal for Proposal.ProposalDetail;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev Mapping from request hash => emergency poll\n mapping(bytes32 => IsolatedGovernance.Vote) internal _emergencyExitPoll;\n\n modifier onlyGovernor() {\n _requireGorvernor();\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _validatorContract,\n uint256 _expiryDuration\n ) CoreGovernance(_expiryDuration) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract) {\n _setContract(ContractType.VALIDATOR, _validatorContract);\n }\n\n function _requireGorvernor() private view {\n if (_getWeight(msg.sender) == 0) revert ErrUnauthorized(msg.sig, RoleAccess.GOVERNOR);\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function setContract(\n ContractType contractType,\n address addr\n ) external override(HasContracts, GovernanceAdmin) onlySelfCall {\n _requireHasCode(addr);\n _setContract(contractType, addr);\n }\n\n /**\n * @dev Returns whether the voter casted vote for emergency exit poll.\n */\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\n return _emergencyExitPoll[_voteHash].voted(_voter);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeProposal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function propose(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev Proposes and casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalForCurrentNetwork(\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts,\n Ballot.VoteType _support\n ) external onlyGovernor {\n address _voter = msg.sender;\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\n block.chainid,\n _expiryTimestamp,\n _targets,\n _values,\n _calldatas,\n _gasAmounts,\n _voter\n );\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\n }\n\n /**\n * @dev Casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function castProposalVoteForCurrentNetwork(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType _support\n ) external onlyGovernor {\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\n }\n\n /**\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\n */\n function castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\n }\n\n /**\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\n *\n * Requirements:\n * - The proposal is already created.\n *\n */\n function deleteExpired(uint256 _chainId, uint256 _round) external {\n ProposalVote storage _vote = vote[_chainId][_round];\n if (_vote.hash == 0) revert ErrQueryForEmptyVote();\n\n _tryDeleteExpiredVotingRound(_vote);\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function createEmergencyExitPoll(\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n ) external onlyContract(ContractType.VALIDATOR) {\n bytes32 ballotHash = EmergencyExitBallot.hash(validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt);\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[ballotHash];\n _v.createdAt = block.timestamp;\n _v.expiredAt = expiredAt;\n emit EmergencyExitPollCreated(ballotHash, validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt);\n }\n\n /**\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\n *\n * Requirements:\n * - The voter is governor.\n * - The voting is existent.\n * - The voting is not expired yet.\n *\n */\n function voteEmergencyExit(\n bytes32 voteHash,\n address validatorId,\n address recipientAfterUnlockedFund,\n uint256 requestedAt,\n uint256 expiredAt\n ) external onlyGovernor {\n address _voter = msg.sender;\n bytes32 _hash = EmergencyExitBallot.hash(validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt);\n if (voteHash != _hash) revert ErrInvalidVoteHash();\n\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n if (_v.createdAt == 0) revert ErrQueryForNonExistentVote();\n if (_v.status == VoteStatus.Expired) revert ErrQueryForExpiredVote();\n\n _v.castVote(_voter, _hash);\n emit EmergencyExitPollVoted(_hash, _voter);\n\n address[] memory _voters = _v.filterByHash(_hash);\n VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeight(_voters), _hash);\n if (_stt == VoteStatus.Approved) {\n _execReleaseLockedFundForEmergencyExitRequest(validatorId, recipientAfterUnlockedFund);\n emit EmergencyExitPollApproved(_hash);\n _v.status = VoteStatus.Executed;\n } else if (_stt == VoteStatus.Expired) {\n emit EmergencyExitPollExpired(_hash);\n }\n }\n\n /**\n * @dev Returns weight of a govenor.\n */\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getGovernorWeight.selector;\n (bool _success, bytes memory _returndata) = getContract(ContractType.RONIN_TRUSTED_ORGANIZATION).staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n _success.handleRevert(_selector, _returndata);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the total weight of a list address of governors.\n */\n function _sumGovernorWeight(address[] memory governors) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeight.selector;\n (bool _success, bytes memory _returndata) = getContract(ContractType.RONIN_TRUSTED_ORGANIZATION).staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, governors)\n )\n );\n\n _success.handleRevert(_selector, _returndata);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Trigger function from validator contract to unlock fund for emergency exit request.\n */\n function _execReleaseLockedFundForEmergencyExitRequest(\n address validatorId,\n address recipientAfterUnlockedFund\n ) internal virtual {\n bytes4 _selector = IEmergencyExit.execReleaseLockedFundForEmergencyExitRequest.selector;\n (bool _success, bytes memory _returndata) = getContract(ContractType.VALIDATOR).call(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, validatorId, recipientAfterUnlockedFund)\n )\n );\n _success.handleRevert(_selector, _returndata);\n }\n\n /**\n * @dev See `CoreGovernance-_getChainType`.\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.RoninChain;\n }\n}\n" + }, + "contracts/ronin/slash-indicator/CreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/IMaintenance.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/slash-indicator/ICreditScore.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasValidatorDeprecated, HasMaintenanceDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport { ErrUnauthorized, RoleAccess } from \"../../utils/CommonErrors.sol\";\n\nabstract contract CreditScore is\n ICreditScore,\n HasContracts,\n HasValidatorDeprecated,\n HasMaintenanceDeprecated,\n PercentageConsumer\n{\n /// @dev Mapping from validator id => period index => whether bailed out before\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\n /// @dev Mapping from validator address => credit score\n mapping(address => uint256) internal _creditScore;\n\n /// @dev The max gained number of credit score per period.\n uint256 internal _gainCreditScore;\n /// @dev The max number of credit score that a validator can hold.\n uint256 internal _maxCreditScore;\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n uint256 internal _bailOutCostMultiplier;\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\n uint256 internal _cutOffPercentageAfterBailout;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ICreditScore\n */\n function execUpdateCreditScores(\n address[] calldata validatorIds,\n uint256 period\n ) external override onlyContract(ContractType.VALIDATOR) {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(msg.sender);\n uint256 periodStartAtBlock = validatorContract.currentPeriodStartAtBlock();\n\n bool[] memory jaileds = validatorContract.checkManyJailedById(validatorIds);\n bool[] memory maintaineds = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedInBlockRangeById(\n validatorIds,\n periodStartAtBlock,\n block.number\n );\n uint256[] memory updatedCreditScores = new uint256[](validatorIds.length);\n\n for (uint i = 0; i < validatorIds.length; ) {\n address vId = validatorIds[i];\n\n uint256 indicator = _getUnavailabilityIndicatorById(vId, period);\n bool isJailedInPeriod = jaileds[i];\n bool isMaintainingInPeriod = maintaineds[i];\n\n uint256 _actualGain = (isJailedInPeriod || isMaintainingInPeriod)\n ? 0\n : Math.subNonNegative(_gainCreditScore, indicator);\n\n _creditScore[vId] = Math.addWithUpperbound(_creditScore[vId], _actualGain, _maxCreditScore);\n updatedCreditScores[i] = _creditScore[vId];\n unchecked {\n ++i;\n }\n }\n\n emit CreditScoresUpdated(validatorIds, updatedCreditScores);\n }\n\n function execResetCreditScores(\n address[] calldata validatorIds\n ) external override onlyContract(ContractType.VALIDATOR) {\n uint256[] memory updatedCreditScores = new uint256[](validatorIds.length);\n for (uint i = 0; i < validatorIds.length; ) {\n address _validator = validatorIds[i];\n delete _creditScore[_validator];\n delete updatedCreditScores[i];\n\n unchecked {\n ++i;\n }\n }\n emit CreditScoresUpdated(validatorIds, updatedCreditScores);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function bailOut(TConsensus consensusAddr) external override {\n address validatorId = __css2cid(consensusAddr);\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n if (!validatorContract.isValidatorCandidate(consensusAddr))\n revert ErrUnauthorized(msg.sig, RoleAccess.VALIDATOR_CANDIDATE);\n\n if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender))\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\n\n (bool isJailed, , uint256 jailedEpochLeft) = validatorContract.getJailedTimeLeft(consensusAddr);\n if (!isJailed) revert ErrCallerMustBeJailedInTheCurrentPeriod();\n\n uint256 period = validatorContract.currentPeriod();\n if (_checkBailedOutAtPeriod[validatorId][period]) revert ErrValidatorHasBailedOutPreviously();\n\n uint256 score = _creditScore[validatorId];\n uint256 cost = jailedEpochLeft * _bailOutCostMultiplier;\n if (score < cost) revert ErrInsufficientCreditScoreToBailOut();\n\n validatorContract.execBailOut(validatorId, period);\n\n _creditScore[validatorId] -= cost;\n _setUnavailabilityIndicator(validatorId, period, 0);\n _checkBailedOutAtPeriod[validatorId][period] = true;\n emit BailedOut(consensusAddr, period, cost);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external override onlyAdmin {\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n\n /**\n * @dev See `ISlashUnavailability`\n */\n function _getUnavailabilityIndicatorById(address validator, uint256 period) internal view virtual returns (uint256);\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScoreConfigs()\n external\n view\n override\n returns (\n uint256 gainCreditScore_,\n uint256 maxCreditScore_,\n uint256 bailOutCostMultiplier_,\n uint256 cutOffPercentageAfterBailout_\n )\n {\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScore(TConsensus consensusAddr) external view override returns (uint256) {\n return _creditScore[__css2cid(consensusAddr)];\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getManyCreditScores(\n TConsensus[] calldata consensusAddrs\n ) public view override returns (uint256[] memory resultList) {\n address[] memory validatorIds = __css2cidBatch(consensusAddrs);\n resultList = new uint256[](validatorIds.length);\n\n for (uint i = 0; i < resultList.length; ) {\n resultList[i] = _creditScore[validatorIds[i]];\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view override returns (bool) {\n return _checkBailedOutAtPeriodById(__css2cid(consensus), period);\n }\n\n function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool) {\n return _checkBailedOutAtPeriod[validatorId][period];\n }\n\n /**\n * @dev See `SlashUnavailability`.\n */\n function _setUnavailabilityIndicator(address _validator, uint256 period, uint256 _indicator) internal virtual;\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n\n /**\n * @dev See `ICreditScore-setCreditScoreConfigs`.\n */\n function _setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) internal {\n if (_gainScore > _maxScore) revert ErrInvalidCreditScoreConfig();\n if (_cutOffPercentage > _MAX_PERCENTAGE) revert ErrInvalidCutOffPercentageConfig();\n\n _gainCreditScore = _gainScore;\n _maxCreditScore = _maxScore;\n _bailOutCostMultiplier = _bailOutMultiplier;\n _cutOffPercentageAfterBailout = _cutOffPercentage;\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/DeprecatedSlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasProxyAdmin.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\nabstract contract DeprecatedSlashBridgeOperator is HasProxyAdmin, HasContracts, HasValidatorDeprecated {\n /**\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\n * Values 0-10,000 map to 0%-100%.\n */\n uint256 private ____deprecatedMissingVotesRatioTier1;\n /**\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\n * more than the ratio. Values 0-10,000 map to 0%-100%.\n */\n uint256 private ____deprecatedMissingVotesRatioTier2;\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\n uint256 private ____deprecatedJailDurationForMissingVotesRatioTier2;\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\n uint256 private ____deprecatedSkipBridgeOperatorSlashingThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n}\n" + }, + "contracts/ronin/slash-indicator/DeprecatedSlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { HasValidatorDeprecated, HasTrustedOrgDeprecated, HasGovernanceAdminDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\n\n// TODO: remove this from slashing logic of consensus contract\nabstract contract DeprecatedSlashBridgeVoting is\n HasContracts,\n HasValidatorDeprecated,\n HasTrustedOrgDeprecated,\n HasGovernanceAdminDeprecated\n{\n /// @dev Mapping from validator address => period index => bridge voting slashed\n mapping(address => mapping(uint256 => bool)) private __deprecatedBridgeVotingSlashed;\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\n uint256 private __deprecatedBridgeVotingThreshold;\n /// @dev The amount of RON to slash bridge voting.\n uint256 private __deprecatedBridgeVotingSlashAmount;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n}\n" + }, + "contracts/ronin/slash-indicator/SlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashDoubleSign.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasContracts, HasValidatorDeprecated, PCUValidateDoubleSign {\n /// @dev The amount of RON to slash double sign.\n uint256 internal _slashDoubleSignAmount;\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\n uint256 internal _doubleSigningJailUntilBlock;\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\n * This parameter is exposed for system transaction.\n **/\n uint256 internal _doubleSigningOffsetLimitBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) _submittedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[24] private ______gap;\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function slashDoubleSign(\n TConsensus consensusAddr,\n bytes calldata header1,\n bytes calldata header2\n ) external override onlyAdmin {\n bytes32 header1Checksum = keccak256(header1);\n bytes32 header2Checksum = keccak256(header2);\n\n if (_submittedEvidence[header1Checksum] || _submittedEvidence[header2Checksum]) {\n revert ErrEvidenceAlreadySubmitted();\n }\n\n address validatorId = __css2cid(consensusAddr);\n\n // NOTE: Edge case: non-validator who never apply for the candidate role, nor have a profile.\n // Must be slashed by the consensus address, since the validatorId will be address(0).\n if (validatorId == address(0)) {\n validatorId = TConsensus.unwrap(consensusAddr);\n }\n\n if (_pcValidateEvidence(validatorId, header1, header2)) {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 period = validatorContract.currentPeriod();\n _submittedEvidence[header1Checksum] = true;\n _submittedEvidence[header2Checksum] = true;\n emit Slashed(validatorId, SlashType.DOUBLE_SIGNING, period);\n validatorContract.execSlash(validatorId, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\n }\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n override\n returns (\n uint256 slashDoubleSignAmount_,\n uint256 doubleSigningJailUntilBlock_,\n uint256 doubleSigningOffsetLimitBlock_\n )\n {\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) external override onlyAdmin {\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\n }\n\n /**\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\n */\n function _setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) internal {\n _slashDoubleSignAmount = _slashAmount;\n _doubleSigningJailUntilBlock = _jailUntilBlock;\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool);\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashFastFinality.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashFastFinality.sol\";\nimport { IRoninValidatorSet } from \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport { IProfile } from \"../../interfaces/IProfile.sol\";\nimport { IRoninTrustedOrganization } from \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../precompile-usages/PCUValidateFastFinality.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../utils/CommonErrors.sol\";\n\nabstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUValidateFastFinality {\n /// @dev The amount of RON to slash fast finality.\n uint256 internal _slashFastFinalityAmount;\n /// @dev The block number that the punished validator will be jailed until, due to malicious fast finality.\n uint256 internal _fastFinalityJailUntilBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) internal _processedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[21] private ______gap;\n\n modifier onlyGoverningValidator() {\n if (_getGovernorWeight(msg.sender) == 0) revert ErrUnauthorized(msg.sig, RoleAccess.GOVERNOR);\n _;\n }\n\n /**\n * @inheritdoc ISlashFastFinality\n */\n function slashFastFinality(\n TConsensus consensusAddr,\n bytes calldata voterPublicKey,\n uint256 targetBlockNumber,\n bytes32[2] calldata targetBlockHash,\n bytes[][2] calldata listOfPublicKey,\n bytes[2] calldata aggregatedSignature\n ) external override onlyGoverningValidator {\n address validatorId = __css2cid(consensusAddr);\n IProfile profileContract = IProfile(getContract(ContractType.PROFILE));\n bytes memory expectingPubKey = (profileContract.getId2Profile(validatorId)).pubkey;\n if (keccak256(voterPublicKey) != keccak256(expectingPubKey)) revert ErrInvalidArguments(msg.sig);\n\n bytes32 evidenceHash = keccak256(abi.encodePacked(consensusAddr, targetBlockNumber));\n if (_processedEvidence[evidenceHash]) revert ErrEvidenceAlreadySubmitted();\n\n if (\n _pcValidateFastFinalityEvidence(\n voterPublicKey,\n targetBlockNumber,\n targetBlockHash,\n listOfPublicKey,\n aggregatedSignature\n )\n ) {\n _processedEvidence[evidenceHash] = true;\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 period = validatorContract.currentPeriod();\n emit Slashed(validatorId, SlashType.FAST_FINALITY, period);\n validatorContract.execSlash({\n cid: validatorId,\n newJailedUntil: _fastFinalityJailUntilBlock,\n slashAmount: _slashFastFinalityAmount,\n cannotBailout: true\n });\n }\n }\n\n /**\n * @inheritdoc ISlashFastFinality\n */\n function getFastFinalitySlashingConfigs()\n external\n view\n override\n returns (uint256 slashFastFinalityAmount_, uint256 fastFinalityJailUntilBlock_)\n {\n return (_slashFastFinalityAmount, _fastFinalityJailUntilBlock);\n }\n\n /**\n * @inheritdoc ISlashFastFinality\n */\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external override onlyAdmin {\n _setFastFinalitySlashingConfigs(slashAmount, jailUntilBlock);\n }\n\n /**\n * @dev See `ISlashFastFinality-setFastFinalitySlashingConfigs`.\n */\n function _setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) internal {\n _slashFastFinalityAmount = slashAmount;\n _fastFinalityJailUntilBlock = jailUntilBlock;\n emit FastFinalitySlashingConfigsUpdated(slashAmount, jailUntilBlock);\n }\n\n /**\n * @dev Get governor, i.e. governing validator's weight, of the `addr`.\n */\n function _getGovernorWeight(address addr) internal view returns (uint256) {\n return IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getGovernorWeight(addr);\n }\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"./DeprecatedSlashBridgeOperator.sol\";\nimport \"./DeprecatedSlashBridgeVoting.sol\";\nimport \"./SlashDoubleSign.sol\";\nimport \"./SlashFastFinality.sol\";\nimport \"./SlashUnavailability.sol\";\nimport \"./CreditScore.sol\";\n\ncontract SlashIndicator is\n ISlashIndicator,\n SlashDoubleSign,\n SlashFastFinality,\n DeprecatedSlashBridgeVoting,\n DeprecatedSlashBridgeOperator,\n SlashUnavailability,\n CreditScore,\n Initializable\n{\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __roninGovernanceAdminContract,\n uint256[4] calldata /* _bridgeOperatorSlashingConfigs */,\n uint256[2] calldata /* _bridgeVotingSlashingConfigs */,\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\n uint256[3] calldata _doubleSignSlashingConfigs,\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\n uint256[4] calldata _unavailabilitySlashingConfigs,\n // _creditScoreConfigs[0]: _gainCreditScore\n // _creditScoreConfigs[1]: _maxCreditScore\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\n uint256[4] calldata _creditScoreConfigs\n ) external initializer {\n _setContract(ContractType.VALIDATOR, __validatorContract);\n _setContract(ContractType.MAINTENANCE, __maintenanceContract);\n _setContract(ContractType.GOVERNANCE_ADMIN, __roninGovernanceAdminContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract);\n\n _setDoubleSignSlashingConfigs(\n _doubleSignSlashingConfigs[0],\n _doubleSignSlashingConfigs[1],\n _doubleSignSlashingConfigs[2]\n );\n _setUnavailabilitySlashingConfigs(\n _unavailabilitySlashingConfigs[0],\n _unavailabilitySlashingConfigs[1],\n _unavailabilitySlashingConfigs[2],\n _unavailabilitySlashingConfigs[3]\n );\n _setCreditScoreConfigs(\n _creditScoreConfigs[0],\n _creditScoreConfigs[1],\n _creditScoreConfigs[2],\n _creditScoreConfigs[3]\n );\n }\n\n function initializeV2(address roninGovernanceAdminContract) external reinitializer(2) {\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\n _setContract(ContractType.MAINTENANCE, ______deprecatedMaintenance);\n _setContract(ContractType.GOVERNANCE_ADMIN, roninGovernanceAdminContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ______deprecatedTrustedOrg);\n\n delete ______deprecatedValidator;\n delete ______deprecatedMaintenance;\n delete ______deprecatedTrustedOrg;\n delete ______deprecatedGovernanceAdmin;\n }\n\n function initializeV3(address profileContract) external reinitializer(3) {\n _setContract(ContractType.PROFILE, profileContract);\n _setFastFinalitySlashingConfigs(_slashDoubleSignAmount, _doubleSigningJailUntilBlock);\n }\n\n /**\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\n */\n function _setUnavailabilityIndicator(\n address validator,\n uint256 period,\n uint256 indicator\n ) internal override(CreditScore, SlashUnavailability) {\n SlashUnavailability._setUnavailabilityIndicator(validator, period, indicator);\n }\n\n /**\n * @dev Helper for CreditScore contract to query indicator of the validator.\n */\n function _getUnavailabilityIndicatorById(\n address validatorId,\n uint256 period\n ) internal view override(CreditScore, SlashUnavailability) returns (uint256) {\n return SlashUnavailability._getUnavailabilityIndicatorById(validatorId, period);\n }\n\n function _checkBailedOutAtPeriodById(\n address cid,\n uint256 period\n ) internal view override(CreditScore, SlashUnavailability) returns (bool) {\n return CreditScore._checkBailedOutAtPeriodById(cid, period);\n }\n\n /**\n * @dev Sanity check the address to be slashed\n */\n function _shouldSlash(\n TConsensus consensus,\n address validatorId\n ) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\n return\n (msg.sender != TConsensus.unwrap(consensus)) &&\n (msg.sender != validatorId) &&\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isBlockProducer(consensus) &&\n !IMaintenance(getContract(ContractType.MAINTENANCE)).checkMaintainedById(validatorId, block.number);\n }\n\n function __css2cid(\n TConsensus consensusAddr\n ) internal view override(CreditScore, SlashDoubleSign, SlashUnavailability, SlashFastFinality) returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view override returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./CreditScore.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/slash-indicator/ISlashUnavailability.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport { ErrInvalidThreshold } from \"../../utils/CommonErrors.sol\";\n\nabstract contract SlashUnavailability is ISlashUnavailability, HasContracts, HasValidatorDeprecated {\n /// @dev The last block that a validator is slashed for unavailability.\n uint256 internal _lastUnavailabilitySlashedBlock;\n /// @dev Mapping from validator address => period index => unavailability indicator.\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\n\n /**\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\n */\n uint256 internal _unavailabilityTier1Threshold;\n /**\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n */\n uint256 internal _unavailabilityTier2Threshold;\n /**\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\n * tier-2 or tier-3.\n **/\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n modifier oncePerBlock() {\n if (block.number <= _lastUnavailabilitySlashedBlock) {\n revert ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\n }\n\n _lastUnavailabilitySlashedBlock = block.number;\n _;\n }\n\n function lastUnavailabilitySlashedBlock() external view returns (uint256) {\n return _lastUnavailabilitySlashedBlock;\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function slashUnavailability(TConsensus consensusAddr) external override oncePerBlock {\n if (msg.sender != block.coinbase) revert ErrUnauthorized(msg.sig, RoleAccess.COINBASE);\n\n address validatorId = __css2cid(consensusAddr);\n if (!_shouldSlash(consensusAddr, validatorId)) {\n // Should return instead of throwing error since this is a part of system transaction.\n return;\n }\n\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 period = _validatorContract.currentPeriod();\n uint256 count;\n unchecked {\n count = ++_unavailabilityIndicator[validatorId][period];\n }\n uint256 newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\n\n if (count == _unavailabilityTier2Threshold) {\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_2, period);\n _validatorContract.execSlash(\n validatorId,\n newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n false\n );\n } else if (count == _unavailabilityTier1Threshold) {\n bool tier1SecondTime = _checkBailedOutAtPeriodById(validatorId, period);\n if (!tier1SecondTime) {\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_1, period);\n _validatorContract.execSlash(validatorId, 0, 0, false);\n } else {\n /// Handles tier-3\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_3, period);\n _validatorContract.execSlash(\n validatorId,\n newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n true\n );\n }\n }\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external override onlyAdmin {\n _setUnavailabilitySlashingConfigs(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n override\n returns (\n uint256 unavailabilityTier1Threshold_,\n uint256 unavailabilityTier2Threshold_,\n uint256 slashAmountForUnavailabilityTier2Threshold_,\n uint256 jailDurationForUnavailabilityTier2Threshold_\n )\n {\n return (\n _unavailabilityTier1Threshold,\n _unavailabilityTier2Threshold,\n _slashAmountForUnavailabilityTier2Threshold,\n _jailDurationForUnavailabilityTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function currentUnavailabilityIndicator(TConsensus consensus) external view override returns (uint256) {\n return\n _getUnavailabilityIndicatorById(\n __css2cid(consensus),\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod()\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilityIndicator(\n TConsensus consensus,\n uint256 period\n ) external view virtual override returns (uint256) {\n return _getUnavailabilityIndicatorById(__css2cid(consensus), period);\n }\n\n function _getUnavailabilityIndicatorById(\n address validatorId,\n uint256 period\n ) internal view virtual returns (uint256) {\n return _unavailabilityIndicator[validatorId][period];\n }\n\n /**\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\n */\n function _setUnavailabilityIndicator(address _validator, uint256 _period, uint256 _indicator) internal virtual {\n _unavailabilityIndicator[_validator][_period] = _indicator;\n }\n\n /**\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\n */\n function _setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) internal {\n if (_unavailabilityTier1Threshold > _unavailabilityTier2Threshold) revert ErrInvalidThreshold(msg.sig);\n\n _unavailabilityTier1Threshold = _tier1Threshold;\n _unavailabilityTier2Threshold = _tier2Threshold;\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\n emit UnavailabilitySlashingConfigsUpdated(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool);\n\n /**\n * @dev See `ICreditScore-checkBailedOutAtPeriodById`\n */\n function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool);\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n}\n" + }, + "contracts/ronin/staking/BaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../interfaces/staking/IBaseStaking.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"./RewardCalculation.sol\";\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\nabstract contract BaseStaking is\n RONTransferHelper,\n ReentrancyGuard,\n RewardCalculation,\n HasContracts,\n IBaseStaking,\n HasValidatorDeprecated\n{\n /// @dev Mapping from pool address (i.e. validator id) => staking pool detail\n mapping(address => PoolDetail) internal _poolDetail;\n\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n uint256 internal _cooldownSecsToUndelegate;\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\n uint256 internal _waitingSecsToRevoke;\n\n /// @dev Mapping from \"admin address of an active pool\" => \"pool id\".\n mapping(address => address) internal _adminOfActivePoolMapping;\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n modifier noEmptyValue() {\n _requireValue();\n _;\n }\n\n modifier anyExceptPoolAdmin(PoolDetail storage _pool, address delegator) {\n _anyExceptPoolAdmin(_pool, delegator);\n _;\n }\n\n modifier onlyPoolAdmin(PoolDetail storage _pool, address requester) {\n _requirePoolAdmin(_pool, requester);\n _;\n }\n\n modifier poolOfConsensusIsActive(TConsensus consensusAddr) {\n _poolOfConsensusIsActive(consensusAddr);\n _;\n }\n\n function _requireValue() private view {\n if (msg.value == 0) revert ErrZeroValue();\n }\n\n function _requirePoolAdmin(PoolDetail storage _pool, address requester) private view {\n if (_pool.__shadowedPoolAdmin != requester) revert ErrOnlyPoolAdminAllowed();\n }\n\n function _anyExceptPoolAdmin(PoolDetail storage _pool, address delegator) private view {\n if (_pool.__shadowedPoolAdmin == delegator) revert ErrPoolAdminForbidden();\n }\n\n function _poolOfConsensusIsActive(TConsensus consensusAddr) private view {\n if (!IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isValidatorCandidate(consensusAddr))\n revert ErrInactivePool(consensusAddr, __css2cid(consensusAddr));\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function isAdminOfActivePool(address admin) public view override returns (bool) {\n return _adminOfActivePoolMapping[admin] != address(0);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolAddressOf(address admin) external view override returns (address) {\n return _adminOfActivePoolMapping[admin];\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolDetail(\n TConsensus consensusAddr\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) {\n address poolId = __css2cid(consensusAddr);\n return _getPoolDetailById(poolId);\n }\n\n function getPoolDetailById(\n address poolId\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) {\n return _getPoolDetailById(poolId);\n }\n\n function _getPoolDetailById(\n address poolId\n ) internal view returns (address admin, uint256 stakingAmount, uint256 stakingTotal) {\n PoolDetail storage _pool = _poolDetail[poolId];\n return (_pool.__shadowedPoolAdmin, _pool.stakingAmount, _pool.stakingTotal);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getManySelfStakings(\n TConsensus[] calldata consensusAddrs\n ) external view returns (uint256[] memory selfStakings_) {\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\n return _getManySelfStakingsById(poolIds);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory selfStakings_) {\n return _getManySelfStakingsById(poolIds);\n }\n\n /**\n * @dev Query many self staking amount by list `poolIds`.\n */\n function _getManySelfStakingsById(address[] memory poolIds) internal view returns (uint256[] memory selfStakings_) {\n selfStakings_ = new uint256[](poolIds.length);\n for (uint i = 0; i < poolIds.length; ) {\n selfStakings_[i] = _poolDetail[poolIds[i]].stakingAmount;\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(TConsensus consensusAddr) external view override returns (uint256) {\n address poolId = __css2cid(consensusAddr);\n return _getStakingTotal(poolId);\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingTotals(\n TConsensus[] calldata consensusAddrs\n ) external view override returns (uint256[] memory stakingAmounts_) {\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\n return _getManyStakingTotalsById(poolIds);\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingTotalsById(\n address[] calldata poolIds\n ) external view override returns (uint256[] memory stakingAmounts_) {\n return _getManyStakingTotalsById(poolIds);\n }\n\n function _getManyStakingTotalsById(\n address[] memory poolIds\n ) internal view returns (uint256[] memory stakingAmounts_) {\n stakingAmounts_ = new uint256[](poolIds.length);\n for (uint i = 0; i < poolIds.length; ) {\n stakingAmounts_[i] = _getStakingTotal(poolIds[i]);\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _getStakingTotal(address poolId) internal view override returns (uint256) {\n return _poolDetail[poolId].stakingTotal;\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(TConsensus consensusAddr, address user) external view override returns (uint256) {\n address poolId = __css2cid(consensusAddr);\n return _getStakingAmount(poolId, user);\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingAmounts(\n TConsensus[] calldata consensusAddrs,\n address[] calldata userList\n ) external view override returns (uint256[] memory stakingAmounts) {\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\n return _getManyStakingAmountsById(poolIds, userList);\n }\n\n function getManyStakingAmountsById(\n address[] calldata poolIds,\n address[] calldata userList\n ) external view returns (uint256[] memory stakingAmounts) {\n return _getManyStakingAmountsById(poolIds, userList);\n }\n\n function _getManyStakingAmountsById(\n address[] memory poolIds,\n address[] memory userList\n ) internal view returns (uint256[] memory stakingAmounts) {\n if (poolIds.length != userList.length) revert ErrInvalidArrays();\n stakingAmounts = new uint256[](poolIds.length);\n for (uint i = 0; i < stakingAmounts.length; ) {\n stakingAmounts[i] = _getStakingAmount(poolIds[i], userList[i]);\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _getStakingAmount(address poolId, address user) internal view override returns (uint256) {\n return _poolDetail[poolId].delegatingAmount[user];\n }\n\n function __css2cid(TConsensus consensusAddr) internal view returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function cooldownSecsToUndelegate() external view returns (uint256) {\n return _cooldownSecsToUndelegate;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function waitingSecsToRevoke() external view returns (uint256) {\n return _waitingSecsToRevoke;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external override onlyAdmin {\n _setCooldownSecsToUndelegate(cooldownSecs);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setWaitingSecsToRevoke(uint256 secs) external override onlyAdmin {\n _setWaitingSecsToRevoke(secs);\n }\n\n /**\n * @dev Sets the minium number of seconds to undelegate.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function _setCooldownSecsToUndelegate(uint256 cooldownSecs) internal {\n _cooldownSecsToUndelegate = cooldownSecs;\n emit CooldownSecsToUndelegateUpdated(cooldownSecs);\n }\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function _setWaitingSecsToRevoke(uint256 secs) internal {\n _waitingSecsToRevoke = secs;\n emit WaitingSecsToRevokeUpdated(secs);\n }\n\n /**\n * @dev Changes the delegate amount.\n */\n function _changeDelegatingAmount(\n PoolDetail storage _pool,\n address delegator,\n uint256 newDelegatingAmount,\n uint256 newStakingTotal\n ) internal {\n _syncUserReward(_pool.pid, delegator, newDelegatingAmount);\n _pool.stakingTotal = newStakingTotal;\n _pool.delegatingAmount[delegator] = newDelegatingAmount;\n }\n}\n" + }, + "contracts/ronin/staking/CandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../interfaces/staking/ICandidateStaking.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\n /// @dev The minimum threshold for being a validator candidate.\n uint256 internal _minValidatorStakingAmount;\n\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _maxCommissionRate;\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _minCommissionRate;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] ______gap;\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function minValidatorStakingAmount() public view override returns (uint256) {\n return _minValidatorStakingAmount;\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function getCommissionRateRange() external view override returns (uint256, uint256) {\n return (_minCommissionRate, _maxCommissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setMinValidatorStakingAmount(uint256 threshold) external override onlyAdmin {\n _setMinValidatorStakingAmount(threshold);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external override onlyAdmin {\n _setCommissionRateRange(minRate, maxRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function applyValidatorCandidate(\n address candidateAdmin,\n TConsensus consensusAddr,\n address payable treasuryAddr,\n uint256 commissionRate,\n bytes calldata pubkey\n ) external payable override nonReentrant {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n if (commissionRate > _maxCommissionRate || commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n\n uint256 amount = msg.value;\n address payable poolAdmin = payable(msg.sender);\n address poolId = TConsensus.unwrap(consensusAddr);\n\n _applyValidatorCandidate({\n poolAdmin: poolAdmin,\n candidateAdmin: candidateAdmin,\n poolId: poolId,\n treasuryAddr: treasuryAddr,\n pubkey: pubkey,\n commissionRate: commissionRate,\n amount: amount\n });\n\n PoolDetail storage _pool = _poolDetail[poolId];\n _pool.__shadowedPoolAdmin = poolAdmin;\n _pool.pid = poolId;\n _adminOfActivePoolMapping[poolAdmin] = poolId;\n\n _stake(_poolDetail[poolId], poolAdmin, amount);\n emit PoolApproved(poolId, poolAdmin);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestUpdateCommissionRate(\n TConsensus consensusAddr,\n uint256 effectiveDaysOnwards,\n uint256 commissionRate\n )\n external\n override\n poolOfConsensusIsActive(consensusAddr)\n onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender)\n {\n if (commissionRate > _maxCommissionRate || commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestUpdateCommissionRate(\n __css2cid(consensusAddr),\n effectiveDaysOnwards,\n commissionRate\n );\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function execDeprecatePools(\n address[] calldata poolIds,\n uint256 newPeriod\n ) external override onlyContract(ContractType.VALIDATOR) {\n if (poolIds.length == 0) {\n return;\n }\n\n for (uint i = 0; i < poolIds.length; ) {\n address poolId = poolIds[i];\n PoolDetail storage _pool = _poolDetail[poolId];\n // Deactivate the pool admin in the active mapping.\n delete _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin];\n\n // Deduct and transfer the self staking amount to the pool admin.\n uint256 deductingAmount = _pool.stakingAmount;\n if (deductingAmount > 0) {\n _deductStakingAmount(_pool, deductingAmount);\n if (!_unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), deductingAmount, DEFAULT_ADDITION_GAS)) {\n emit StakingAmountTransferFailed(\n _pool.pid,\n _pool.__shadowedPoolAdmin,\n deductingAmount,\n address(this).balance\n );\n }\n }\n\n // Settle the unclaimed reward and transfer to the pool admin.\n uint256 lastRewardAmount = _claimReward(poolId, _pool.__shadowedPoolAdmin, newPeriod);\n if (lastRewardAmount > 0) {\n _unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), lastRewardAmount, DEFAULT_ADDITION_GAS);\n }\n\n unchecked {\n ++i;\n }\n }\n\n emit PoolsDeprecated(poolIds);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function stake(\n TConsensus consensusAddr\n ) external payable override noEmptyValue poolOfConsensusIsActive(consensusAddr) {\n address poolId = __css2cid(consensusAddr);\n _stake(_poolDetail[poolId], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function unstake(\n TConsensus consensusAddr,\n uint256 amount\n ) external override nonReentrant poolOfConsensusIsActive(consensusAddr) {\n if (amount == 0) revert ErrUnstakeZeroAmount();\n address requester = msg.sender;\n address poolId = __css2cid(consensusAddr);\n PoolDetail storage _pool = _poolDetail[poolId];\n uint256 remainAmount = _pool.stakingAmount - amount;\n if (remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\n\n _unstake(_pool, requester, amount);\n if (!_unsafeSendRONLimitGas(payable(requester), amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestRenounce(\n TConsensus consensusAddr\n )\n external\n override\n poolOfConsensusIsActive(consensusAddr)\n onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender)\n {\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestRenounceCandidate(\n __css2cid(consensusAddr),\n _waitingSecsToRevoke\n );\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestEmergencyExit(\n TConsensus consensusAddr\n )\n external\n override\n poolOfConsensusIsActive(consensusAddr)\n onlyPoolAdmin(_poolDetail[__css2cid(consensusAddr)], msg.sender)\n {\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execRequestEmergencyExit(\n __css2cid(consensusAddr),\n _waitingSecsToRevoke\n );\n }\n\n /**\n * @dev See `ICandidateStaking-applyValidatorCandidate`\n */\n function _applyValidatorCandidate(\n address payable poolAdmin,\n address candidateAdmin,\n address poolId,\n address payable treasuryAddr,\n bytes memory pubkey,\n uint256 commissionRate,\n uint256 amount\n ) internal {\n if (!_unsafeSendRONLimitGas(poolAdmin, 0, DEFAULT_ADDITION_GAS)) {\n revert ErrCannotInitTransferRON(poolAdmin, \"pool admin\");\n }\n if (!_unsafeSendRONLimitGas(treasuryAddr, 0, DEFAULT_ADDITION_GAS)) {\n revert ErrCannotInitTransferRON(treasuryAddr, \"treasury\");\n }\n if (amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\n if (poolAdmin != candidateAdmin || candidateAdmin != treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\n\n {\n address[] memory diffAddrs = new address[](3);\n diffAddrs[0] = poolAdmin;\n diffAddrs[1] = poolId;\n if (AddressArrayUtils.hasDuplicate(diffAddrs)) revert AddressArrayUtils.ErrDuplicated(msg.sig);\n }\n\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execApplyValidatorCandidate({\n candidateAdmin: candidateAdmin,\n cid: poolId,\n treasuryAddr: treasuryAddr,\n commissionRate: commissionRate\n });\n\n IProfile profileContract = IProfile(getContract(ContractType.PROFILE));\n profileContract.execApplyValidatorCandidate(candidateAdmin, poolId, treasuryAddr, pubkey);\n }\n\n /**\n * @dev See `ICandidateStaking-stake`\n */\n function _stake(\n PoolDetail storage _pool,\n address requester,\n uint256 amount\n ) internal onlyPoolAdmin(_pool, requester) {\n _pool.stakingAmount += amount;\n _changeDelegatingAmount(_pool, requester, _pool.stakingAmount, _pool.stakingTotal + amount);\n _pool.lastDelegatingTimestamp[requester] = block.timestamp;\n emit Staked(_pool.pid, amount);\n }\n\n /**\n * @dev See `ICandidateStaking-unstake`\n */\n function _unstake(\n PoolDetail storage _pool,\n address requester,\n uint256 amount\n ) internal onlyPoolAdmin(_pool, requester) {\n if (amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\n if (_pool.lastDelegatingTimestamp[requester] + _cooldownSecsToUndelegate > block.timestamp) {\n revert ErrUnstakeTooEarly();\n }\n\n _pool.stakingAmount -= amount;\n _changeDelegatingAmount(_pool, requester, _pool.stakingAmount, _pool.stakingTotal - amount);\n emit Unstaked(_pool.pid, amount);\n }\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Emits the event `Unstaked`.\n *\n * @return The actual deducted amount\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 amount) internal virtual returns (uint256);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function _setMinValidatorStakingAmount(uint256 threshold) internal {\n _minValidatorStakingAmount = threshold;\n emit MinValidatorStakingAmountUpdated(threshold);\n }\n\n /**\n * @dev Sets the max commission rate that a candidate can set.\n *\n * Emits the `MaxCommissionRateUpdated` event.\n *\n */\n function _setCommissionRateRange(uint256 minRate, uint256 maxRate) internal {\n if (maxRate > _MAX_PERCENTAGE || minRate > maxRate) revert ErrInvalidCommissionRate();\n _maxCommissionRate = maxRate;\n _minCommissionRate = minRate;\n emit CommissionRateRangeUpdated(minRate, maxRate);\n }\n}\n" + }, + "contracts/ronin/staking/DelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IDelegatorStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegate(TConsensus consensusAddr) external payable noEmptyValue poolOfConsensusIsActive(consensusAddr) {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n _delegate(_poolDetail[__css2cid(consensusAddr)], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function undelegate(TConsensus consensusAddr, uint256 amount) external nonReentrant {\n address payable delegator = payable(msg.sender);\n _undelegate(consensusAddr, _poolDetail[__css2cid(consensusAddr)], delegator, amount);\n if (!_sendRON(delegator, amount)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external nonReentrant {\n if (consensusAddrs.length == 0 || consensusAddrs.length != amounts.length) revert ErrInvalidArrays();\n\n address payable delegator = payable(msg.sender);\n uint256 total;\n\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\n for (uint i = 0; i < poolIds.length; ) {\n total += amounts[i];\n _undelegate(consensusAddrs[i], _poolDetail[poolIds[i]], delegator, amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n if (!_sendRON(delegator, total)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function redelegate(\n TConsensus consensusAddrSrc,\n TConsensus consensusAddrDst,\n uint256 amount\n ) external nonReentrant poolOfConsensusIsActive(consensusAddrDst) {\n address delegator = msg.sender;\n _undelegate(consensusAddrSrc, _poolDetail[__css2cid(consensusAddrSrc)], delegator, amount);\n _delegate(_poolDetail[__css2cid(consensusAddrDst)], delegator, amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function claimRewards(\n TConsensus[] calldata consensusAddrList\n ) external override nonReentrant returns (uint256 amount) {\n amount = _claimRewards(msg.sender, __css2cidBatch(consensusAddrList));\n _transferRON(payable(msg.sender), amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegateRewards(\n TConsensus[] calldata consensusAddrList,\n TConsensus consensusAddrDst\n ) external override nonReentrant poolOfConsensusIsActive(consensusAddrDst) returns (uint256 amount) {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n address[] memory poolIds = __css2cidBatch(consensusAddrList);\n address poolIdDst = __css2cid(consensusAddrDst);\n return _delegateRewards(msg.sender, poolIds, poolIdDst);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function getRewards(\n address user,\n TConsensus[] calldata consensusAddrs\n ) external view returns (uint256[] memory rewards_) {\n uint256 period = IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n rewards_ = new uint256[](consensusAddrs.length);\n\n address[] memory poolIds = __css2cidBatch(consensusAddrs);\n for (uint256 i = 0; i < consensusAddrs.length; ) {\n address poolId = poolIds[i];\n rewards_[i] = _getReward(poolId, user, period, _getStakingAmount(poolId, user));\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @dev Delegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n * Note: This function does not verify the `msg.value` with the amount.\n *\n */\n function _delegate(\n PoolDetail storage _pool,\n address delegator,\n uint256 amount\n ) internal anyExceptPoolAdmin(_pool, delegator) {\n _changeDelegatingAmount(_pool, delegator, _pool.delegatingAmount[delegator] + amount, _pool.stakingTotal + amount);\n _pool.lastDelegatingTimestamp[delegator] = block.timestamp;\n emit Delegated(delegator, _pool.pid, amount);\n }\n\n /**\n * @dev Undelegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n * - The amount is larger than 0.\n * - The delegating amount is larger than or equal to the undelegating amount.\n *\n * Emits the `Undelegated` event.\n *\n * Note: Consider transferring back the amount of RON after calling this function.\n *\n */\n function _undelegate(\n TConsensus consensusAddr,\n PoolDetail storage _pool,\n address delegator,\n uint256 amount\n ) private anyExceptPoolAdmin(_pool, delegator) {\n if (amount == 0) revert ErrUndelegateZeroAmount();\n if (_pool.delegatingAmount[delegator] < amount) revert ErrInsufficientDelegatingAmount();\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n if (\n validatorContract.isValidatorCandidate(consensusAddr) &&\n validatorContract.getCandidateInfo(consensusAddr).revokingTimestamp == 0 && // if candidate is not on renunciation\n _pool.lastDelegatingTimestamp[delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\n ) revert ErrUndelegateTooEarly();\n\n _changeDelegatingAmount(_pool, delegator, _pool.delegatingAmount[delegator] - amount, _pool.stakingTotal - amount);\n emit Undelegated(delegator, _pool.pid, amount);\n }\n\n /**\n * @dev Claims rewards from the pools `_poolAddrList`.\n * Note: This function does not transfer reward to user.\n */\n function _claimRewards(address user, address[] memory poolIds) internal returns (uint256 amount) {\n uint256 period = _currentPeriod();\n for (uint256 i = 0; i < poolIds.length; ) {\n amount += _claimReward(poolIds[i], user, period);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n */\n function _delegateRewards(\n address user,\n address[] memory poolIds,\n address poolIdDst\n ) internal returns (uint256 amount) {\n amount = _claimRewards(user, poolIds);\n _delegate(_poolDetail[poolIdDst], user, amount);\n }\n}\n" + }, + "contracts/ronin/staking/RewardCalculation.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IRewardPool.sol\";\nimport \"../../libraries/Math.sol\";\nimport { TPoolId } from \"../../udvts/Types.sol\";\n\n/**\n * @title RewardCalculation contract\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\n */\nabstract contract RewardCalculation is IRewardPool {\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\n /// @dev Mapping from the pool address => user address => the reward info of the user\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\n /// @dev Mapping from the pool address => reward pool fields\n mapping(address => PoolFields) private _stakingPool;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IRewardPool\n */\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256) {\n address poolId = TConsensus.unwrap(consensusAddr);\n return _getReward(poolId, user, _currentPeriod(), _getStakingAmount(poolId, user));\n }\n\n /**\n * @dev See {IRewardPool-getStakingAmount}\n */\n function _getStakingAmount(address poolId, address user) internal view virtual returns (uint256);\n\n /**\n * @dev See {IRewardPool-getStakingTotal}\n */\n function _getStakingTotal(address poolId) internal view virtual returns (uint256);\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function _getReward(\n address poolId,\n address user,\n uint256 latestPeriod,\n uint256 latestStakingAmount\n ) internal view returns (uint256) {\n UserRewardFields storage _reward = _userReward[poolId][user];\n\n if (_reward.lastPeriod == latestPeriod) {\n return _reward.debited;\n }\n\n uint256 aRps;\n uint256 lastPeriodReward;\n PoolFields storage _pool = _stakingPool[poolId];\n PeriodWrapper storage _wrappedArps = _accumulatedRps[poolId][_reward.lastPeriod];\n\n if (_wrappedArps.lastPeriod > 0) {\n // Calculates the last period reward if the aRps at the period is set\n aRps = _wrappedArps.inner;\n lastPeriodReward = _reward.lowestAmount * (aRps - _reward.aRps);\n } else {\n // Fallbacks to the previous aRps in case the aRps is not set\n aRps = _reward.aRps;\n }\n\n uint256 newPeriodsReward = latestStakingAmount * (_pool.aRps - aRps);\n return _reward.debited + (lastPeriodReward + newPeriodsReward) / 1e18;\n }\n\n /**\n * @dev Syncs the user reward.\n *\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\n *\n * Note: The method should be called whenever the user's staking amount changes.\n *\n */\n function _syncUserReward(address poolId, address user, uint256 newStakingAmount) internal {\n uint256 period = _currentPeriod();\n PoolFields storage _pool = _stakingPool[poolId];\n uint256 lastShares = _pool.shares.inner;\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < period) {\n _pool.shares = PeriodWrapper(_getStakingTotal(poolId), period);\n }\n\n UserRewardFields storage _reward = _userReward[poolId][user];\n uint256 currentStakingAmount = _getStakingAmount(poolId, user);\n uint256 debited = _getReward(poolId, user, period, currentStakingAmount);\n\n if (_reward.debited != debited) {\n _reward.debited = debited;\n emit UserRewardUpdated(poolId, user, debited);\n }\n\n _syncMinStakingAmount(_pool, _reward, period, newStakingAmount, currentStakingAmount);\n _reward.aRps = _pool.aRps;\n _reward.lastPeriod = period;\n\n if (_pool.shares.inner != lastShares) {\n emit PoolSharesUpdated(period, poolId, _pool.shares.inner);\n }\n }\n\n /**\n * @dev Syncs the minimum staking amount of an user in the current period.\n */\n function _syncMinStakingAmount(\n PoolFields storage _pool,\n UserRewardFields storage _reward,\n uint256 latestPeriod,\n uint256 newStakingAmount,\n uint256 currentStakingAmount\n ) internal {\n if (_reward.lastPeriod < latestPeriod) {\n _reward.lowestAmount = currentStakingAmount;\n }\n\n uint256 lowestAmount = Math.min(_reward.lowestAmount, newStakingAmount);\n uint256 diffAmount = _reward.lowestAmount - lowestAmount;\n if (diffAmount > 0) {\n _reward.lowestAmount = lowestAmount;\n if (_pool.shares.inner < diffAmount) revert ErrInvalidPoolShare();\n _pool.shares.inner -= diffAmount;\n }\n }\n\n /**\n * @dev Claims the settled reward for a specific user.\n *\n * @param lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\n *\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\n *\n * Note: This method should be called before transferring rewards for the user.\n *\n */\n function _claimReward(address poolId, address user, uint256 lastPeriod) internal returns (uint256 amount) {\n uint256 currentStakingAmount = _getStakingAmount(poolId, user);\n amount = _getReward(poolId, user, lastPeriod, currentStakingAmount);\n emit RewardClaimed(poolId, user, amount);\n\n UserRewardFields storage _reward = _userReward[poolId][user];\n _reward.debited = 0;\n _syncMinStakingAmount(_stakingPool[poolId], _reward, lastPeriod, currentStakingAmount, currentStakingAmount);\n _reward.lastPeriod = lastPeriod;\n _reward.aRps = _stakingPool[poolId].aRps;\n emit UserRewardUpdated(poolId, user, 0);\n }\n\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `poolIds`.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function _recordRewards(address[] memory poolIds, uint256[] calldata rewards, uint256 period) internal {\n if (poolIds.length != rewards.length) {\n emit PoolsUpdateFailed(period, poolIds, rewards);\n return;\n }\n\n uint256 rps;\n uint256 count;\n address poolId;\n uint256 stakingTotal;\n uint256[] memory aRps = new uint256[](poolIds.length);\n uint256[] memory shares = new uint256[](poolIds.length);\n address[] memory conflicted = new address[](poolIds.length);\n\n for (uint i = 0; i < poolIds.length; i++) {\n poolId = poolIds[i];\n PoolFields storage _pool = _stakingPool[poolId];\n stakingTotal = _getStakingTotal(poolId);\n\n if (_accumulatedRps[poolId][period].lastPeriod == period) {\n unchecked {\n conflicted[count++] = poolId;\n }\n continue;\n }\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < period) {\n _pool.shares = PeriodWrapper(stakingTotal, period);\n }\n\n // The rps is 0 if no one stakes for the pool\n rps = _pool.shares.inner == 0 ? 0 : (rewards[i] * 1e18) / _pool.shares.inner;\n aRps[i - count] = _pool.aRps += rps;\n _accumulatedRps[poolId][period] = PeriodWrapper(_pool.aRps, period);\n _pool.shares.inner = stakingTotal;\n shares[i - count] = _pool.shares.inner;\n poolIds[i - count] = poolId;\n }\n\n if (count > 0) {\n assembly {\n mstore(conflicted, count)\n mstore(poolIds, sub(mload(poolIds), count))\n }\n emit PoolsUpdateConflicted(period, conflicted);\n }\n\n if (poolIds.length > 0) {\n emit PoolsUpdated(period, poolIds, aRps, shares);\n }\n }\n\n /**\n * @dev Returns the current period.\n */\n function _currentPeriod() internal view virtual returns (uint256);\n}\n" + }, + "contracts/ronin/staking/Staking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./StakingCallback.sol\";\n\ncontract Staking is IStaking, StakingCallback, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n receive() external payable onlyContract(ContractType.VALIDATOR) {}\n\n fallback() external payable onlyContract(ContractType.VALIDATOR) {}\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __minValidatorStakingAmount,\n uint256 __maxCommissionRate,\n uint256 __cooldownSecsToUndelegate,\n uint256 __waitingSecsToRevoke\n ) external initializer {\n _setContract(ContractType.VALIDATOR, __validatorContract);\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\n _setCommissionRateRange(0, __maxCommissionRate);\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\n }\n\n /**\n * @dev Initializes the contract storage V2.\n */\n function initializeV2() external reinitializer(2) {\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\n delete ______deprecatedValidator;\n }\n\n /**\n * @dev Initializes the contract storage V3.\n */\n function initializeV3(address __profileContract) external reinitializer(3) {\n _setContract(ContractType.PROFILE, __profileContract);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execRecordRewards(\n address[] calldata poolIds,\n uint256[] calldata rewards,\n uint256 period\n ) external payable override onlyContract(ContractType.VALIDATOR) {\n _recordRewards(poolIds, rewards, period);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execDeductStakingAmount(\n address poolId,\n uint256 amount\n ) external override onlyContract(ContractType.VALIDATOR) returns (uint256 actualDeductingAmount_) {\n actualDeductingAmount_ = _deductStakingAmount(_poolDetail[poolId], amount);\n address payable validatorContractAddr = payable(msg.sender);\n if (!_unsafeSendRON(validatorContractAddr, actualDeductingAmount_)) {\n emit StakingAmountDeductFailed(poolId, validatorContractAddr, actualDeductingAmount_, address(this).balance);\n }\n }\n\n /**\n * @inheritdoc RewardCalculation\n */\n function _currentPeriod() internal view virtual override returns (uint256) {\n return IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod();\n }\n\n /**\n * @inheritdoc CandidateStaking\n */\n function _deductStakingAmount(\n PoolDetail storage _pool,\n uint256 amount\n ) internal override returns (uint256 actualDeductingAmount_) {\n actualDeductingAmount_ = Math.min(_pool.stakingAmount, amount);\n\n _pool.stakingAmount -= actualDeductingAmount_;\n _changeDelegatingAmount(\n _pool,\n _pool.__shadowedPoolAdmin,\n _pool.stakingAmount,\n Math.subNonNegative(_pool.stakingTotal, actualDeductingAmount_)\n );\n emit Unstaked(_pool.pid, actualDeductingAmount_);\n }\n}\n" + }, + "contracts/ronin/staking/StakingCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"../../interfaces/IProfile.sol\";\nimport \"../../interfaces/staking/IStakingCallback.sol\";\nimport \"./CandidateStaking.sol\";\nimport \"./DelegatorStaking.sol\";\n\npragma solidity ^0.8.9;\n\nabstract contract StakingCallback is CandidateStaking, DelegatorStaking, IStakingCallback {\n /**\n * @dev Requirements:\n * - Only Profile contract can call this method.\n */\n function execChangeAdminAddress(\n address poolAddr,\n address newAdminAddr\n ) external override onlyContract(ContractType.PROFILE) {\n PoolDetail storage _pool = _poolDetail[poolAddr];\n\n _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin] = address(0);\n _pool.__shadowedPoolAdmin = newAdminAddr;\n _adminOfActivePoolMapping[newAdminAddr] = poolAddr;\n }\n}\n" + }, + "contracts/ronin/validator/CandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport { HasStakingDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\nabstract contract CandidateManager is\n ICandidateManager,\n PercentageConsumer,\n GlobalConfigConsumer,\n HasContracts,\n HasStakingDeprecated\n{\n /// @dev Maximum number of validator candidate\n uint256 private _maxValidatorCandidate;\n\n /// @dev The array of candidate ids\n address[] internal _candidateIds;\n /// @dev Mapping from candidate id => bitwise negation of validator index in `_candidates`\n mapping(address => uint256) internal _candidateIndex;\n /// @dev Mapping from candidate id => their info\n mapping(address => ValidatorCandidate) internal _candidateInfo;\n\n /**\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\n * Value of 1 means the change gets affected at the beginning of the following day.\n **/\n uint256 internal _minEffectiveDaysOnwards;\n /// @dev Mapping from candidate consensus id => schedule commission change.\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ICandidateManager\n */\n function maxValidatorCandidate() public view override returns (uint256) {\n return _maxValidatorCandidate;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function minEffectiveDaysOnward() external view override returns (uint256) {\n return _minEffectiveDaysOnwards;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\n _setMaxValidatorCandidate(_number);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\n _setMinEffectiveDaysOnwards(_numOfDays);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isValidatorCandidate(TConsensus consensus) external view override returns (bool) {\n return _isValidatorCandidateById(__css2cid(consensus));\n }\n\n function _isValidatorCandidateById(address cid) internal view returns (bool) {\n return _candidateIndex[cid] != 0;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory list) {\n list = new ValidatorCandidate[](_candidateIds.length);\n for (uint i; i < list.length; ) {\n list[i] = _candidateInfo[_candidateIds[i]];\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfo(TConsensus consensus) external view override returns (ValidatorCandidate memory) {\n address validatorId = __css2cid(consensus);\n if (!_isValidatorCandidateById(validatorId)) revert ErrNonExistentCandidate();\n return _candidateInfo[validatorId];\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getValidatorCandidates() public view override returns (address[] memory) {\n return _candidateIds;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCommissionChangeSchedule(\n TConsensus consensus\n ) external view override returns (CommissionSchedule memory) {\n return _candidateCommissionChangeSchedule[__css2cid(consensus)];\n }\n\n /**\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\n * or the ones who requested to renounce their candidate role.\n *\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\n *\n */\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\n IStaking _staking = IStaking(getContract(ContractType.STAKING));\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\n uint256[] memory _selfStakings = _staking.getManySelfStakingsById(_candidateIds);\n\n uint256 _length = _candidateIds.length;\n uint256 _unsatisfiedCount;\n _unsatisfiedCandidates = new address[](_length);\n\n {\n uint256 _i;\n address cid;\n ValidatorCandidate storage _info;\n while (_i < _length) {\n cid = _candidateIds[_i];\n _info = _candidateInfo[cid];\n\n // Checks for under-balance status of candidates\n bool _hasTopupDeadline = _info.topupDeadline != 0;\n if (_selfStakings[_i] < _minStakingAmount) {\n // Updates deadline on the first time unsatisfied the staking amount condition\n if (!_hasTopupDeadline) {\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\n _info.topupDeadline = _topupDeadline;\n emit CandidateTopupDeadlineUpdated(cid, _topupDeadline);\n }\n } else if (_hasTopupDeadline) {\n // Removes the deadline if the staking amount condition is satisfied\n delete _info.topupDeadline;\n emit CandidateTopupDeadlineUpdated(cid, 0);\n }\n\n // Removes unsastisfied candidates\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\n _emergencyExitLockedFundReleased(cid);\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\n if (_revokingActivated || _topupDeadlineMissed) {\n _selfStakings[_i] = _selfStakings[--_length];\n unchecked {\n _unsatisfiedCandidates[_unsatisfiedCount++] = cid;\n }\n _removeCandidate(cid);\n continue;\n }\n\n // Checks for schedule of commission change and updates commission rate\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[cid].effectiveTimestamp;\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\n uint256 _commisionRate = _candidateCommissionChangeSchedule[cid].commissionRate;\n delete _candidateCommissionChangeSchedule[cid];\n _info.commissionRate = _commisionRate;\n emit CommissionRateUpdated(cid, _commisionRate);\n }\n\n unchecked {\n _i++;\n }\n }\n }\n\n assembly {\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\n }\n\n if (_unsatisfiedCount > 0) {\n emit CandidatesRevoked(_unsatisfiedCandidates);\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isCandidateAdmin(TConsensus consensusAddr, address admin) external view override returns (bool) {\n return _isCandidateAdminById(__css2cid(consensusAddr), admin);\n }\n\n function _isCandidateAdminById(address candidateId, address admin) internal view returns (bool) {\n return _candidateInfo[candidateId].__shadowedAdmin == admin;\n }\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\n _maxValidatorCandidate = _threshold;\n emit MaxValidatorCandidateUpdated(_threshold);\n }\n\n /**\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\n _minEffectiveDaysOnwards = _numOfDays;\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\n }\n\n /**\n * @dev Removes the candidate.\n */\n function _removeCandidate(address _addr) internal virtual {\n uint256 idx = _candidateIndex[_addr];\n if (idx == 0) {\n return;\n }\n\n delete _candidateInfo[_addr];\n delete _candidateIndex[_addr];\n delete _candidateCommissionChangeSchedule[_addr];\n\n address lastCid = _candidateIds[_candidateIds.length - 1];\n if (lastCid != _addr) {\n _candidateIndex[lastCid] = idx;\n _candidateIds[~idx] = lastCid;\n }\n\n _candidateIds.pop();\n }\n\n /**\n * @dev Sets timestamp to revoke a candidate.\n */\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 timestamp) internal {\n address cid = __css2cid(_candidate.__shadowedConsensus);\n if (!_isValidatorCandidateById(cid)) revert ErrNonExistentCandidate();\n _candidate.revokingTimestamp = timestamp;\n emit CandidateRevokingTimestampUpdated(cid, timestamp);\n }\n\n /**\n * @dev Returns a flag indicating whether the fund is unlocked.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\n\n /**\n * @dev Returns whether the validator id is a trusted org or not.\n */\n function _isTrustedOrg(address validatorId) internal virtual returns (bool);\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/CandidateManagerCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/ICandidateManagerCallback.sol\";\nimport \"./CandidateManager.sol\";\n\nabstract contract CandidateManagerCallback is ICandidateManagerCallback, CandidateManager {\n // //\n // ----------- Staking's Callbacks ----------- //\n // //\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execApplyValidatorCandidate(\n address candidateAdmin,\n address cid,\n address payable treasuryAddr,\n uint256 commissionRate\n ) external override onlyContract(ContractType.STAKING) {\n uint256 length = _candidateIds.length;\n if (length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\n if (_isValidatorCandidateById(cid)) revert ErrExistentCandidate();\n if (commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n\n for (uint i; i < length; ) {\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidateIds[i]];\n if (candidateAdmin == existentInfo.__shadowedAdmin) revert ErrExistentCandidateAdmin(candidateAdmin);\n if (treasuryAddr == existentInfo.__shadowedTreasury) revert ErrExistentTreasury(treasuryAddr);\n\n unchecked {\n ++i;\n }\n }\n\n _candidateIndex[cid] = ~length;\n _candidateIds.push(cid);\n\n ValidatorCandidate storage _info = _candidateInfo[cid];\n _info.__shadowedAdmin = candidateAdmin;\n _info.__shadowedConsensus = TConsensus.wrap(cid);\n _info.__shadowedTreasury = treasuryAddr;\n _info.commissionRate = commissionRate;\n emit CandidateGranted(cid, treasuryAddr, candidateAdmin);\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execRequestRenounceCandidate(\n address cid,\n uint256 secsLeft\n ) external override onlyContract(ContractType.STAKING) {\n if (_isTrustedOrg(cid)) revert ErrTrustedOrgCannotRenounce();\n\n ValidatorCandidate storage _info = _candidateInfo[cid];\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\n _setRevokingTimestamp(_info, block.timestamp + secsLeft);\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execRequestUpdateCommissionRate(\n address cid,\n uint256 effectiveDaysOnwards,\n uint256 commissionRate\n ) external override onlyContract(ContractType.STAKING) {\n if (_candidateCommissionChangeSchedule[cid].effectiveTimestamp != 0) {\n revert ErrAlreadyRequestedUpdatingCommissionRate();\n }\n if (commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n if (effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\n\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[cid];\n uint256 effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + effectiveDaysOnwards) * PERIOD_DURATION;\n _schedule.effectiveTimestamp = effectiveTimestamp;\n _schedule.commissionRate = commissionRate;\n\n emit CommissionRateUpdateScheduled(cid, effectiveTimestamp, commissionRate);\n }\n\n // //\n // ----------- Profile's Callbacks ----------- //\n // //\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execChangeConsensusAddress(\n address cid,\n TConsensus newConsensusAddr\n ) external override onlyContract(ContractType.PROFILE) {\n _candidateInfo[cid].__shadowedConsensus = newConsensusAddr;\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execChangeAdminAddress(address cid, address newAdmin) external onlyContract(ContractType.PROFILE) {\n _candidateInfo[cid].__shadowedAdmin = newAdmin;\n }\n\n /**\n * @inheritdoc ICandidateManagerCallback\n */\n function execChangeTreasuryAddress(\n address cid,\n address payable newTreasury\n ) external onlyContract(ContractType.PROFILE) {\n _candidateInfo[cid].__shadowedTreasury = newTreasury;\n }\n}\n" + }, + "contracts/ronin/validator/CoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"../../interfaces/IStakingVesting.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/IFastFinalityTracking.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"../../interfaces/validator/ICoinbaseExecution.sol\";\nimport \"../../libraries/EnumFlags.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasStakingVestingDeprecated, HasBridgeTrackingDeprecated, HasMaintenanceDeprecated, HasSlashIndicatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"../../precompile-usages/PCUSortValidators.sol\";\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport { EmergencyExit } from \"./EmergencyExit.sol\";\nimport { TPoolId } from \"../../udvts/Types.sol\";\nimport { ErrCallerMustBeCoinbase } from \"../../utils/CommonErrors.sol\";\n\nabstract contract CoinbaseExecution is\n ICoinbaseExecution,\n RONTransferHelper,\n PCUSortValidators,\n PCUPickValidatorSet,\n HasContracts,\n HasStakingVestingDeprecated,\n HasBridgeTrackingDeprecated,\n HasMaintenanceDeprecated,\n HasSlashIndicatorDeprecated,\n EmergencyExit\n{\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n modifier onlyCoinbase() {\n _requireCoinbase();\n _;\n }\n\n modifier whenEpochEnding() {\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\n _;\n }\n\n modifier oncePerEpoch() {\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\n _lastUpdatedBlock = block.number;\n _;\n }\n\n function _requireCoinbase() private view {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function submitBlockReward() external payable override onlyCoinbase {\n address id = __css2cid(TConsensus.wrap(msg.sender));\n\n bool requestForBlockProducer = _isBlockProducerById(id) &&\n !_isJailedById(id) &&\n !_miningRewardDeprecatedById(id, currentPeriod());\n\n (, uint256 blockProducerBonus, , uint256 fastFinalityRewardPercentage) = IStakingVesting(\n getContract(ContractType.STAKING_VESTING)\n ).requestBonus({ forBlockProducer: requestForBlockProducer, forBridgeOperator: false });\n\n // Deprecates reward for non-validator or slashed validator\n if (!requestForBlockProducer) {\n _totalDeprecatedReward += msg.value;\n emit BlockRewardDeprecated(id, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\n return;\n }\n\n emit BlockRewardSubmitted(id, msg.value, blockProducerBonus);\n\n uint256 period = currentPeriod();\n uint256 reward = msg.value + blockProducerBonus;\n uint256 rewardFastFinality = (reward * fastFinalityRewardPercentage) / _MAX_PERCENTAGE; // reward for fast finality\n uint256 rewardProducingBlock = reward - rewardFastFinality; // reward for producing blocks\n uint256 cutOffReward;\n\n // Add fast finality reward to total reward for current epoch, then split it later in the {wrapUpEpoch} method.\n _totalFastFinalityReward += rewardFastFinality;\n\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][period]) {\n (, , , uint256 cutOffPercentage) = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR))\n .getCreditScoreConfigs();\n cutOffReward = (rewardProducingBlock * cutOffPercentage) / _MAX_PERCENTAGE;\n _totalDeprecatedReward += cutOffReward;\n emit BlockRewardDeprecated(id, cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\n }\n\n rewardProducingBlock -= cutOffReward;\n (uint256 minRate, uint256 maxRate) = IStaking(getContract(ContractType.STAKING)).getCommissionRateRange();\n uint256 rate = Math.max(Math.min(_candidateInfo[id].commissionRate, maxRate), minRate);\n uint256 miningAmount = (rate * rewardProducingBlock) / _MAX_PERCENTAGE;\n _miningReward[id] += miningAmount;\n _delegatingReward[id] += (rewardProducingBlock - miningAmount);\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\n uint256 newPeriod = _computePeriod(block.timestamp);\n bool periodEnding = _isPeriodEnding(newPeriod);\n\n address[] memory currValidatorIds = getValidators();\n address[] memory revokedCandidateIds;\n uint256 epoch = epochOf(block.number);\n uint256 nextEpoch = epoch + 1;\n uint256 lastPeriod = currentPeriod();\n\n _syncFastFinalityReward(epoch, currValidatorIds);\n\n if (periodEnding) {\n (\n uint256 totalDelegatingReward,\n uint256[] memory delegatingRewards\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(lastPeriod, currValidatorIds);\n _settleAndTransferDelegatingRewards(lastPeriod, currValidatorIds, totalDelegatingReward, delegatingRewards);\n _tryRecycleLockedFundsFromEmergencyExits();\n _recycleDeprecatedRewards();\n\n ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR));\n slashIndicatorContract.execUpdateCreditScores(currValidatorIds, lastPeriod);\n (currValidatorIds, revokedCandidateIds) = _syncValidatorSet(newPeriod);\n if (revokedCandidateIds.length > 0) {\n slashIndicatorContract.execResetCreditScores(revokedCandidateIds);\n }\n _currentPeriodStartAtBlock = block.number + 1;\n }\n _revampRoles(newPeriod, nextEpoch, currValidatorIds);\n emit WrappedUpEpoch(lastPeriod, epoch, periodEnding);\n _periodOf[nextEpoch] = newPeriod;\n _lastUpdatedPeriod = newPeriod;\n }\n\n /**\n * @dev This method calculate and update reward of each `validators` accordingly their fast finality voting performance\n * in the `epoch`. The leftover reward is added to the {_totalDeprecatedReward} and is recycled later to the\n * {StakingVesting} contract.\n *\n * Requirements:\n * - This method is only called once each epoch.\n */\n function _syncFastFinalityReward(uint256 epoch, address[] memory validatorIds) private {\n uint256[] memory voteCounts = IFastFinalityTracking(getContract(ContractType.FAST_FINALITY_TRACKING))\n .getManyFinalityVoteCounts(epoch, validatorIds);\n uint256 divisor = _numberOfBlocksInEpoch * validatorIds.length;\n uint256 iReward;\n uint256 totalReward = _totalFastFinalityReward;\n uint256 totalDispensedReward = 0;\n\n for (uint i; i < validatorIds.length; ) {\n iReward = (totalReward * voteCounts[i]) / divisor;\n _fastFinalityReward[validatorIds[i]] += iReward;\n totalDispensedReward += iReward;\n unchecked {\n ++i;\n }\n }\n\n _totalDeprecatedReward += (totalReward - totalDispensedReward);\n delete _totalFastFinalityReward;\n }\n\n /**\n * @dev This loops over all current validators to:\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\n * - Update the total deprecated reward if the two previous conditions do not satisfy.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\n uint256 lastPeriod,\n address[] memory currValidatorIds\n ) private returns (uint256 totalDelegatingReward, uint256[] memory delegatingRewards) {\n address vId; // validator id\n address payable treasury;\n delegatingRewards = new uint256[](currValidatorIds.length);\n\n for (uint _i; _i < currValidatorIds.length; ) {\n vId = currValidatorIds[_i];\n treasury = _candidateInfo[vId].__shadowedTreasury;\n\n if (!_isJailedById(vId) && !_miningRewardDeprecatedById(vId, lastPeriod)) {\n totalDelegatingReward += _delegatingReward[vId];\n delegatingRewards[_i] = _delegatingReward[vId];\n _distributeMiningReward(vId, treasury);\n _distributeFastFinalityReward(vId, treasury);\n } else {\n _totalDeprecatedReward += _miningReward[vId] + _delegatingReward[vId] + _fastFinalityReward[vId];\n }\n\n delete _delegatingReward[vId];\n delete _miningReward[vId];\n delete _fastFinalityReward[vId];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\n *\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeMiningReward(address cid, address payable treasury) private {\n uint256 amount = _miningReward[cid];\n if (amount > 0) {\n if (_unsafeSendRONLimitGas(treasury, amount, DEFAULT_ADDITION_GAS)) {\n emit MiningRewardDistributed(cid, treasury, amount);\n return;\n }\n\n emit MiningRewardDistributionFailed(cid, treasury, amount, address(this).balance);\n }\n }\n\n function _distributeFastFinalityReward(address cid, address payable treasury) private {\n uint256 amount = _fastFinalityReward[cid];\n if (amount > 0) {\n if (_unsafeSendRONLimitGas(treasury, amount, DEFAULT_ADDITION_GAS)) {\n emit FastFinalityRewardDistributed(cid, treasury, amount);\n return;\n }\n\n emit FastFinalityRewardDistributionFailed(cid, treasury, amount, address(this).balance);\n }\n }\n\n /**\n * @dev Helper function to settle rewards for delegators of `currValidatorIds` at the end of each period,\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\n *\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _settleAndTransferDelegatingRewards(\n uint256 period,\n address[] memory currValidatorIds,\n uint256 totalDelegatingReward,\n uint256[] memory delegatingRewards\n ) private {\n IStaking _staking = IStaking(getContract(ContractType.STAKING));\n if (totalDelegatingReward > 0) {\n if (_unsafeSendRON(payable(address(_staking)), totalDelegatingReward)) {\n _staking.execRecordRewards(currValidatorIds, delegatingRewards, period);\n emit StakingRewardDistributed(totalDelegatingReward, currValidatorIds, delegatingRewards);\n return;\n }\n\n emit StakingRewardDistributionFailed(\n totalDelegatingReward,\n currValidatorIds,\n delegatingRewards,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\n * to the staking vesting contract\n *\n * Note: This method should be called once in the end of each period.\n */\n function _recycleDeprecatedRewards() private {\n uint256 withdrawAmount = _totalDeprecatedReward;\n\n if (withdrawAmount != 0) {\n address withdrawTarget = getContract(ContractType.STAKING_VESTING);\n\n delete _totalDeprecatedReward;\n\n (bool _success, ) = withdrawTarget.call{ value: withdrawAmount }(\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\n );\n\n if (_success) {\n emit DeprecatedRewardRecycled(withdrawTarget, withdrawAmount);\n } else {\n emit DeprecatedRewardRecycleFailed(withdrawTarget, withdrawAmount, address(this).balance);\n }\n }\n }\n\n /**\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncValidatorSet(\n uint256 newPeriod\n ) private returns (address[] memory newValidatorIds, address[] memory unsatisfiedCandidates) {\n unsatisfiedCandidates = _syncCandidateSet(newPeriod);\n uint256[] memory weights = IStaking(getContract(ContractType.STAKING)).getManyStakingTotalsById(_candidateIds);\n uint256[] memory trustedWeights = IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION))\n .getConsensusWeightsById(_candidateIds);\n uint256 newValidatorCount;\n (newValidatorIds, newValidatorCount) = _pcPickValidatorSet(\n _candidateIds,\n weights,\n trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n _setNewValidatorSet(newValidatorIds, newValidatorCount, newPeriod);\n }\n\n /**\n * @dev Private helper function helps writing the new validator set into the contract storage.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _setNewValidatorSet(\n address[] memory _newValidators,\n uint256 _newValidatorCount,\n uint256 _newPeriod\n ) private {\n // Remove exceeding validators in the current set\n for (uint256 _i = _newValidatorCount; _i < _validatorCount; ) {\n delete _validatorMap[_validatorIds[_i]];\n delete _validatorIds[_i];\n\n unchecked {\n ++_i;\n }\n }\n\n // Remove flag for all validator in the current set\n for (uint _i; _i < _newValidatorCount; ) {\n delete _validatorMap[_validatorIds[_i]];\n\n unchecked {\n ++_i;\n }\n }\n\n // Update new validator set and set flag correspondingly.\n for (uint256 _i; _i < _newValidatorCount; ) {\n address _newValidator = _newValidators[_i];\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\n _validatorIds[_i] = _newValidator;\n\n unchecked {\n ++_i;\n }\n }\n\n _validatorCount = _newValidatorCount;\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\n }\n\n /**\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\n *\n * Requirements:\n * - This method is called at the end of each epoch\n *\n * Emits the `BlockProducerSetUpdated` event.\n * Emits the `BridgeOperatorSetUpdated` event.\n *\n */\n function _revampRoles(uint256 _newPeriod, uint256 _nextEpoch, address[] memory currValidatorIds) private {\n bool[] memory _maintainedList = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedById(\n currValidatorIds,\n block.number + 1\n );\n\n for (uint _i; _i < currValidatorIds.length; ) {\n address validatorId = currValidatorIds[_i];\n bool emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[validatorId];\n bool isProducerBefore = _isBlockProducerById(validatorId);\n bool isProducerAfter = !(_isJailedAtBlockById(validatorId, block.number + 1) ||\n _maintainedList[_i] ||\n emergencyExitRequested);\n\n if (!isProducerBefore && isProducerAfter) {\n _validatorMap[validatorId] = _validatorMap[validatorId].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\n } else if (isProducerBefore && !isProducerAfter) {\n _validatorMap[validatorId] = _validatorMap[validatorId].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n unchecked {\n ++_i;\n }\n }\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\n }\n\n /**\n * @dev Override `CandidateManager-_isTrustedOrg`.\n */\n function _isTrustedOrg(address validatorId) internal view override returns (bool) {\n return\n IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getConsensusWeightById(\n validatorId\n ) > 0;\n }\n}\n" + }, + "contracts/ronin/validator/EmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../interfaces/validator/IEmergencyExit.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManagerCallback.sol\";\n\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManagerCallback, CommonStorage {\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExitLockedAmount() external view returns (uint256) {\n return _emergencyExitLockedAmount;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExpiryDuration() external view returns (uint256) {\n return _emergencyExpiryDuration;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execRequestEmergencyExit(address cid, uint256 secLeftToRevoke) external onlyContract(ContractType.STAKING) {\n EmergencyExitInfo storage _info = _exitInfo[cid];\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\n\n uint256 revokingTimestamp = block.timestamp + secLeftToRevoke;\n _setRevokingTimestamp(_candidateInfo[cid], revokingTimestamp);\n _emergencyExitJailedTimestamp[cid] = revokingTimestamp;\n\n uint256 deductedAmount = IStaking(msg.sender).execDeductStakingAmount(cid, _emergencyExitLockedAmount);\n if (deductedAmount > 0) {\n uint256 recyclingAt = block.timestamp + _emergencyExpiryDuration;\n _lockedConsensusList.push(cid);\n _info.lockedAmount = deductedAmount;\n _info.recyclingAt = recyclingAt;\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\n cid,\n _candidateInfo[cid].__shadowedTreasury,\n block.timestamp,\n recyclingAt\n );\n }\n emit EmergencyExitRequested(cid, deductedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExitLockedAmount(uint256 amount) external onlyAdmin {\n _setEmergencyExitLockedAmount(amount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExpiryDuration(uint256 duration) external onlyAdmin {\n _setEmergencyExpiryDuration(duration);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execReleaseLockedFundForEmergencyExitRequest(address cid, address payable recipient) external onlyAdmin {\n if (_exitInfo[cid].recyclingAt == 0) {\n revert ErrLockedFundReleaseInfoNotFound(cid);\n }\n\n uint256 length = _lockedConsensusList.length;\n uint256 index = length;\n\n for (uint i; i < length; ) {\n if (_lockedConsensusList[i] == cid) {\n index = i;\n break;\n }\n\n unchecked {\n ++i;\n }\n }\n\n // The locked amount might be recycled\n if (index == length) {\n revert ErrLockedFundMightBeRecycled(cid);\n }\n\n uint256 amount = _exitInfo[cid].lockedAmount;\n if (amount > 0) {\n delete _exitInfo[cid];\n if (length > 1) {\n _lockedConsensusList[index] = _lockedConsensusList[length - 1];\n }\n _lockedConsensusList.pop();\n\n _lockedFundReleased[cid] = true;\n if (_unsafeSendRONLimitGas(recipient, amount, DEFAULT_ADDITION_GAS)) {\n emit EmergencyExitLockedFundReleased(cid, recipient, amount);\n return;\n }\n\n emit EmergencyExitLockedFundReleasingFailed(cid, recipient, amount, address(this).balance);\n }\n }\n\n /**\n * @dev Tries to recycle the locked funds from emergency exit requests.\n */\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\n uint256 length = _lockedConsensusList.length;\n\n uint256 i;\n address addr;\n EmergencyExitInfo storage _info;\n\n while (i < length) {\n addr = _lockedConsensusList[i];\n _info = _exitInfo[addr];\n\n if (_info.recyclingAt <= block.timestamp) {\n _totalDeprecatedReward += _info.lockedAmount;\n\n delete _exitInfo[addr];\n if (--length > 0) {\n _lockedConsensusList[i] = _lockedConsensusList[length];\n }\n _lockedConsensusList.pop();\n continue;\n }\n\n unchecked {\n i++;\n }\n }\n }\n\n /**\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\n */\n function _emergencyExitLockedFundReleased(address cid) internal virtual override returns (bool) {\n return _lockedFundReleased[cid];\n }\n\n /**\n * @dev Override `CandidateManager-_removeCandidate`.\n */\n function _removeCandidate(address cid) internal override {\n delete _lockedFundReleased[cid];\n super._removeCandidate(cid);\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(\n TConsensus consensusAddr\n ) internal view virtual override(CandidateManager, CommonStorage) returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(\n TConsensus[] memory consensusAddrs\n ) internal view virtual override(CandidateManager, CommonStorage) returns (address[] memory);\n\n /**\n * @dev See `setEmergencyExitLockedAmount.\n */\n function _setEmergencyExitLockedAmount(uint256 amount) internal {\n _emergencyExitLockedAmount = amount;\n emit EmergencyExitLockedAmountUpdated(amount);\n }\n\n /**\n * @dev See `setEmergencyExpiryDuration`.\n */\n function _setEmergencyExpiryDuration(uint256 duration) internal {\n _emergencyExpiryDuration = duration;\n emit EmergencyExpiryDurationUpdated(duration);\n }\n}\n" + }, + "contracts/ronin/validator/RoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CoinbaseExecution.sol\";\nimport \"./SlashingExecution.sol\";\n\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\n constructor() {\n _disableInitializers();\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __slashIndicatorContract,\n address __stakingContract,\n address __stakingVestingContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address /* __bridgeTrackingContract */,\n uint256 __maxValidatorNumber,\n uint256 __maxValidatorCandidate,\n uint256 __maxPrioritizedValidatorNumber,\n uint256 __minEffectiveDaysOnwards,\n uint256 __numberOfBlocksInEpoch,\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\n uint256[2] calldata __emergencyExitConfigs\n ) external initializer {\n _setContract(ContractType.SLASH_INDICATOR, __slashIndicatorContract);\n _setContract(ContractType.STAKING, __stakingContract);\n _setContract(ContractType.STAKING_VESTING, __stakingVestingContract);\n _setContract(ContractType.MAINTENANCE, __maintenanceContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract);\n\n _setMaxValidatorNumber(__maxValidatorNumber);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n }\n\n function initializeV2() external reinitializer(2) {\n _setContract(ContractType.STAKING, ______deprecatedStakingContract);\n _setContract(ContractType.MAINTENANCE, ______deprecatedMaintenance);\n _setContract(ContractType.SLASH_INDICATOR, ______deprecatedSlashIndicator);\n _setContract(ContractType.STAKING_VESTING, ______deprecatedStakingVesting);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ______deprecatedTrustedOrg);\n\n delete ______deprecatedStakingContract;\n delete ______deprecatedMaintenance;\n delete ______deprecatedSlashIndicator;\n delete ______deprecatedStakingVesting;\n delete ______deprecatedBridgeTracking;\n delete ______deprecatedTrustedOrg;\n }\n\n function initializeV3(address fastFinalityTrackingContract) external reinitializer(3) {\n _setContract(ContractType.FAST_FINALITY_TRACKING, fastFinalityTrackingContract);\n }\n\n function initializeV4(address profileContract) external reinitializer(4) {\n _setContract(ContractType.PROFILE, profileContract);\n }\n\n /**\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\n * deducting amount on slashing).\n */\n function _fallback() internal view {\n if (msg.sender != getContract(ContractType.STAKING_VESTING) && msg.sender != getContract(ContractType.STAKING)) {\n revert ErrUnauthorizedReceiveRON();\n }\n }\n\n /**\n * @dev Convert consensus address to corresponding id from the Profile contract.\n */\n function __css2cid(TConsensus consensusAddr) internal view override(EmergencyExit, CommonStorage) returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n /**\n * @dev Convert many consensus addresses to corresponding ids from the Profile contract.\n */\n function __css2cidBatch(\n TConsensus[] memory consensusAddrs\n ) internal view override(EmergencyExit, CommonStorage) returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n}\n" + }, + "contracts/ronin/validator/SlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../interfaces/validator/ISlashingExecution.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasSlashIndicatorDeprecated, HasStakingDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\n\nabstract contract SlashingExecution is\n ISlashingExecution,\n HasContracts,\n HasSlashIndicatorDeprecated,\n HasStakingDeprecated,\n CommonStorage\n{\n /**\n * @inheritdoc ISlashingExecution\n */\n function execSlash(\n address validatorId,\n uint256 newJailedUntil,\n uint256 slashAmount,\n bool cannotBailout\n ) external override onlyContract(ContractType.SLASH_INDICATOR) {\n uint256 period = currentPeriod();\n _miningRewardDeprecatedAtPeriod[validatorId][period] = true;\n\n _totalDeprecatedReward += _miningReward[validatorId] + _delegatingReward[validatorId];\n\n delete _miningReward[validatorId];\n delete _delegatingReward[validatorId];\n\n _blockProducerJailedBlock[validatorId] = Math.max(newJailedUntil, _blockProducerJailedBlock[validatorId]);\n\n if (slashAmount > 0) {\n uint256 _actualAmount = IStaking(getContract(ContractType.STAKING)).execDeductStakingAmount(\n validatorId,\n slashAmount\n );\n _totalDeprecatedReward += _actualAmount;\n }\n\n if (cannotBailout) {\n _cannotBailoutUntilBlock[validatorId] = Math.max(newJailedUntil, _cannotBailoutUntilBlock[validatorId]);\n }\n\n emit ValidatorPunished(validatorId, period, _blockProducerJailedBlock[validatorId], slashAmount, true, false);\n }\n\n /**\n * @inheritdoc ISlashingExecution\n */\n function execBailOut(\n address validatorId,\n uint256 period\n ) external override onlyContract(ContractType.SLASH_INDICATOR) {\n if (block.number <= _cannotBailoutUntilBlock[validatorId]) revert ErrCannotBailout(validatorId);\n\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\n // removed previously in the `slash` function.\n _miningRewardBailoutCutOffAtPeriod[validatorId][period] = true;\n _miningRewardDeprecatedAtPeriod[validatorId][period] = false;\n _blockProducerJailedBlock[validatorId] = block.number - 1;\n\n emit ValidatorUnjailed(validatorId, period);\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/CommonStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/ICommonInfo.sol\";\nimport \"./JailingStorage.sol\";\nimport \"./TimingStorage.sol\";\nimport \"./ValidatorInfoStorageV2.sol\";\n\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorageV2 {\n /// @dev Mapping from consensus address => pending reward from producing block\n mapping(address => uint256) internal _miningReward;\n /// @dev Mapping from consensus address => pending reward from delegating\n mapping(address => uint256) internal _delegatingReward;\n\n /// @dev The total reward for fast finality\n uint256 internal _totalFastFinalityReward;\n /// @dev Mapping from consensus address => pending reward for fast finality\n mapping(address => uint256) internal _fastFinalityReward;\n\n /// @dev The deprecated reward that has not been withdrawn by admin\n uint256 internal _totalDeprecatedReward;\n\n /// @dev The amount of RON to lock from a consensus address.\n uint256 internal _emergencyExitLockedAmount;\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\n uint256 internal _emergencyExpiryDuration;\n /// @dev The address list of consensus addresses that being locked fund.\n address[] internal _lockedConsensusList;\n /// @dev Mapping from consensus => request exist info\n mapping(address => EmergencyExitInfo) internal _exitInfo;\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\n mapping(address => bool) internal _lockedFundReleased;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[44] private ______gap;\n\n /**\n * @inheritdoc ICommonInfo\n */\n function getEmergencyExitInfo(TConsensus consensus) external view override returns (EmergencyExitInfo memory _info) {\n _info = _exitInfo[__css2cid(consensus)];\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\n }\n\n /**\n * @inheritdoc ICommonInfo\n */\n function totalDeprecatedReward() external view override returns (uint256) {\n return _totalDeprecatedReward;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(\n uint256 _block\n ) public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.epochOf(_block);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.currentPeriod();\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(\n TConsensus consensusAddr\n ) internal view virtual override(JailingStorage, ValidatorInfoStorageV2) returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(\n TConsensus[] memory consensusAddrs\n ) internal view virtual override(JailingStorage, ValidatorInfoStorageV2) returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/JailingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/IJailingInfo.sol\";\n\nabstract contract JailingStorage is IJailingInfo {\n /// @dev Mapping from candidate id => period number => block producer has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\n /// @dev Mapping from candidate id => period number => whether the block producer get cut off reward, due to bailout.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\n /// @dev Mapping from candidate id => period number => block operator has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal ______deprecatedBridgeRewardDeprecatedAtPeriod;\n\n /// @dev Mapping from candidate id => the last block that the block producer is jailed.\n mapping(address => uint256) internal _blockProducerJailedBlock;\n /// @dev Mapping from candidate id => the last timestamp that the bridge operator is jailed.\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\n /// @dev Mapping from candidate id => the last block that the block producer cannot bailout.\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailed(TConsensus consensus) external view override returns (bool) {\n address candidateId = __css2cid(consensus);\n return _isJailedAtBlockById(candidateId, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view override returns (bool) {\n address candidateId = __css2cid(addr);\n return _isJailedAtBlockById(candidateId, blockNum);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeft(\n TConsensus consensus\n ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {\n return _getJailedTimeLeftAtBlockById(__css2cid(consensus), block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeftAtBlock(\n TConsensus consensus,\n uint256 _blockNum\n ) external view override returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {\n return _getJailedTimeLeftAtBlockById(__css2cid(consensus), _blockNum);\n }\n\n function _getJailedTimeLeftAtBlockById(\n address candidateId,\n uint256 blockNum\n ) internal view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_) {\n uint256 jailedBlock = _blockProducerJailedBlock[candidateId];\n if (jailedBlock < blockNum) {\n return (false, 0, 0);\n }\n\n isJailed_ = true;\n blockLeft_ = jailedBlock - blockNum + 1;\n epochLeft_ = epochOf(jailedBlock) - epochOf(blockNum) + 1;\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkManyJailed(TConsensus[] calldata consensusList) external view override returns (bool[] memory) {\n return _checkManyJailedById(__css2cidBatch(consensusList));\n }\n\n function checkManyJailedById(address[] calldata candidateIds) external view override returns (bool[] memory) {\n return _checkManyJailedById(candidateIds);\n }\n\n function _checkManyJailedById(address[] memory candidateIds) internal view returns (bool[] memory result) {\n result = new bool[](candidateIds.length);\n for (uint256 i; i < candidateIds.length; ) {\n result[i] = _isJailedById(candidateIds[i]);\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecated(TConsensus consensus) external view override returns (bool) {\n uint256 period = currentPeriod();\n return _miningRewardDeprecatedById(__css2cid(consensus), period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecatedAtPeriod(\n TConsensus consensus,\n uint256 period\n ) external view override returns (bool) {\n return _miningRewardDeprecatedById(__css2cid(consensus), period);\n }\n\n /**\n * @dev See `ITimingInfo-epochOf`\n */\n function epochOf(uint256 _block) public view virtual returns (uint256);\n\n /**\n * @dev See `ITimingInfo-currentPeriod`\n */\n function currentPeriod() public view virtual returns (uint256);\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\n */\n function _isJailedById(address validatorId) internal view returns (bool) {\n return _isJailedAtBlockById(validatorId, block.number);\n }\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\n */\n function _isJailedAtBlockById(address validatorId, uint256 blockNum) internal view returns (bool) {\n return blockNum <= _blockProducerJailedBlock[validatorId];\n }\n\n /**\n * @dev Returns whether the block producer has no pending reward in that period.\n */\n function _miningRewardDeprecatedById(address validatorId, uint256 period) internal view returns (bool) {\n return _miningRewardDeprecatedAtPeriod[validatorId][period];\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/TimingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../../interfaces/validator/info-fragments/ITimingInfo.sol\";\n\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\n /// @dev The number of blocks in a epoch\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev The last updated block\n uint256 internal _lastUpdatedBlock;\n /// @dev The last updated period\n uint256 internal _lastUpdatedPeriod;\n /// @dev The starting block of the last updated period\n uint256 internal _currentPeriodStartAtBlock;\n\n /// @dev Mapping from epoch index => period index\n mapping(uint256 => uint256) internal _periodOf;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @inheritdoc ITimingInfo\n */\n function getLastUpdatedBlock() external view override returns (uint256) {\n return _lastUpdatedBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\n return _block / _numberOfBlocksInEpoch + 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function isPeriodEnding() external view override returns (bool) {\n return _isPeriodEnding(_computePeriod(block.timestamp));\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override returns (uint256) {\n return _lastUpdatedPeriod;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriodStartAtBlock() public view override returns (uint256) {\n return _currentPeriodStartAtBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\n return _numberOfBlocksInEpoch;\n }\n\n /**\n * @dev See `ITimingInfo-isPeriodEnding`\n */\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\n return _newPeriod > _lastUpdatedPeriod;\n }\n\n /**\n * @dev Returns the calculated period.\n */\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\n return _timestamp / PERIOD_DURATION;\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/ValidatorInfoStorageV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport { HasTrustedOrgDeprecated } from \"../../../utils/DeprecatedSlots.sol\";\nimport \"../../../extensions/collections/HasContracts.sol\";\nimport \"../../../interfaces/validator/info-fragments/IValidatorInfoV2.sol\";\nimport \"../../../interfaces/IProfile.sol\";\nimport { TConsensus } from \"../../../udvts/Types.sol\";\n\nabstract contract ValidatorInfoStorageV2 is IValidatorInfoV2, HasContracts, HasTrustedOrgDeprecated {\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev The maximum number of validator.\n uint256 internal _maxValidatorNumber;\n\n /// @dev The total of validators\n uint256 internal _validatorCount;\n /// @dev Mapping from validator index => validator id address\n mapping(uint256 => address) internal _validatorIds;\n /// @dev Mapping from validator id => flag indicating the validator ability: producing block, operating bridge\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\n /// @dev The number of slot that is reserved for prioritized validators\n uint256 internal _maxPrioritizedValidatorNumber;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n function validatorCount() external view returns (uint256) {\n return _validatorCount;\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function getValidators() public view override returns (address[] memory validatorList_) {\n validatorList_ = new address[](_validatorCount);\n address iValidator;\n for (uint i; i < validatorList_.length; ) {\n iValidator = _validatorIds[i];\n validatorList_[i] = iValidator;\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function getBlockProducers() public view override returns (address[] memory result) {\n result = new address[](_validatorCount);\n uint256 count = 0;\n for (uint i; i < result.length; ) {\n address validatorId = _validatorIds[i];\n if (_isBlockProducerById(validatorId)) {\n result[count++] = validatorId;\n }\n\n unchecked {\n ++i;\n }\n }\n\n assembly {\n mstore(result, count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function isBlockProducer(TConsensus consensusAddr) public view override returns (bool) {\n return _isBlockProducerById(__css2cid(consensusAddr));\n }\n\n function _isBlockProducerById(address id) internal view returns (bool) {\n return _validatorMap[id].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function totalBlockProducer() external view returns (uint256 total) {\n unchecked {\n for (uint i; i < _validatorCount; i++) {\n if (_isBlockProducerById(_validatorIds[i])) {\n total++;\n }\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\n return _maxValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\n return _maxPrioritizedValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\n _setMaxValidatorNumber(_max);\n }\n\n /**\n * @inheritdoc IValidatorInfoV2\n */\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\n _setMaxPrioritizedValidatorNumber(_number);\n }\n\n /**\n * @dev See `IValidatorInfoV2-setMaxValidatorNumber`\n */\n function _setMaxValidatorNumber(uint256 _number) internal {\n _maxValidatorNumber = _number;\n emit MaxValidatorNumberUpdated(_number);\n }\n\n /**\n * @dev See `IValidatorInfoV2-setMaxPrioritizedValidatorNumber`\n */\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\n _maxPrioritizedValidatorNumber = _number;\n emit MaxPrioritizedValidatorNumberUpdated(_number);\n }\n\n /// @dev See {RoninValidatorSet-__css2cid}\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n /// @dev See {RoninValidatorSet-__css2cidBatch}\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n}\n" + }, + "contracts/types/operations/LibTUint256Slot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { TUint256Slot } from \"../Types.sol\";\n\n/**\n * @title LibTUint256Slot\n * @dev Library for handling unsigned 256-bit integers.\n */\nlibrary LibTUint256Slot {\n /// @dev value is equal to bytes4(keccak256(\"Panic(uint256)\"))\n /// @dev see: https://github.com/foundry-rs/forge-std/blob/master/src/StdError.sol\n uint256 private constant PANIC_ERROR_SIGNATURE = 0x4e487b71;\n /// @dev error code for {Arithmetic over/underflow} error\n uint256 private constant ARITHMETIC_ERROR_CODE = 0x11;\n /// @dev error code for {Division or modulo by 0} error\n uint256 private constant DIVISION_ERROR_CODE = 0x12;\n\n /**\n * @dev Loads the value of the TUint256Slot variable.\n * @param self The TUint256Slot variable.\n * @return val The loaded value.\n */\n function load(TUint256Slot self) internal view returns (uint256 val) {\n assembly {\n val := sload(self)\n }\n }\n\n /**\n * @dev Stores a value into the TUint256Slot variable.\n * @param self The TUint256Slot variable.\n * @param other The value to be stored.\n */\n function store(TUint256Slot self, uint256 other) internal {\n assembly {\n sstore(self, other)\n }\n }\n\n /**\n * @dev Multiplies the TUint256Slot variable by a given value.\n * @param self The TUint256Slot variable.\n * @param other The value to multiply by.\n * @return res The resulting value after multiplication.\n */\n function mul(TUint256Slot self, uint256 other) internal view returns (uint256 res) {\n assembly {\n let storedVal := sload(self)\n if iszero(iszero(storedVal)) {\n res := mul(storedVal, other)\n\n // Overflow check\n if iszero(eq(other, div(res, storedVal))) {\n // Store 4 bytes the function selector of Panic(uint256)\n // Equivalent to revert Panic(uint256)\n mstore(0x00, PANIC_ERROR_SIGNATURE)\n // Store 4 bytes of division error code in the next slot\n mstore(0x20, ARITHMETIC_ERROR_CODE)\n // Revert 36 bytes of error starting from 0x1c\n revert(0x1c, 0x24)\n }\n }\n }\n }\n\n /**\n * @dev Divides the TUint256Slot variable by a given value.\n * @param self The TUint256Slot variable.\n * @param other The value to divide by.\n * @return res The resulting value after division.\n */\n function div(TUint256Slot self, uint256 other) internal view returns (uint256 res) {\n assembly {\n let storedVal := sload(self)\n // revert if divide by zero\n if iszero(other) {\n // Store 4 bytes the function selector of Panic(uint256)\n // Equivalent to revert Panic(uint256)\n mstore(0x00, PANIC_ERROR_SIGNATURE)\n // Store 4 bytes of division error code in the next slot\n mstore(0x20, DIVISION_ERROR_CODE)\n // Revert 36 bytes of error starting from 0x1c\n revert(0x1c, 0x24)\n }\n res := div(storedVal, other)\n }\n }\n\n /**\n * @dev Subtracts a given value from the TUint256Slot variable.\n * @param self The TUint256Slot variable.\n * @param other The value to subtract.\n * @return res The resulting value after subtraction.\n */\n function sub(TUint256Slot self, uint256 other) internal view returns (uint256 res) {\n assembly {\n let storedVal := sload(self)\n\n // Underflow check\n if lt(storedVal, other) {\n // Store 4 bytes the function selector of Panic(uint256)\n // Equivalent to revert Panic(uint256)\n mstore(0x00, PANIC_ERROR_SIGNATURE)\n // Store 4 bytes of division error code in the next slot\n mstore(0x20, ARITHMETIC_ERROR_CODE)\n // Revert 36 bytes of error starting from 0x1c\n revert(0x1c, 0x24)\n }\n\n res := sub(storedVal, other)\n }\n }\n\n /**\n * @dev Adds a given value to the TUint256Slot variable.\n * @param self The TUint256Slot variable.\n * @param other The value to add.\n * @return res The resulting value after addition.\n */\n function add(TUint256Slot self, uint256 other) internal view returns (uint256 res) {\n assembly {\n let storedVal := sload(self)\n res := add(storedVal, other)\n\n // Overflow check\n if lt(res, other) {\n // Store 4 bytes the function selector of Panic(uint256)\n // Equivalent to revert Panic(uint256)\n mstore(0x00, PANIC_ERROR_SIGNATURE)\n // Store 4 bytes of division error code in the next slot\n mstore(0x20, ARITHMETIC_ERROR_CODE)\n // Revert 36 bytes of error starting from 0x1c\n revert(0x1c, 0x24)\n }\n }\n }\n\n /**\n * @dev Increments the TUint256Slot variable by 1 and returns the new value.\n * @param self The TUint256Slot variable.\n * @return res The resulting value after incrementing.\n */\n function preIncrement(TUint256Slot self) internal returns (uint256 res) {\n res = addAssign(self, 1);\n }\n\n /**\n * @dev Increments the TUint256Slot variable by 1 and returns the original value.\n * @param self The TUint256Slot variable.\n * @return res The original value before incrementing.\n */\n function postIncrement(TUint256Slot self) internal returns (uint256 res) {\n res = load(self);\n store(self, res + 1);\n }\n\n /**\n * @dev Decrements the TUint256Slot variable by 1 and returns the new value.\n * @param self The TUint256Slot variable.\n * @return res The resulting value after decrementing.\n */\n function preDecrement(TUint256Slot self) internal returns (uint256 res) {\n res = subAssign(self, 1);\n }\n\n /**\n * @dev Decrements the TUint256Slot variable by 1 and returns the new value.\n * @param self The TUint256Slot variable.\n * @return res The resulting value before decrementing.\n */\n function postDecrement(TUint256Slot self) internal returns (uint256 res) {\n res = load(self);\n store(self, res - 1);\n }\n\n /**\n * @dev Adds a given value to the TUint256Slot variable and stores the result.\n * @param self The TUint256Slot variable.\n * @param other The value to add.\n * @return res The resulting value after addition and storage.\n */\n function addAssign(TUint256Slot self, uint256 other) internal returns (uint256 res) {\n store(self, res = add(self, other));\n }\n\n /**\n * @dev Subtracts a given value from the TUint256Slot variable and stores the result.\n * @param self The TUint256Slot variable.\n * @param other The value to subtract.\n * @return res The resulting value after subtraction and storage.\n */\n function subAssign(TUint256Slot self, uint256 other) internal returns (uint256 res) {\n store(self, res = sub(self, other));\n }\n}\n" + }, + "contracts/types/Types.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { LibTUint256Slot } from \"./operations/LibTUint256Slot.sol\";\n\ntype TUint256Slot is bytes32;\n\nusing {\n LibTUint256Slot.add,\n LibTUint256Slot.sub,\n LibTUint256Slot.mul,\n LibTUint256Slot.div,\n LibTUint256Slot.load,\n LibTUint256Slot.store,\n LibTUint256Slot.addAssign,\n LibTUint256Slot.subAssign,\n LibTUint256Slot.preDecrement,\n LibTUint256Slot.postDecrement,\n LibTUint256Slot.preIncrement,\n LibTUint256Slot.postIncrement\n} for TUint256Slot global;\n" + }, + "contracts/udvts/Types.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ntype TPoolId is address;\ntype TConsensus is address;\n\nusing { TPoolIdEq as == } for TPoolId global;\nusing { TConsensusEq as == } for TConsensus global;\n\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\n}\n\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\n}\n" + }, + "contracts/utils/CommonErrors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { ContractType } from \"./ContractType.sol\";\nimport { RoleAccess } from \"./RoleAccess.sol\";\n\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\n\n/**\n * @dev Error raised when a bridge operator update operation fails.\n * @param bridgeOperator The address of the bridge operator that failed to update.\n */\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\n\n/**\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\n */\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\n\n/**\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\n */\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\n\n/**\n * @dev The error indicating an unsupported interface.\n * @param interfaceId The bytes4 interface identifier that is not supported.\n * @param addr The address where the unsupported interface was encountered.\n */\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\n\n/**\n * @dev Error thrown when the return data from a callback function is invalid.\n * @param callbackFnSig The signature of the callback function that returned invalid data.\n * @param register The address of the register where the callback function was invoked.\n * @param returnData The invalid return data received from the callback function.\n */\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\n\n/**\n * @dev Error of set to non-contract.\n */\nerror ErrZeroCodeContract(address addr);\n\n/**\n * @dev Error indicating that arguments are invalid.\n */\nerror ErrInvalidArguments(bytes4 msgSig);\n\n/**\n * @dev Error indicating that given address is null when it should not.\n */\nerror ErrZeroAddress(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\n */\nerror ErrInvalidThreshold(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a function can only be called by the contract itself.\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\n */\nerror ErrOnlySelfCall(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\n * @param expectedRole The role required to perform the function.\n */\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\n */\nerror ErrUnauthorizedCall(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4).\n * @param expectedContractType The contract type required to perform the function.\n * @param actual The actual address that called to the function.\n */\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\n\n/**\n * @dev Error indicating that an array is empty when it should contain elements.\n */\nerror ErrEmptyArray();\n\n/**\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\n * @param msgSig The function signature (bytes4) that has a length mismatch.\n */\nerror ErrLengthMismatch(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a proxy call to an external contract has failed.\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\n */\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\n\n/**\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\n */\nerror ErrCallPrecompiled(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a native token transfer has failed.\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\n */\nerror ErrNativeTransferFailed(bytes4 msgSig);\n\n/**\n * @dev Error indicating that an order is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\n */\nerror ErrInvalidOrder(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the chain ID is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\n * @param actual Current chain ID that executing function.\n * @param expected Expected chain ID required for the tx to success.\n */\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\n\n/**\n * @dev Error indicating that a vote type is not supported.\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\n */\nerror ErrUnsupportedVoteType(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the proposal nonce is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\n */\nerror ErrInvalidProposalNonce(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a voter has already voted.\n * @param voter The address of the voter who has already voted.\n */\nerror ErrAlreadyVoted(address voter);\n\n/**\n * @dev Error indicating that a signature is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\n */\nerror ErrInvalidSignatures(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a relay call has failed.\n * @param msgSig The function signature (bytes4) of the relay call that failed.\n */\nerror ErrRelayFailed(bytes4 msgSig);\n/**\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\n */\nerror ErrInvalidVoteWeight(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a query was made for an outdated bridge operator set.\n */\nerror ErrQueryForOutdatedBridgeOperatorSet();\n\n/**\n * @dev Error indicating that a request is invalid.\n */\nerror ErrInvalidRequest();\n\n/**\n * @dev Error indicating that a token standard is invalid.\n */\nerror ErrInvalidTokenStandard();\n\n/**\n * @dev Error indicating that a token is not supported.\n */\nerror ErrUnsupportedToken();\n\n/**\n * @dev Error indicating that a receipt kind is invalid.\n */\nerror ErrInvalidReceiptKind();\n\n/**\n * @dev Error indicating that a receipt is invalid.\n */\nerror ErrInvalidReceipt();\n\n/**\n * @dev Error indicating that an address is not payable.\n */\nerror ErrNonpayableAddress(address);\n\n/**\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\n */\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\n\n/**\n * @dev Error thrown when an invalid vote hash is provided.\n */\nerror ErrInvalidVoteHash();\n\n/**\n * @dev Error thrown when querying for an empty vote.\n */\nerror ErrQueryForEmptyVote();\n\n/**\n * @dev Error thrown when querying for an expired vote.\n */\nerror ErrQueryForExpiredVote();\n\n/**\n * @dev Error thrown when querying for a non-existent vote.\n */\nerror ErrQueryForNonExistentVote();\n\n/**\n * @dev Error indicating that the method is only called once per block.\n */\nerror ErrOncePerBlock();\n\n/**\n * @dev Error of method caller must be coinbase\n */\nerror ErrCallerMustBeCoinbase();\n" + }, + "contracts/utils/ContractType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nenum ContractType {\n /* 0 */ UNKNOWN,\n /* 1 */ PAUSE_ENFORCER,\n /* 2 */ BRIDGE,\n /* 3 */ BRIDGE_TRACKING,\n /* 4 */ GOVERNANCE_ADMIN,\n /* 5 */ MAINTENANCE,\n /* 6 */ SLASH_INDICATOR,\n /* 7 */ STAKING_VESTING,\n /* 8 */ VALIDATOR,\n /* 9 */ STAKING,\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\n /* 11 */ BRIDGE_MANAGER,\n /* 12 */ BRIDGE_SLASH,\n /* 13 */ BRIDGE_REWARD,\n /* 14 */ FAST_FINALITY_TRACKING,\n /* 15 */ PROFILE\n}\n" + }, + "contracts/utils/DeprecatedSlots.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Deprecated Contracts\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\n * They provide functionality related to various aspects of a smart contract but have been marked\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\n */\ncontract HasSlashIndicatorDeprecated {\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\n address internal ______deprecatedSlashIndicator;\n}\n\ncontract HasStakingVestingDeprecated {\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\n address internal ______deprecatedStakingVesting;\n}\n\ncontract HasBridgeDeprecated {\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\n address internal ______deprecatedBridge;\n}\n\ncontract HasValidatorDeprecated {\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\n address internal ______deprecatedValidator;\n}\n\ncontract HasStakingDeprecated {\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\n address internal ______deprecatedStakingContract;\n}\n\ncontract HasMaintenanceDeprecated {\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\n address internal ______deprecatedMaintenance;\n}\n\ncontract HasTrustedOrgDeprecated {\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\n address internal ______deprecatedTrustedOrg;\n}\n\ncontract HasGovernanceAdminDeprecated {\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\n address internal ______deprecatedGovernanceAdmin;\n}\n\ncontract HasBridgeTrackingDeprecated {\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\n address internal ______deprecatedBridgeTracking;\n}\n" + }, + "contracts/utils/IdentityGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { AddressArrayUtils } from \"../libraries/AddressArrayUtils.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport { TransparentUpgradeableProxyV2 } from \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \"./CommonErrors.sol\";\n\nabstract contract IdentityGuard {\n using AddressArrayUtils for address[];\n\n /// @dev value is equal to keccak256(abi.encode())\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n\n /**\n * @dev Modifier to restrict functions to only be called by this contract.\n * @dev Reverts if the caller is not this contract.\n */\n modifier onlySelfCall() virtual {\n _requireSelfCall();\n _;\n }\n\n /**\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\n *\n * Requirements:\n * - The elements in the `arr` array must not contain any duplicates.\n */\n modifier nonDuplicate(address[] memory arr) virtual {\n _requireNonDuplicate(arr);\n _;\n }\n\n /**\n * @dev Internal method to check the method caller.\n * @dev Reverts if the method caller is not this contract.\n */\n function _requireSelfCall() internal view virtual {\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\n }\n\n /**\n * @dev Internal function to check if a contract address has code.\n * @param addr The address of the contract to check.\n * @dev Throws an error if the contract address has no code.\n */\n function _requireHasCode(address addr) internal view {\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\n }\n\n /**\n * @dev Checks if an address is zero and reverts if it is.\n * @param addr The address to check.\n */\n function _requireNonZeroAddress(address addr) internal pure {\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\n }\n\n /**\n * @dev Check if arr is empty and revert if it is.\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\n * @param arr The array of addresses to check.\n */\n function _requireNonDuplicate(address[] memory arr) internal pure {\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\n }\n\n /**\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\n * @notice This method only works with non-state EOA accounts\n */\n function _requireCreatedEOA(address addr) internal view {\n _requireNonZeroAddress(addr);\n bytes32 codehash = addr.codehash;\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\n }\n\n /**\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\n *\n * @param contractAddr The address of the contract to check for interface support.\n * @param interfaceId The interface ID to check for support.\n */\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\n if (!success) {\n (success, returnOrRevertData) = contractAddr.staticcall(\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\n );\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\n }\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\n }\n}\n" + }, + "contracts/utils/RoleAccess.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nenum RoleAccess {\n /* 0 */ UNKNOWN,\n /* 1 */ ADMIN,\n /* 2 */ COINBASE,\n /* 3 */ GOVERNOR,\n /* 4 */ CANDIDATE_ADMIN,\n /* 5 */ WITHDRAWAL_MIGRATOR,\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\n /* 7 */ BLOCK_PRODUCER,\n /* 8 */ VALIDATOR_CANDIDATE,\n /* 9 */ CONSENSUS,\n /* 10 */ TREASURY\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/ronin-testnet/solcInputs/f5939ebe47e4086c92eac99ab2681ceb.json b/deployments/ronin-testnet/solcInputs/f5939ebe47e4086c92eac99ab2681ceb.json new file mode 100644 index 000000000..437768782 --- /dev/null +++ b/deployments/ronin-testnet/solcInputs/f5939ebe47e4086c92eac99ab2681ceb.json @@ -0,0 +1,246 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/extensions/collections/HasContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { HasProxyAdmin } from \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasContracts.sol\";\nimport { IdentityGuard } from \"../../utils/IdentityGuard.sol\";\nimport { ErrUnexpectedInternalCall } from \"../../utils/CommonErrors.sol\";\n\n/**\n * @title HasContracts\n * @dev A contract that provides functionality to manage multiple contracts with different roles.\n */\nabstract contract HasContracts is HasProxyAdmin, IHasContracts, IdentityGuard {\n /// @dev value is equal to keccak256(\"@ronin.dpos.collections.HasContracts.slot\") - 1\n bytes32 private constant _STORAGE_SLOT = 0xdea3103d22025c269050bea94c0c84688877f12fa22b7e6d2d5d78a9a49aa1cb;\n\n /**\n * @dev Modifier to restrict access to functions only to contracts with a specific role.\n * @param contractType The contract type that allowed to call\n */\n modifier onlyContract(ContractType contractType) virtual {\n _requireContract(contractType);\n _;\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function setContract(ContractType contractType, address addr) external virtual onlyAdmin {\n _requireHasCode(addr);\n _setContract(contractType, addr);\n }\n\n /**\n * @inheritdoc IHasContracts\n */\n function getContract(ContractType contractType) public view returns (address contract_) {\n contract_ = _getContractMap()[uint8(contractType)];\n if (contract_ == address(0)) revert ErrContractTypeNotFound(contractType);\n }\n\n /**\n * @dev Internal function to set the address of a contract with a specific role.\n * @param contractType The contract type of the contract to set.\n * @param addr The address of the contract to set.\n */\n function _setContract(ContractType contractType, address addr) internal virtual {\n _getContractMap()[uint8(contractType)] = addr;\n emit ContractUpdated(contractType, addr);\n }\n\n /**\n * @dev Internal function to access the mapping of contract addresses with roles.\n * @return contracts_ The mapping of contract addresses with roles.\n */\n function _getContractMap() private pure returns (mapping(uint8 => address) storage contracts_) {\n assembly {\n contracts_.slot := _STORAGE_SLOT\n }\n }\n\n /**\n * @dev Internal function to check if the calling contract has a specific role.\n * @param contractType The contract type that the calling contract must have.\n * @dev Throws an error if the calling contract does not have the specified role.\n */\n function _requireContract(ContractType contractType) private view {\n if (msg.sender != getContract(contractType)) {\n revert ErrUnexpectedInternalCall(msg.sig, contractType, msg.sender);\n }\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\nimport \"../../utils/CommonErrors.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n _requireAdmin();\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view virtual returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _requireAdmin() internal view {\n if (msg.sender != _getAdmin()) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\n }\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "contracts/interfaces/collections/IHasContracts.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { ContractType } from \"../../utils/ContractType.sol\";\n\ninterface IHasContracts {\n /// @dev Error of invalid role.\n error ErrContractTypeNotFound(ContractType contractType);\n\n /// @dev Emitted when a contract is updated.\n event ContractUpdated(ContractType indexed contractType, address indexed addr);\n\n /**\n * @dev Returns the address of a contract with a specific role.\n * Throws an error if no contract is set for the specified role.\n *\n * @param contractType The role of the contract to retrieve.\n * @return contract_ The address of the contract with the specified role.\n */\n function getContract(ContractType contractType) external view returns (address contract_);\n\n /**\n * @dev Sets the address of a contract with a specific role.\n * Emits the event {ContractUpdated}.\n * @param contractType The role of the contract to set.\n * @param addr The address of the contract to set.\n */\n function setContract(ContractType contractType, address addr) external;\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../udvts/Types.sol\";\n\ninterface IMaintenance {\n /**\n * @dev Error thrown when attempting to schedule an already scheduled event.\n */\n error ErrAlreadyScheduled();\n\n /**\n * @dev Error thrown when referring to a non-existent schedule.\n */\n error ErrUnexistedSchedule();\n\n /**\n * @dev Error thrown when the end block of a schedule is out of range.\n */\n error ErrEndBlockOutOfRange();\n\n /**\n * @dev Error thrown when the start block of a schedule is out of range.\n */\n error ErrStartBlockOutOfRange();\n\n /**\n * @dev Error thrown when attempting to initiate maintenance while already in maintenance mode.\n */\n error ErrAlreadyOnMaintenance();\n\n /**\n * @dev Error thrown when attempting an action before the cooldown period has ended.\n */\n error ErrCooldownTimeNotYetEnded();\n\n /**\n * @dev Error thrown when the total number of schedules exceeds the limit.\n */\n error ErrTotalOfSchedulesExceeded();\n\n /**\n * @dev Error thrown when an invalid maintenance duration is specified.\n */\n error ErrInvalidMaintenanceDuration();\n\n /**\n * @dev Error thrown when an invalid maintenance duration configuration is provided.\n */\n error ErrInvalidMaintenanceDurationConfig();\n\n /**\n * @dev Error thrown when an invalid offset is specified to start the schedule configurations.\n */\n error ErrInvalidOffsetToStartScheduleConfigs();\n\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(TConsensus indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(TConsensus indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(TConsensus consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator whose id `validatorId` maintained at the block number `_block`.\n */\n function checkMaintainedById(address validatorId, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n TConsensus consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `k` or not.\n */\n function checkManyMaintained(\n TConsensus[] calldata consensusAddrList,\n uint256 atBlock\n ) external view returns (bool[] memory);\n\n function checkManyMaintainedById(\n address[] calldata candidateIdList,\n uint256 atBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n TConsensus[] calldata _consensusAddrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n function checkManyMaintainedInBlockRangeById(\n address[] calldata idList,\n uint256 fromBlock,\n uint256 toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `consensusAddr` has finished cooldown.\n */\n function checkCooldownEnded(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `consensusAddr` has schedule.\n */\n function checkScheduled(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `consensusAddr`.\n */\n function getSchedule(TConsensus consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedule() external view returns (uint256 count);\n\n /**\n * @dev Returns the cooldown to maintain in seconds.\n */\n function cooldownSecsToMaintain() external view returns (uint256);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 minMaintenanceDurationInBlock_,\n uint256 maxMaintenanceDurationInBlock_,\n uint256 minOffsetToStartSchedule_,\n uint256 maxOffsetToStartSchedule_,\n uint256 maxSchedules_,\n uint256 cooldownSecsToMaintain_\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedule() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `startedAtBlock` to `endedAtBlock`.\n *\n * Requirements:\n * - The candidate `consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `consensusAddr`.\n * - The candidate `consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(TConsensus consensusAddr, uint256 startedAtBlock, uint256 endedAtBlock) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `consensusAddr`.\n *\n * Requirements:\n * - The candidate `consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `consensusAddr`.\n * - A schedule for the `consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(TConsensus consensusAddr) external;\n}\n" + }, + "contracts/interfaces/IProfile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId, TConsensus } from \"../udvts/Types.sol\";\nimport \"../utils/RoleAccess.sol\";\n\ninterface IProfile {\n struct CandidateProfile {\n /**\n * @dev Primary key of the profile, use for backward querying.\n *\n * {Staking} Contract: index of pool\n * {RoninValidatorSet} Contract: index of almost all data related to a validator\n *\n */\n address id;\n /// @dev Consensus address.\n TConsensus consensus;\n /// @dev Pool admin address.\n address admin;\n /// @dev Treasury address.\n address payable treasury;\n /// @dev Address to voting proposal.\n address __reservedGovernor;\n /// @dev Public key for fast finality.\n bytes pubkey;\n }\n\n /// @dev Event emitted when a profile with `id` is added.\n event ProfileAdded(address indexed id);\n /// @dev Event emitted when a address in a profile is changed.\n event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);\n /// @dev Event emitted when the pubkey of the `id` is changed.\n event PubkeyChanged(address indexed id, bytes pubkey);\n\n /// @dev Error of already existed profile.\n error ErrExistentProfile();\n /// @dev Error of non existed profile.\n error ErrNonExistentProfile();\n /// @dev Error when create a new profile whose id and consensus are not identical.\n error ErrIdAndConsensusDiffer();\n /**\n * @dev Error when there is a duplicated info of `value`, which is uin256-padding value of any address or hash of public key,\n * and with value type of `infoType`.\n */\n error ErrDuplicatedInfo(RoleAccess infoType, uint256 value);\n error ErrDuplicatedPubkey(bytes pubkey);\n error ErrZeroAddress(RoleAccess infoType);\n error ErrZeroPubkey();\n\n /// @dev Getter to query full `profile` from `id` address.\n function getId2Profile(address id) external view returns (CandidateProfile memory profile);\n\n /// @dev Getter to batch query from `id` to `consensus`, return address(0) if the profile not exist.\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList);\n\n /// @dev Getter to backward query from `consensus` address to `id` address.\n function getConsensus2Id(TConsensus consensus) external view returns (address id);\n\n /// @dev Getter to backward batch query from `consensus` address to `id` address.\n function getManyConsensus2Id(TConsensus[] memory consensus) external view returns (address[] memory);\n\n /**\n * @notice Add a new profile.\n *\n * @dev Requirements:\n * - The profile must not be existent before.\n * - Only contract admin can call this method.\n */\n function addNewProfile(CandidateProfile memory profile) external;\n\n /**\n * @dev Cross-contract function to add/update new profile of a validator candidate when they\n * applying for candidate role.\n *\n * Requirements:\n * - Only `stakingContract` can call this method.\n */\n function execApplyValidatorCandidate(address admin, address id, address treasury, bytes calldata pubkey) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeAdminAddress(address id, address newAdminAddr) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external;\n\n /**\n * @dev Updated the treasury address of candidate id `id` immediately without waiting time.\n *\n * Emit an {ProfileAddressChanged}.\n */\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external;\n\n /**\n * @notice The candidate admin changes the public key.\n *\n * @dev Requirements:\n * - The profile must be existed.\n * - Only user with candidate admin role can call this method.\n * - New public key must not be duplicated.\n */\n\n function changePubkey(address id, bytes memory pubkey) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) external returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\nimport \"../udvts/Types.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n /**\n * @dev Error indicating that a query for a duplicate entry was made.\n */\n error ErrQueryForDupplicated();\n\n /**\n * @dev Error indicating that a query was made for a non-existent consensus address.\n */\n error ErrQueryForNonExistentConsensusAddress();\n\n /**\n * @dev Error indicating that a governor address has already been added.\n * @param addr The address of the governor that is already added.\n */\n error ErrGovernorAddressIsAlreadyAdded(address addr);\n\n /**\n * @dev Error indicating that a consensus address is not added.\n * @param addr The address of the consensus contract that is not added.\n */\n error ErrConsensusAddressIsNotAdded(TConsensus addr);\n\n /**\n * @dev Error indicating that a consensus address is already added.\n * @param addr The address of the consensus contract that is already added.\n */\n error ErrConsensusAddressIsAlreadyAdded(TConsensus addr);\n\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n TConsensus consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address __deprecatedBridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(TConsensus[] orgs);\n /// @dev Emitted when the consensus address of a trusted organization is changed.\n event ConsensusAddressOfTrustedOrgChanged(TrustedOrganization orgAfterChanged, TConsensus oldConsensus);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(TConsensus[] calldata consensusAddrs) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n *\n * Emits the event `ConsensusAddressOfTrustedOrgChanged` once an organization is removed.\n */\n function execChangeConsensusAddressForTrustedOrg(TConsensus oldConsensusAddr, TConsensus newConsensusAddr) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeight() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeightById(address cid) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address governor) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeight(TConsensus[] calldata list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeight(address[] calldata list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganization() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(TConsensus consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3,\n FAST_FINALITY\n }\n\n /// @dev Error thrown when evidence has already been submitted.\n error ErrEvidenceAlreadySubmitted();\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICreditScore {\n /**\n * @dev Error thrown when an invalid credit score configuration is provided.\n */\n error ErrInvalidCreditScoreConfig();\n\n /**\n * @dev Error thrown when an invalid cut-off percentage configuration is provided.\n */\n error ErrInvalidCutOffPercentageConfig();\n\n /**\n * @dev Error thrown when the caller's credit score is insufficient to bail out a situation.\n */\n error ErrInsufficientCreditScoreToBailOut();\n\n /**\n * @dev Error thrown when a validator has previously bailed out.\n */\n error ErrValidatorHasBailedOutPreviously();\n\n /**\n * @dev Error thrown when the caller must be jailed in the current period.\n */\n error ErrCallerMustBeJailedInTheCurrentPeriod();\n\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(TConsensus indexed consensus, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execUpdateCreditScores(address[] calldata validatorIds, uint256 period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata validatorIds) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(TConsensus consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(TConsensus consensus) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(\n TConsensus[] calldata consensusAddrs\n ) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `consensus` has been bailed out at the `period`.\n */\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(TConsensus _validatorAddr, bytes calldata _header1, bytes calldata _header2) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashFastFinality.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashFastFinality is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash fast finality is updated. See the method `getFastFinalitySlashingConfigs`\n * for param details.\n */\n event FastFinalitySlashingConfigsUpdated(uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\n\n /**\n * @dev Slashes for fast finality.\n *\n * Requirements:\n * - Only whitelisted addresses are allowed to call.\n *\n * Emits the event `Slashed` if the fast finality evidence of the two headers valid.\n */\n function slashFastFinality(\n TConsensus consensusAddr,\n bytes calldata voterPublicKey,\n uint256 targetBlockNumber,\n bytes32[2] calldata targetBlockHash,\n bytes[][2] calldata listOfPublicKey,\n bytes[2] calldata aggregatedSignature\n ) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return slashFastFinalityAmount The amount of RON to slash fast finality.\n * @return fastFinalityJailUntilBlock The block number that the punished validator will be jailed until, due to\n * malicious fast finality.\n */\n function getFastFinalitySlashingConfigs()\n external\n view\n returns (uint256 slashFastFinalityAmount, uint256 fastFinalityJailUntilBlock);\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `FastFinalitySlashingConfigsUpdated`.\n *\n * @param slashAmount The amount of RON to slash fast finality.\n * @param jailUntilBlock The block number that the punished validator will be jailed until, due to fast finality.\n *\n */\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Error thrown when attempting to slash a validator twice or slash more than one validator in one block.\n */\n error ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\n\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(TConsensus consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `period` of a block producer.\n */\n function getUnavailabilityIndicator(TConsensus consensusAddr, uint256 period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 tier1Threshold,\n uint256 tier2Threshold,\n uint256 slashAmountForTier2Threshold,\n uint256 jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\ninterface IBaseStaking {\n struct PoolDetail {\n /**\n * @dev Address of the pool.\n * @custom non-volatile-storage Permanently set to the first consensus address of the candidate.\n */\n address pid;\n\n /**\n * @dev The address of the pool admin.\n * @custom shadowed-storage This storage slot is always kept in sync with the admin in `Profile-CandidateProfile`.\n */\n address __shadowedPoolAdmin;\n\n /// @dev Self-staking amount\n uint256 stakingAmount;\n\n /// @dev Total number of RON staking for the pool\n uint256 stakingTotal;\n\n /// @dev Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n\n /// @dev Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(TConsensus consensusAddr, address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `admin` is currently active.\n */\n function isAdminOfActivePool(address admin) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address admin) external view returns (address);\n\n /**\n * @dev Returns the staking pool details.\n */\n function getPoolDetail(\n TConsensus consensusAddr\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\n\n function getPoolDetailById(\n address poolId\n ) external view returns (address admin, uint256 stakingAmount, uint256 stakingTotal);\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakingsById(address[] calldata poolIds) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed poolId, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed poolId, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed poolId,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed poolId,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 minRange, uint256 maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 minRate, uint256 maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address candidateAdmin,\n TConsensus consensusAddr,\n address payable treasuryAddr,\n uint256 commissionRate,\n bytes calldata pubkey\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata pools, uint256 period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(TConsensus consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `consensusAddr` for `amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(TConsensus consensusAddr, uint256 amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n TConsensus consensusAddr,\n uint256 effectiveDaysOnwards,\n uint256 commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(TConsensus consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(TConsensus consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed poolId, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed poolId, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(TConsensus consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(TConsensus consensusAddr, uint256 amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(TConsensus[] calldata consensusAddrs, uint256[] calldata amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(TConsensus consensusAddrSrc, TConsensus consensusAddrDst, uint256 amount) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(\n address user,\n TConsensus[] calldata consensusAddrList\n ) external view returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(TConsensus[] calldata consensusAddrList) external returns (uint256 amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(\n TConsensus[] calldata consensusAddrList,\n TConsensus consensusAddrDst\n ) external returns (uint256 amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\nimport { TPoolId, TConsensus } from \"../../udvts/Types.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(TConsensus consensusAddr, address user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(TConsensus consensusAddr, address user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(\n TConsensus[] calldata consensusAddrs,\n address[] calldata userList\n ) external view returns (uint256[] memory);\n\n function getManyStakingAmountsById(\n address[] calldata poolIds,\n address[] calldata userList\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(TConsensus consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(TConsensus[] calldata consensusAddrs) external view returns (uint256[] memory);\n\n function getManyStakingTotalsById(\n address[] calldata poolIds\n ) external view returns (uint256[] memory stakingAmounts_);\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./IStakingCallback.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking, IStakingCallback {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(address[] calldata poolIds, uint256[] calldata rewards, uint256 period) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address poolId, uint256 amount) external returns (uint256 actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/staking/IStakingCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TPoolId } from \"../../udvts/Types.sol\";\n\ninterface IStakingCallback {\n /**\n * @dev Requirements:\n * - Only Profile contract can call this method.\n */\n function execChangeAdminAddress(address poolAddr, address newAdminAddr) external;\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n /**\n * @dev The address of the candidate admin.\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.admin.\n */\n address __shadowedAdmin;\n /**\n * @dev Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.consensus.\n */\n TConsensus __shadowedConsensus;\n /**\n * @dev Address that receives mining reward of the validator\n * @custom shadowed-storage This storage slot is always kept in sync with {Profile-CandidateProfile}.treasury.\n */\n address payable __shadowedTreasury;\n /// @dev Address of the bridge operator corresponding to the candidate\n address ____deprecatedBridgeOperatorAddr;\n /**\n * @dev The percentage of reward that validators can be received, the rest goes to the delegators.\n * Values in range [0; 100_00] stands for 0-100%\n */\n uint256 commissionRate;\n /// @dev The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n /// @dev The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n /// @dev The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n /// @dev The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(address indexed consensusAddr, address indexed treasuryAddr, address indexed admin);\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed cid, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed cid, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnward() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(TConsensus consensus) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(TConsensus consensus) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(TConsensus consensus, address admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(TConsensus consensus) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/ICandidateManagerCallback.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { TConsensus } from \"../../udvts/Types.sol\";\n\ninterface ICandidateManagerCallback {\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address candidateAdmin,\n address cid,\n address payable treasuryAddr,\n uint256 commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(address cid, uint256 effectiveTimestamp, uint256 rate) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeAdminAddress`.\n * This updates the shadow storage slot of \"shadowedAdmin\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeAdminAddress(address cid, address newAdmin) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeConsensusAddress`.\n * This updates the shadow storage slot of \"shadowedConsensus\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeConsensusAddress(address cid, TConsensus newConsensus) external;\n\n /**\n * @dev Fallback function of `Profile-requestChangeTreasuryAddress`.\n * This updates the shadow storage slot of \"shadowedTreasury\" for candidate id `id` to `newAdmin`.\n *\n * Requirements:\n * - The caller must be the Profile contract.\n */\n function execChangeTreasuryAddress(address cid, address payable newTreasury) external;\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the fast finality reward is distributed.\n event FastFinalityRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the fast finality reward.\n event FastFinalityRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n /// @dev Error thrown when the info of releasing locked fund not exist.\n error ErrLockedFundReleaseInfoNotFound(address cid);\n /// @dev Error thrown when the the locked fund of emergency exit might be recycled.\n error ErrLockedFundMightBeRecycled(address cid);\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address validatorId, address payable recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execRequestEmergencyExit(address validatorId, uint256 secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfoV2.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfoV2 {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(TConsensus consensus) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../udvts/Types.sol\";\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(TConsensus) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(\n TConsensus addr\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(TConsensus addr, uint256 blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(\n TConsensus addr,\n uint256 blockNum\n ) external view returns (bool isJailed_, uint256 blockLeft_, uint256 epochLeft_);\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(TConsensus[] calldata) external view returns (bool[] memory);\n\n function checkManyJailedById(address[] calldata candidateIds) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(TConsensus addr) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(TConsensus addr, uint256 period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfoV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport { TConsensus } from \"../../../udvts/Types.sol\";\n\ninterface IValidatorInfoV2 {\n /// @dev Error thrown when an invalid maximum prioritized validator number is provided.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators() external view returns (address[] memory _validatorList);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(TConsensus consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducer() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./ICandidateManagerCallback.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManagerCallback,\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed cid,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed cid, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(address cid, uint256 newJailedUntil, uint256 slashAmount, bool cannotBailout) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address cid, uint256 period) external;\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Error thrown when a duplicated element is detected in an array.\n * @param msgSig The function signature that invoke the error.\n */\n error ErrDuplicated(bytes4 msgSig);\n\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n unchecked {\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool yes_) {\n // Hashing two arrays and compare their hash\n assembly {\n let _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n let _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n yes_ := eq(_thisHash, _otherHash)\n }\n }\n\n /**\n * @dev Return the concatenated array from a and b.\n */\n function extend(address[] memory a, address[] memory b) internal pure returns (address[] memory c) {\n uint256 lengthA = a.length;\n uint256 lengthB = b.length;\n unchecked {\n c = new address[](lengthA + lengthB);\n }\n uint256 i;\n for (; i < lengthA; ) {\n c[i] = a[i];\n unchecked {\n ++i;\n }\n }\n for (uint256 j; j < lengthB; ) {\n c[i] = b[j];\n unchecked {\n ++i;\n ++j;\n }\n }\n }\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n DeprecatedBridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(uint256 c, uint256 a, uint256 b) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(uint256 x1, uint256 x2, uint256 y1, uint256 y2) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(uint256 a, uint256 b, uint256 upperbound) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/mocks/libraries/Sorting.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Sorting {\n struct Node {\n uint key;\n uint value;\n }\n\n struct Node3 {\n uint key;\n uint value;\n uint otherKey;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // VALUE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(uint[] memory data) internal pure returns (uint[] memory) {\n return _quickSort(data, int(0), int(data.length - 1));\n }\n\n function _quickSort(uint[] memory arr, int left, int right) private pure returns (uint[] memory) {\n int i = left;\n int j = right;\n if (i == j) return arr;\n uint pivot = arr[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (arr[uint(i)] > pivot) i++;\n while (pivot > arr[uint(j)]) j--;\n if (i <= j) {\n (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);\n i++;\n j--;\n }\n }\n if (left < j) arr = _quickSort(arr, left, j);\n if (i < right) arr = _quickSort(arr, i, right);\n\n return arr;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(address[] memory _keys, uint256[] memory _values) internal pure returns (address[] memory) {\n require(_values.length == _keys.length, \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return _keys;\n }\n\n Node[] memory _nodes = new Node[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(uint256(uint160(_keys[_i])), _values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return _keys;\n }\n\n function sort(uint256[] memory keys, uint256[] memory values) internal pure returns (uint256[] memory) {\n require(values.length == keys.length, \"Sorting: invalid array length\");\n if (keys.length == 0) {\n return keys;\n }\n\n Node[] memory _nodes = new Node[](keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(keys[_i], values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n keys[_i] = _nodes[_i].key; // Casting?\n }\n\n return keys;\n }\n\n function sortNodes(Node[] memory nodes) internal pure returns (Node[] memory) {\n return _quickSortNodes(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNodes(Node[] memory nodes, int left, int right) private pure returns (Node[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNodes(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNodes(nodes, left, j);\n if (i < right) nodes = _quickSortNodes(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNodes(Node[] memory nodes) private pure returns (Node[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNodes(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNodes(Node memory x, Node memory y) private pure returns (Node memory, Node memory) {\n Node memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE3 SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sortWithExternalKeys(\n address[] memory _keys,\n uint256[] memory _values,\n uint256[] memory _otherKeys\n ) internal pure returns (address[] memory keys_, uint256[] memory otherKeys_) {\n require((_values.length == _keys.length) && (_otherKeys.length == _keys.length), \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return (_keys, _otherKeys);\n }\n\n Node3[] memory _nodes = new Node3[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node3(uint256(uint160(_keys[_i])), _values[_i], _otherKeys[_i]);\n }\n _quickSortNode3s(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return (_keys, _otherKeys);\n }\n\n function sortNode3s(Node3[] memory nodes) internal pure returns (Node3[] memory) {\n return _quickSortNode3s(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNode3s(Node3[] memory nodes, int left, int right) private pure returns (Node3[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node3 memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNode3s(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNode3s(nodes, left, j);\n if (i < right) nodes = _quickSortNode3s(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNode3s(Node3[] memory nodes) private pure returns (Node3[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNode3s(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNode3s(Node3 memory x, Node3 memory y) private pure returns (Node3 memory, Node3 memory) {\n Node3 memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n}\n" + }, + "contracts/mocks/MockPrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./libraries/Sorting.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract MockPrecompile {\n function sortValidators(\n address[] memory _validators,\n uint256[] memory _weights\n ) public pure returns (address[] memory) {\n return Sorting.sort(_validators, _weights);\n }\n\n function validatingDoubleSignProof(\n address /*consensusAddr*/,\n bytes calldata /*_header1*/,\n bytes calldata /*_header2*/\n ) public pure returns (bool _validEvidence) {\n return true;\n }\n\n function validateFinalityVoteProof(\n bytes calldata,\n uint256,\n bytes32[2] calldata,\n bytes[][2] calldata,\n bytes[2] calldata\n ) public pure returns (bool) {\n return true;\n }\n\n function pickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public pure returns (address[] memory _result) {\n (_result, _trustedWeights) = Sorting.sortWithExternalKeys(_candidates, _weights, _trustedWeights);\n uint256 _newValidatorCount = Math.min(_maxValidatorNumber, _result.length);\n _arrangeValidatorCandidates(_result, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n }\n\n /**\n * @dev Arranges the sorted candidates to list of validators, by asserting prioritized and non-prioritized candidates\n *\n * @param _candidates A sorted list of candidates\n */\n function _arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) internal pure {\n address[] memory _waitingCandidates = new address[](_candidates.length);\n uint _waitingCounter;\n uint _prioritySlotCounter;\n\n for (uint _i = 0; _i < _candidates.length; _i++) {\n if (_trustedWeights[_i] > 0 && _prioritySlotCounter < _maxPrioritizedValidatorNumber) {\n _candidates[_prioritySlotCounter++] = _candidates[_i];\n continue;\n }\n _waitingCandidates[_waitingCounter++] = _candidates[_i];\n }\n\n _waitingCounter = 0;\n for (uint _i = _prioritySlotCounter; _i < _newValidatorCount; _i++) {\n _candidates[_i] = _waitingCandidates[_waitingCounter++];\n }\n\n assembly {\n mstore(_candidates, _newValidatorCount)\n }\n }\n}\n" + }, + "contracts/mocks/MockSlashIndicatorExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockPrecompile.sol\";\nimport \"../ronin/slash-indicator/SlashIndicator.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\n\ncontract MockSlashIndicatorExtended is SlashIndicator, MockPrecompile {\n function slashFelony(address _validatorAddr) external {\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execSlash(_validatorAddr, 0, 0, false);\n }\n\n function slashMisdemeanor(address _validatorAddr) external {\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).execSlash(_validatorAddr, 0, 0, false);\n }\n\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal pure override returns (bool _validEvidence) {\n return validatingDoubleSignProof(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/multi-chains/RoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../libraries/AddressArrayUtils.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../interfaces/IProfile.sol\";\nimport \"../extensions/collections/HasProxyAdmin.sol\";\nimport \"../extensions/collections/HasContracts.sol\";\nimport \"../udvts/Types.sol\";\n\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, HasContracts, Initializable {\n uint256 internal _num;\n uint256 internal _denom;\n uint256 internal _totalWeight;\n uint256 internal _nonce;\n\n /// @dev Mapping from consensus address => weight\n mapping(TConsensus => uint256) internal _consensusWeight;\n /// @dev Mapping from governor address => weight\n mapping(address => uint256) internal _governorWeight;\n /// @dev Mapping from bridge voter address => weight\n mapping(address => uint256) internal __deprecatedBridgeVoterWeight;\n\n /// @dev Mapping from consensus address => added block\n mapping(TConsensus => uint256) internal _addedBlock;\n\n /// @dev Consensus array\n TConsensus[] internal _consensusList;\n /// @dev Governors array\n address[] internal _governorList;\n /// @dev Bridge voters array\n address[] internal __deprecatedBridgeVoterList;\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(TrustedOrganization[] calldata trustedOrgs, uint256 num, uint256 denom) external initializer {\n if (trustedOrgs.length > 0) {\n _addTrustedOrganizations(trustedOrgs);\n }\n _setThreshold(num, denom);\n }\n\n function initializeV2(address profileContract) external reinitializer(2) {\n _setContract(ContractType.PROFILE, profileContract);\n for (uint i; i < __deprecatedBridgeVoterList.length; ++i) {\n delete __deprecatedBridgeVoterWeight[__deprecatedBridgeVoterList[i]];\n }\n delete __deprecatedBridgeVoterList;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _totalWeight;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() external view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) external override onlyAdmin returns (uint256, uint256) {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n _addTrustedOrganizations(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n if (_list.length == 0) revert ErrEmptyArray();\n for (uint256 _i; _i < _list.length; ) {\n _updateTrustedOrganization(_list[_i]);\n\n unchecked {\n ++_i;\n }\n }\n emit TrustedOrganizationsUpdated(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function removeTrustedOrganizations(TConsensus[] calldata list) external override onlyAdmin {\n if (list.length == 0) revert ErrEmptyArray();\n\n for (uint _i = 0; _i < list.length; ) {\n _removeTrustedOrganization(list[_i]);\n\n unchecked {\n ++_i;\n }\n }\n emit TrustedOrganizationsRemoved(list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function totalWeight() external view virtual returns (uint256) {\n return _totalWeight;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeight(TConsensus consensusAddr) external view returns (uint256) {\n return _getConsensusWeightByConsensus(consensusAddr);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeightById(address cid) external view returns (uint256) {\n return _getConsensusWeightByConsensus(__cid2css(cid));\n }\n\n function _getConsensusWeightByConsensus(TConsensus consensusAddr) internal view returns (uint256) {\n return _consensusWeight[consensusAddr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeight(address _governor) external view returns (uint256) {\n return _governorWeight[_governor];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeights(TConsensus[] calldata list) external view returns (uint256[] memory) {\n return _getManyConsensusWeightsByConsensus(list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeightsById(address[] calldata cids) external view returns (uint256[] memory) {\n TConsensus[] memory consensusList = __cid2cssBatch(cids);\n return _getManyConsensusWeightsByConsensus(consensusList);\n }\n\n function _getManyConsensusWeightsByConsensus(TConsensus[] memory list) internal view returns (uint256[] memory res) {\n res = new uint256[](list.length);\n for (uint i = 0; i < res.length; ++i) {\n res[i] = _getConsensusWeightByConsensus(list[i]);\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; ) {\n _res[_i] = _governorWeight[_list[_i]];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumConsensusWeight(TConsensus[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; ) {\n _res += _consensusWeight[_list[_i]];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumGovernorWeight(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; ) {\n _res += _governorWeight[_list[_i]];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function countTrustedOrganization() external view override returns (uint256) {\n return _consensusList.length;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory list) {\n list = new TrustedOrganization[](_consensusList.length);\n TConsensus consensus;\n for (uint256 _i; _i < list.length; ) {\n consensus = _consensusList[_i];\n list[_i].consensusAddr = consensus;\n list[_i].governor = _governorList[_i];\n list[_i].__deprecatedBridgeVoter = address(0);\n list[_i].weight = _consensusWeight[consensus];\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganization(TConsensus _consensusAddr) external view returns (TrustedOrganization memory) {\n for (uint i = 0; i < _consensusList.length; ++i) {\n if (_consensusList[i] == _consensusAddr) {\n return getTrustedOrganizationAt(i);\n }\n }\n revert ErrQueryForNonExistentConsensusAddress();\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\n TConsensus consensus = _consensusList[_idx];\n return\n TrustedOrganization(\n consensus,\n _governorList[_idx],\n address(0),\n _consensusWeight[consensus],\n _addedBlock[consensus]\n );\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function execChangeConsensusAddressForTrustedOrg(\n TConsensus oldAddr,\n TConsensus newAddr\n ) external override onlyContract(ContractType.PROFILE) {\n uint256 index = _findTrustedOrgIndexByConsensus(oldAddr);\n _consensusList[index] = newAddr;\n _consensusWeight[newAddr] = _consensusWeight[oldAddr];\n _addedBlock[newAddr] = block.number;\n\n _deleteConsensusInMappings(oldAddr);\n\n emit ConsensusAddressOfTrustedOrgChanged(getTrustedOrganizationAt(index), oldAddr);\n }\n\n /**\n * @dev Adds a list of trusted organizations.\n */\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\n for (uint256 _i; _i < _list.length; ) {\n _addTrustedOrganization(_list[_i]);\n\n unchecked {\n ++_i;\n }\n }\n emit TrustedOrganizationsAdded(_list);\n }\n\n /**\n * @dev Adds a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is not added.\n * - The governor address is not added.\n * - The bridge voter address is not added.\n *\n */\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n if (_v.addedBlock != 0) revert ErrInvalidRequest();\n _sanityCheckTrustedOrganizationData(_v);\n\n if (_consensusWeight[_v.consensusAddr] > 0) revert ErrConsensusAddressIsAlreadyAdded(_v.consensusAddr);\n\n if (_governorWeight[_v.governor] > 0) revert ErrGovernorAddressIsAlreadyAdded(_v.governor);\n\n _consensusList.push(_v.consensusAddr);\n _consensusWeight[_v.consensusAddr] = _v.weight;\n\n _governorList.push(_v.governor);\n _governorWeight[_v.governor] = _v.weight;\n\n _addedBlock[_v.consensusAddr] = block.number;\n\n _totalWeight += _v.weight;\n }\n\n /**\n * @dev Updates info of an existing trusted org.\n * Replace the governor address if they are different, set all weights to the new weight.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is already added.\n *\n */\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n _sanityCheckTrustedOrganizationData(_v);\n\n uint256 _weight = _consensusWeight[_v.consensusAddr];\n if (_weight == 0) revert ErrConsensusAddressIsNotAdded(_v.consensusAddr);\n\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; ) {\n if (_consensusList[_i] == _v.consensusAddr) {\n _totalWeight -= _weight;\n _totalWeight += _v.weight;\n\n // Replace governor address\n if (_governorList[_i] != _v.governor) {\n if (_governorWeight[_v.governor] != 0) revert ErrQueryForDupplicated();\n\n delete _governorWeight[_governorList[_i]];\n _governorList[_i] = _v.governor;\n }\n\n // Add new weight for both consensus and governor address\n _consensusWeight[_v.consensusAddr] = _v.weight;\n _governorWeight[_v.governor] = _v.weight;\n return;\n }\n\n unchecked {\n ++_i;\n }\n }\n }\n\n /**\n * @dev Removes a trusted organization by consensus address.\n *\n * Requirements:\n * - The consensus address is added.\n *\n */\n function _removeTrustedOrganization(TConsensus addr) internal virtual {\n uint256 weight = _consensusWeight[addr];\n if (weight == 0) revert ErrConsensusAddressIsNotAdded(addr);\n\n uint256 index = _findTrustedOrgIndexByConsensus(addr);\n\n _totalWeight -= weight;\n _deleteConsensusInMappings(addr);\n\n uint256 count = _consensusList.length;\n _consensusList[index] = _consensusList[count - 1];\n _consensusList.pop();\n\n delete _governorWeight[_governorList[index]];\n _governorList[index] = _governorList[count - 1];\n _governorList.pop();\n }\n\n function _findTrustedOrgIndexByConsensus(TConsensus addr) private view returns (uint256 index) {\n uint256 count = _consensusList.length;\n for (uint256 i = 0; i < count; i++) {\n if (_consensusList[i] == addr) {\n return i;\n }\n }\n }\n\n function _deleteConsensusInMappings(TConsensus addr) private {\n delete _addedBlock[addr];\n delete _consensusWeight[addr];\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(\n uint256 _numerator,\n uint256 _denominator\n ) internal virtual returns (uint256 _previousNum, uint256 _previousDenom) {\n if (_numerator > _denominator) revert ErrInvalidThreshold(msg.sig);\n\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n unchecked {\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n }\n\n /**\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\n *\n * Requirements:\n * - The weight must be larger than 0.\n * - The consensus address, governor address, and bridge voter address are different.\n */\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\n if (_v.weight == 0) revert ErrInvalidVoteWeight(msg.sig);\n\n address[] memory _addresses = new address[](3);\n _addresses[0] = TConsensus.unwrap(_v.consensusAddr);\n _addresses[1] = _v.governor;\n _addresses[2] = _v.__deprecatedBridgeVoter;\n\n if (AddressArrayUtils.hasDuplicate(_addresses)) revert AddressArrayUtils.ErrDuplicated(msg.sig);\n }\n\n function __cid2css(address cid) internal view returns (TConsensus) {\n return (IProfile(getContract(ContractType.PROFILE)).getId2Profile(cid)).consensus;\n }\n\n function __cid2cssBatch(address[] memory cids) internal view returns (TConsensus[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyId2Consensus(cids);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\n return address(0x67);\n }\n\n /**\n * @dev Validates the two submitted block header if they are produced by the same address\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal view virtual returns (bool _validEvidence) {\n address _smc = precompileValidateDoubleSignAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\n \"validatingDoubleSignProof(address,bytes,bytes)\",\n _consensusAddr,\n _header1,\n _header2\n );\n uint _payloadLength = _payload.length;\n uint[1] memory _output;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n }\n\n if (!_success) revert ErrCallPrecompiled();\n return (_output[0] != 0);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateFastFinality.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateFastFinality is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateFastFinalityAddress() public view virtual returns (address) {\n return address(0x69);\n }\n\n /**\n * @dev Validates the proof of malicious voting on fast finality\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateFastFinalityEvidence(\n bytes memory voterPublicKey,\n uint256 targetBlockNumber,\n bytes32[2] memory targetBlockHash,\n bytes[][2] memory listOfPublicKey,\n bytes[2] memory aggregatedSignature\n ) internal view virtual returns (bool validEvidence) {\n address smc = precompileValidateFastFinalityAddress();\n bool success = true;\n\n bytes memory payload = abi.encodeWithSignature(\n \"validateFinalityVoteProof(bytes,uint256,bytes32[2],bytes[][2],bytes[2])\",\n voterPublicKey,\n targetBlockNumber,\n targetBlockHash,\n listOfPublicKey,\n aggregatedSignature\n );\n uint payloadLength = payload.length;\n uint[1] memory output;\n\n assembly {\n let payloadStart := add(payload, 0x20)\n if iszero(staticcall(gas(), smc, payloadStart, payloadLength, output, 0x20)) {\n success := 0\n }\n\n if iszero(returndatasize()) {\n success := 0\n }\n }\n\n if (!success) revert ErrCallPrecompiled();\n return (output[0] != 0);\n }\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/profile/Profile_Mainnet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"./Profile.sol\";\n\npragma solidity ^0.8.9;\n\ncontract Profile_Mainnet is Profile {\n function __migrationRenouncedCandidates() internal override onlyInitializing {\n if (block.chainid != 2020) return;\n\n CandidateProfile storage _profile;\n\n address[4] memory lConsensus = __consensuses();\n address[4] memory lAdmin = __admins();\n address[4] memory lTreasury = __treasuries();\n\n for (uint i; i < lConsensus.length; ++i) {\n address id = lConsensus[i];\n\n _profile = _id2Profile[id];\n _profile.id = id;\n _setConsensus(_profile, TConsensus.wrap(id));\n _setAdmin(_profile, lAdmin[i]);\n _setTreasury(_profile, payable(lTreasury[i]));\n }\n }\n\n function __admins() private pure returns (address[4] memory list) {\n return [\n 0xdb3b1F69259f88Ce9d58f3738e15e3CC1B5A8563,\n 0x335fE9EF827a9F27CBAb819b31e5eE182c2081d7,\n 0xbCcB3FDa2B9e3Ab5b824AA9D5c1C4A62A98Da937,\n 0x9bc1946f1Aa6DA4667a6Ee966e66b9ec60637E10\n ];\n }\n\n function __consensuses() private pure returns (address[4] memory list) {\n return [\n 0x07d28F88D677C4056EA6722aa35d92903b2a63da,\n 0x262B9fcfe8CFA900aF4D1f5c20396E969B9655DD,\n 0x20238eB5643d4D7b7Ab3C30f3bf7B8E2B85cA1e7,\n 0x03A7B98C226225e330d11D1B9177891391Fa4f80\n ];\n }\n\n function __treasuries() private pure returns (address[4] memory list) {\n return [\n 0xdb3b1F69259f88Ce9d58f3738e15e3CC1B5A8563,\n 0x335fE9EF827a9F27CBAb819b31e5eE182c2081d7,\n 0xbCcB3FDa2B9e3Ab5b824AA9D5c1C4A62A98Da937,\n 0x9bc1946f1Aa6DA4667a6Ee966e66b9ec60637E10\n ];\n }\n}\n" + }, + "contracts/ronin/profile/Profile_Testnet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"./Profile.sol\";\n\npragma solidity ^0.8.9;\n\ncontract Profile_Testnet is Profile {\n function __migrationRenouncedCandidates() internal override onlyInitializing {\n if (block.chainid != 2021) return;\n\n CandidateProfile storage _profile;\n\n address[74] memory lConsensus = __consensuses();\n address[74] memory lAdmin = __admins();\n address[74] memory lTreasury = __treasuries();\n\n for (uint i; i < lConsensus.length; ++i) {\n address id = lConsensus[i];\n\n _profile = _id2Profile[id];\n _profile.id = id;\n _setConsensus(_profile, TConsensus.wrap(id));\n _setAdmin(_profile, lAdmin[i]);\n _setTreasury(_profile, payable(lTreasury[i]));\n }\n }\n\n function __admins() private pure returns (address[74] memory list) {\n return [\n 0xD682DC6D64710D6191512133dE957e146e9AA58f,\n 0xEFeaFf1d9f1E4EDB00c6084aE4016143B29Ed924,\n 0xC2caE7311FC0fe400A838d2dDe06A89E1d3e9Da7,\n 0xf90a912Fdb7Fd37572cD83325392d729e60Ef682,\n 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf,\n 0x8dA9d88F90141a03292d5e554691B1F6e7c6212c,\n 0xA87F9A2F0C7082FA2f1E3de1090D36047C7cD017,\n 0x6693dc258BDAAc5052ab678BA5de2440CA1cdAbe,\n 0x0B67dF5847aF7476B2EB46da328638E0fB2C6B29,\n 0xe91d1DCd0232BDa301379dE27bd0edE47Db3F750,\n 0xDc3de716C4430d598AC504c4685d69D0DcE1412F,\n 0x795CF28E5b71f1A50cC9E01077891C18D6587e53,\n 0xa3B3c71371331fD1901e316B67df2d16bF5535a0,\n 0x32Be208dE8A1595cC0ccf8E984CAB8759Ea1e5b2,\n 0x8136c74e94b08300d71Fa6C22087b821F73568c5,\n 0xda6c7342E90B77c5C77A8F7292765360099e30Ed,\n 0x95fC818CD7709fb6aD8920d0d14925010504876F,\n 0xe8E66b241414a40a3Db539eC7d864cD61938f817,\n 0xfD575770A68D5Af983b2A374981f604DdAD9D684,\n 0x9A54EDCb1D9a44e9f4235ea05c75B45b26679680,\n 0x6108570A29f500D6950fEbffC99ECB66a264A048,\n 0xdA071F710b0f82443866616E8a96069012A73ccf,\n 0x8A4ac64764238C71Ddf82F870BE6526e297Dc4Cd,\n 0x33f1727CaA54AE24CAdB2949881C3725eB61a100,\n 0x34DB532F09Ee1285DFEf26eD696c4eA25dcFce72,\n 0x302d51189FD89D7e72bcb26a65D16941d043F089,\n 0xFeb247F76E6F6C1Ec3455d04e6E3B694a577D57C,\n 0x05955d9e99f57E5574A1a9b73361DD14aEc8D641,\n 0xcf9F44dDB18a5538Efe2a2A28eF20300333f5a71,\n 0x779dCE1ddc28941Ec85bf2aE0dAC9F0f12836281,\n 0x0Bb270e5268a9E9a0742DdB027Fab7405Af56Fa7,\n 0x5b92Ea265597a7cf20C8dA56E6beb8485c1BA993,\n 0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3,\n 0xf6fd5FcA4Bd769BA495B29B98dba5F2eCF4CEED3,\n 0x8d0a639BDD3b81dF264c4dB46476658858231510,\n 0xBB046932fEFCDD3Be4368444a1014F25DfEE83f2,\n 0x54e09bF04810f387347dA6D9687D6a37EC2aadC7,\n 0xDE5e1554e2bF5d0E54BafC74C932b8F2aD4e273F,\n 0xc68d0255e1b9C549C43c7181BD29684DC477edfc,\n 0x37920733DB9A5b45fC9CD5e3C80825bEfFC1a014,\n 0x7e9107480Bf92dd56c97118E20CdB3c1Ae9dD866,\n 0xC4F83A7b369070E32CEd4Bd6Fd647D19AEf828AC,\n 0x412D4d69122839FcCAd0180e9358d157C3876f3C,\n 0x355503B8E64205FDE9dBBAD269110991cf736a50,\n 0x306f23c32fdfC07850Bf242E8Ff59C5E79BFf812,\n 0x467c5425042C9D9f025265b72C93D73E0F2978C5,\n 0xEE992B0F5E9746fdb8e584Efa01AF79f6B1C0940,\n 0xBD6342c0009f55131b7a51f627CE8Cc87879DD66,\n 0x57018e929Eb6fe50355bF1BF9D1d39cA466b7Fa0,\n 0xAd4e3D2F85b4C095742B500751CEE5c4B8f65A5b,\n 0x89A6A074dB8BcD3Fd60626107eA2aE576693F7c5,\n 0xCB742186fA056444766fA7cc52a0479E8F6DEDEA,\n 0x60C8117901Ab35738fcFd7157D393207eFCe8055,\n 0xAD70AD152E27E0923C4f11C63490FCFD904A4C36,\n 0xd8b47b81648d9e81e50b8cA21EA81F2E1B6929BB,\n 0xeCB1374172970a613A1970370B3ddeAD8F844733,\n 0x0472dCa02318B532Fcb0B056661EE7fD2Adc8a20,\n 0xdd00ACc07F3F7AFa90B5a22cFd56c0808b6444dd,\n 0x4d3302c69fac489E2F7373bCB2f101d3B378c4Ce,\n 0xe7685E437F34De2D36eA2e9AB13E5Ab871711A2C,\n 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf,\n 0x3F9Df0717099BAaA95A14B3CAA285DAdDAFb0609,\n 0x23Dffc4a93c374A91Fbc1c33075af012b68663F7,\n 0x79eC4d83D40c1Bd1419D8f561BE851FDa1EA32a6,\n 0x2D3f28780bFb7Ed6FB5547c309E1a6837e5bD12B,\n 0xa164e8B5F90ce42B0F531E3882cdE3F698e1121f,\n 0x4a4bc674A97737376cFE990aE2fE0d2B6E738393,\n 0xF61806B65278fFDbF8b04f832C59b65076798Fb6,\n 0x836eeEdd931575CCE4285c74C15DBdA9Edc3Dc4F,\n 0xbd95B0581585E4151793b183ee75d509fDE528B6,\n 0xA75B1Ce2f8C447caB6c13F313dfd806287aA47e2,\n 0x4D546475321b4cA2a91B101f26750092C05350cF,\n 0xFC2d29Da710F45168DE11e5C051CaA558088D52a,\n 0x1C70B8160E92D56E550caf02e1f2e5EC0Fdb551A\n ];\n }\n\n function __consensuses() private pure returns (address[74] memory list) {\n return [\n 0xD682dc6D64710D6191512133De957e146e9Aa58e,\n 0xEFeaFf1d9f1e4eDB00C6084ae4016143B29eD925,\n 0x57b572A9de68Bd29074e1C51c790Fc45C592ba39,\n 0xC0C2A56F9606bA109d37A0d18AF8E5bAA1e1C0aD,\n 0xaFB9554299491a34d303F2C5A91bebb162f6b2C1,\n 0x533f61B360e81f58919faB5C653724F71faf12ab,\n 0xa87F9A2F0C7082FA2f1E3De1090d36047c7cD018,\n 0x6693Dc258bDAaC5052aB678Ba5de2440ca1cDAb2,\n 0x96f78323481fc9abdb8Cc4D8aa50C1500AC93b92,\n 0xe91D1DcD0232BDa301379de27BD0edE47Db3f751,\n 0x981676e5E5164524e70f79AC45b52099EbDA8781,\n 0x795cf28e5B71f1A50cc9E01077891C18D6587E54,\n 0xa3b3C71371331fD1901e316B67DF2d16Bf5535A1,\n 0x32be208de8A1595cC0CcF8E984Cab8759Ea1e5b9,\n 0x2dc14d542B5478f206B296AcbCBfBCCEE6E8D248,\n 0xDA6C7342E90B77c5c77a8F7292765360099E30EE,\n 0x9D7EA2223e89A55a4ef69Ca993eae6FDE6E63371,\n 0xe8e66b241414a40a3db539EC7d864cD61938f818,\n 0x8fFF45d4a6A27F8256dF19D0DaDF7787CfbE56AA,\n 0x9a54EdCb1D9a44e9F4235EA05C75B45B26679681,\n 0x6108570A29F500D6950FEbFFc99eCB66a264a049,\n 0xDA071f710B0f82443866616E8a96069012A73cCE,\n 0x5f7f2AE316ec5C092d201744fe8337353ADB2BB3,\n 0x771DEc03db66a566a1DfE3fd635B3f8D404b9291,\n 0x71f9154ADc0bef39Bbe8dB1D060E6F239D2E10AE,\n 0x95908d03bA55c2a44688330b59E746Fdb2f17E3E,\n 0x3DB3abc65F203788836C8D50F6923C56f3f0FF7c,\n 0x05955D9e99f57E5574a1A9B73361Dd14aEC8D642,\n 0x283b4Baa1d0415603C81edc1C68FadD3C790837C,\n 0x2A5EB3f9CD4D6Ef49dc2a30041e4421af3303929,\n 0x3B9F2587d55E96276B09b258ac909D809961F6C2,\n 0x2576e6BC92A493F4DA6335C5E69BC0c272381C3A,\n 0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3,\n 0xf6fd5FcA4Bd769BA495B29B98dba5F2eCF4CEED3,\n 0xd9299FA321407a5d10c73d71C57Ca687A2A38Af6,\n 0x877eFEfFE7A23E42C39e2C99b977e4AA4BEC7517,\n 0x071b510C415d3f84C6F4C6291C49887cC56cac41,\n 0xDE5e1554e2bF5d0e54bAFC74c932b8f2Ad4E2730,\n 0xc68d0255E1b9C549C43C7181bd29684DC477eDf0,\n 0xC3fB7b95b874bfcBD1E722A2061f3adf217121d3,\n 0x36Fd0d4A075507a4E742631aA37DAD46a1F4c0da,\n 0x661549d7717C20ffa62AD359B7667Bbf5c82053B,\n 0x412d4d69122839fcCAd0180e9358D157C3876F3D,\n 0x355503B8E64205FDE9dBbAd269110991CF736a51,\n 0x12Cf444bf83Ed5B610d0089927EcD3baBC81Ff88,\n 0x467C5425042c9d9f025265b72c93D73e0f2978C6,\n 0xB6bc5bc0410773A3F86B1537ce7495C52e38f88B,\n 0xBd6342C0009f55131b7A51F627ce8Cc87879dD67,\n 0x35C78DefBd03E96b4E3eE6a73e9CD4C49d2b885a,\n 0xAD4e3d2f85b4C095742B500751CeE5C4b8F65A5C,\n 0x42c535deCcc071D9039b177Cb3AbF30411531b05,\n 0xb212F24D850a0Ed90F2889dee31870E7FF3fED6c,\n 0x60C8117901AB35738FcfD7157D393207Efce8056,\n 0x30b0215a442Ea3D3088Acd83cD5Fe2aA2bcd775A,\n 0xD21BeCe2D8206A3fFdBAeDb827f4D4bD0FF79e3d,\n 0x4EfA5C5Bbe7a257743335F200E86cD44eEa4dcD9,\n 0x0472dcA02318B532fcB0B056661ee7Fd2aDc8A21,\n 0xDD00ACc07f3f7Afa90B5A22CFd56c0808b6444Df,\n 0x4d3302c69fAc489E2f7373bCB2f101d3b378C4cF,\n 0x8c29604e1caE4af683c4fBdAD951F3F855890EA0,\n 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf,\n 0xF48C06c56D78F5106b8c5Fa234fCeB1d1c50096B,\n 0x626ECe2ad62F59700D2734A523FC6177005aC8b0,\n 0xc6C15480855add4eeBE365c89a9bb6f278E18254,\n 0xF6071F7905D4e4B6eBd27b819aAF8923d542FDDF,\n 0x8872fe6335267aDB4C40b9f8667095667B55dCD9,\n 0x4a4bc674A97737376cFE990aE2fE0d2B6E738393,\n 0x27550f4B37f0309C56ea67578Eb924B4c19eEEB7,\n 0x181A053fd961DC1377B84BE4E551ce277053e4C0,\n 0xf44C500a8515a5ACc900C921bC888b5b62DA6556,\n 0xF20293d569f0Ee7ECcdEF266D86EE382F8932866,\n 0xb1D4782962A407343Aa3765a599637932d241305,\n 0x7F53d703836abCaF1ca3D5607d80dd7d96e50d02,\n 0x78fD38faa30ea66702cc39383D2E84f9a4A56fA6\n ];\n }\n\n function __treasuries() private pure returns (address[74] memory list) {\n return [\n 0xD682DC6D64710D6191512133dE957e146e9AA58f,\n 0xEFeaFf1d9f1E4EDB00c6084aE4016143B29Ed924,\n 0xC2caE7311FC0fe400A838d2dDe06A89E1d3e9Da7,\n 0xf90a912Fdb7Fd37572cD83325392d729e60Ef682,\n 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf,\n 0x8dA9d88F90141a03292d5e554691B1F6e7c6212c,\n 0xA87F9A2F0C7082FA2f1E3de1090D36047C7cD017,\n 0x6693dc258BDAAc5052ab678BA5de2440CA1cdAbe,\n 0x0B67dF5847aF7476B2EB46da328638E0fB2C6B29,\n 0xe91d1DCd0232BDa301379dE27bd0edE47Db3F750,\n 0xDc3de716C4430d598AC504c4685d69D0DcE1412F,\n 0x795CF28E5b71f1A50cC9E01077891C18D6587e53,\n 0xa3B3c71371331fD1901e316B67df2d16bF5535a0,\n 0x32Be208dE8A1595cC0ccf8E984CAB8759Ea1e5b2,\n 0x8136c74e94b08300d71Fa6C22087b821F73568c5,\n 0xda6c7342E90B77c5C77A8F7292765360099e30Ed,\n 0x95fC818CD7709fb6aD8920d0d14925010504876F,\n 0xe8E66b241414a40a3Db539eC7d864cD61938f817,\n 0xfD575770A68D5Af983b2A374981f604DdAD9D684,\n 0x9A54EDCb1D9a44e9f4235ea05c75B45b26679680,\n 0x6108570A29f500D6950fEbffC99ECB66a264A048,\n 0xdA071F710b0f82443866616E8a96069012A73ccf,\n 0x8A4ac64764238C71Ddf82F870BE6526e297Dc4Cd,\n 0x33f1727CaA54AE24CAdB2949881C3725eB61a100,\n 0x34DB532F09Ee1285DFEf26eD696c4eA25dcFce72,\n 0x302d51189FD89D7e72bcb26a65D16941d043F089,\n 0xFeb247F76E6F6C1Ec3455d04e6E3B694a577D57C,\n 0x05955d9e99f57E5574A1a9b73361DD14aEc8D641,\n 0xcf9F44dDB18a5538Efe2a2A28eF20300333f5a71,\n 0x779dCE1ddc28941Ec85bf2aE0dAC9F0f12836281,\n 0x0Bb270e5268a9E9a0742DdB027Fab7405Af56Fa7,\n 0x5b92Ea265597a7cf20C8dA56E6beb8485c1BA993,\n 0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3,\n 0xf6fd5FcA4Bd769BA495B29B98dba5F2eCF4CEED3,\n 0x8d0a639BDD3b81dF264c4dB46476658858231510,\n 0xBB046932fEFCDD3Be4368444a1014F25DfEE83f2,\n 0x54e09bF04810f387347dA6D9687D6a37EC2aadC7,\n 0xDE5e1554e2bF5d0E54BafC74C932b8F2aD4e273F,\n 0xc68d0255e1b9C549C43c7181BD29684DC477edfc,\n 0x37920733DB9A5b45fC9CD5e3C80825bEfFC1a014,\n 0x7e9107480Bf92dd56c97118E20CdB3c1Ae9dD866,\n 0xC4F83A7b369070E32CEd4Bd6Fd647D19AEf828AC,\n 0x412D4d69122839FcCAd0180e9358d157C3876f3C,\n 0x355503B8E64205FDE9dBBAD269110991cf736a50,\n 0x306f23c32fdfC07850Bf242E8Ff59C5E79BFf812,\n 0x467c5425042C9D9f025265b72C93D73E0F2978C5,\n 0xEE992B0F5E9746fdb8e584Efa01AF79f6B1C0940,\n 0xBD6342c0009f55131b7a51f627CE8Cc87879DD66,\n 0x57018e929Eb6fe50355bF1BF9D1d39cA466b7Fa0,\n 0xAd4e3D2F85b4C095742B500751CEE5c4B8f65A5b,\n 0x89A6A074dB8BcD3Fd60626107eA2aE576693F7c5,\n 0xCB742186fA056444766fA7cc52a0479E8F6DEDEA,\n 0x60C8117901Ab35738fcFd7157D393207eFCe8055,\n 0xAD70AD152E27E0923C4f11C63490FCFD904A4C36,\n 0xd8b47b81648d9e81e50b8cA21EA81F2E1B6929BB,\n 0xeCB1374172970a613A1970370B3ddeAD8F844733,\n 0x0472dCa02318B532Fcb0B056661EE7fD2Adc8a20,\n 0xdd00ACc07F3F7AFa90B5a22cFd56c0808b6444dd,\n 0x4d3302c69fac489E2F7373bCB2f101d3B378c4Ce,\n 0xe7685E437F34De2D36eA2e9AB13E5Ab871711A2C,\n 0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf,\n 0x3F9Df0717099BAaA95A14B3CAA285DAdDAFb0609,\n 0x23Dffc4a93c374A91Fbc1c33075af012b68663F7,\n 0x79eC4d83D40c1Bd1419D8f561BE851FDa1EA32a6,\n 0x2D3f28780bFb7Ed6FB5547c309E1a6837e5bD12B,\n 0xa164e8B5F90ce42B0F531E3882cdE3F698e1121f,\n 0x4a4bc674A97737376cFE990aE2fE0d2B6E738393,\n 0xF61806B65278fFDbF8b04f832C59b65076798Fb6,\n 0x836eeEdd931575CCE4285c74C15DBdA9Edc3Dc4F,\n 0xbd95B0581585E4151793b183ee75d509fDE528B6,\n 0xA75B1Ce2f8C447caB6c13F313dfd806287aA47e2,\n 0x4D546475321b4cA2a91B101f26750092C05350cF,\n 0xFC2d29Da710F45168DE11e5C051CaA558088D52a,\n 0x1C70B8160E92D56E550caf02e1f2e5EC0Fdb551A\n ];\n }\n}\n" + }, + "contracts/ronin/profile/Profile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"./ProfileXComponents.sol\";\nimport { ErrUnauthorized, RoleAccess } from \"../../utils/CommonErrors.sol\";\nimport { ContractType } from \"../../utils/ContractType.sol\";\n\npragma solidity ^0.8.9;\n\ncontract Profile is IProfile, ProfileXComponents, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address validatorContract) external initializer {\n _setContract(ContractType.VALIDATOR, validatorContract);\n }\n\n function initializeV2(address stakingContract, address trustedOrgContract) external reinitializer(2) {\n _setContract(ContractType.STAKING, stakingContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, trustedOrgContract);\n\n address[] memory validatorCandidates = IRoninValidatorSet(getContract(ContractType.VALIDATOR))\n .getValidatorCandidates();\n TConsensus[] memory consensuses;\n assembly (\"memory-safe\") {\n consensuses := validatorCandidates\n }\n for (uint256 i; i < validatorCandidates.length; ++i) {\n _consensus2Id[consensuses[i]] = validatorCandidates[i];\n }\n\n __migrationRenouncedCandidates();\n }\n\n /**\n * @dev Add addresses of renounced candidates into registry. Only called during {initializeV2}F.\n */\n function __migrationRenouncedCandidates() internal virtual {}\n\n /**\n * @inheritdoc IProfile\n */\n function getId2Profile(address id) external view returns (CandidateProfile memory) {\n return _id2Profile[id];\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getManyId2Consensus(address[] calldata idList) external view returns (TConsensus[] memory consensusList) {\n consensusList = new TConsensus[](idList.length);\n unchecked {\n for (uint i; i < idList.length; ++i) {\n consensusList[i] = _id2Profile[idList[i]].consensus;\n }\n }\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getConsensus2Id(TConsensus consensus) external view returns (address id) {\n id = _consensus2Id[consensus];\n }\n\n /**\n * @inheritdoc IProfile\n */\n function getManyConsensus2Id(TConsensus[] calldata consensusList) external view returns (address[] memory idList) {\n idList = new address[](consensusList.length);\n unchecked {\n for (uint i; i < consensusList.length; ++i) {\n idList[i] = _consensus2Id[consensusList[i]];\n }\n }\n }\n\n /**\n * @inheritdoc IProfile\n */\n function addNewProfile(CandidateProfile memory profile) external onlyAdmin {\n CandidateProfile storage _profile = _id2Profile[profile.id];\n if (_profile.id != address(0)) revert ErrExistentProfile();\n _addNewProfile(_profile, profile);\n }\n\n /**\n * @inheritdoc IProfile\n *\n * @dev Side-effects on other contracts:\n * - Update Staking contract:\n * + [x] Update (id => PoolDetail) mapping in {BaseStaking.sol}.\n * + [x] Update `_adminOfActivePoolMapping` in {BaseStaking.sol}.\n * - Update Validator contract:\n * + [x] Update (id => ValidatorCandidate) mapping\n */\n function requestChangeAdminAddress(address id, address newAdminAddr) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _requireNonZeroAndNonDuplicated(RoleAccess.ADMIN, newAdminAddr);\n _setAdmin(_profile, newAdminAddr);\n\n IStaking stakingContract = IStaking(getContract(ContractType.STAKING));\n stakingContract.execChangeAdminAddress(id, newAdminAddr);\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n validatorContract.execChangeAdminAddress(id, newAdminAddr);\n\n emit ProfileAddressChanged(id, RoleAccess.ADMIN);\n }\n\n /**\n * @inheritdoc IProfile\n *\n * @dev Side-effects on other contracts:\n * - Update in Staking contract for Consensus address mapping:\n * + [x] Keep the same previous pool address.\n * - Update in Validator contract for:\n * + [x] Consensus Address mapping\n * + [x] Bridge Address mapping\n * + [x] Jail mapping\n * + [x] Pending reward mapping\n * + [x] Schedule mapping\n * - Update in Slashing contract for:\n * + [x] Handling slash indicator\n * + [x] Handling slash fast finality\n * + [x] Handling slash double sign\n * - Update in Proposal contract for:\n * + [-] Preserve the consensus address and recipient target of locked amount of emergency exit\n * - Update Trusted Org contracts:\n * + [x] Remove and delete weight of the old consensus\n * + [x] Replace and add weight for the new consensus\n */\n function requestChangeConsensusAddr(address id, TConsensus newConsensusAddr) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _requireNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(newConsensusAddr));\n\n TConsensus oldConsensusAddr = _profile.consensus;\n _setConsensus(_profile, newConsensusAddr);\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n validatorContract.execChangeConsensusAddress(id, newConsensusAddr);\n\n IRoninTrustedOrganization trustedOrgContract = IRoninTrustedOrganization(\n getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)\n );\n trustedOrgContract.execChangeConsensusAddressForTrustedOrg({\n oldConsensusAddr: oldConsensusAddr,\n newConsensusAddr: newConsensusAddr\n });\n\n emit ProfileAddressChanged(id, RoleAccess.CONSENSUS);\n }\n\n /**\n * @inheritdoc IProfile\n *\n * @dev Side-effects on other contracts:\n * - Update Validator contract:\n * + [x] Update (id => ValidatorCandidate) mapping\n * - Update governance admin:\n * + [-] Update recipient in the EmergencyExitBallot to the newTreasury.\n * Cannot impl since we cannot cancel the previous the ballot and\n * create a new ballot on behalf of the validator contract.\n */\n function requestChangeTreasuryAddr(address id, address payable newTreasury) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _requireNonZeroAndNonDuplicated(RoleAccess.TREASURY, newTreasury);\n _setTreasury(_profile, newTreasury);\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n validatorContract.execChangeTreasuryAddress(id, newTreasury);\n\n emit ProfileAddressChanged(id, RoleAccess.TREASURY);\n }\n\n /**\n * @inheritdoc IProfile\n */\n function changePubkey(address id, bytes memory pubkey) external {\n CandidateProfile storage _profile = _getId2ProfileHelper(id);\n _requireCandidateAdmin(_profile);\n _requireNonDuplicatedPubkey(pubkey);\n _setPubkey(_profile, pubkey);\n\n emit PubkeyChanged(id, pubkey);\n }\n\n function _requireCandidateAdmin(CandidateProfile storage sProfile) internal view {\n if (\n msg.sender != sProfile.admin ||\n !IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isCandidateAdmin(sProfile.consensus, msg.sender)\n ) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);\n }\n}\n" + }, + "contracts/ronin/profile/ProfileHandler.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../udvts/Types.sol\";\nimport \"../../utils/RoleAccess.sol\";\nimport { ProfileStorage } from \"./ProfileStorage.sol\";\n\nabstract contract ProfileHandler is ProfileStorage {\n /**\n * @dev Checks each element in the new profile and reverts if there is duplication with any existing profile.\n */\n function _requireNonDuplicatedInRegistry(CandidateProfile memory profile) internal view {\n _requireNonZeroAndNonDuplicated(RoleAccess.CONSENSUS, TConsensus.unwrap(profile.consensus));\n _requireNonZeroAndNonDuplicated(RoleAccess.CANDIDATE_ADMIN, profile.admin);\n _requireNonZeroAndNonDuplicated(RoleAccess.TREASURY, profile.treasury);\n _requireNonDuplicated(RoleAccess.TREASURY, profile.__reservedGovernor);\n _requireNonDuplicatedPubkey(profile.pubkey);\n }\n\n function _requireNonZeroAndNonDuplicated(RoleAccess addressType, address addr) internal view {\n if (addr == address(0)) revert ErrZeroAddress(addressType);\n _requireNonDuplicated(addressType, addr);\n }\n\n function _requireNonDuplicated(RoleAccess addressType, address addr) internal view {\n if (_checkNonDuplicatedAddr(addr)) {\n revert ErrDuplicatedInfo(addressType, uint256(uint160(addr)));\n }\n }\n\n function _checkNonDuplicatedAddr(address addr) internal view returns (bool) {\n return _registry[uint256(uint160(addr))];\n }\n\n function _requireNonDuplicatedPubkey(bytes memory pubkey) internal view {\n if (_checkNonDuplicatedPubkey(pubkey)) {\n revert ErrDuplicatedPubkey(pubkey);\n }\n }\n\n function _checkNonDuplicatedPubkey(bytes memory pubkey) internal view returns (bool) {\n return _registry[_hashPubkey(pubkey)];\n }\n}\n" + }, + "contracts/ronin/profile/ProfileStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../udvts/Types.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { IProfile } from \"../../interfaces/IProfile.sol\";\n\nabstract contract ProfileStorage is IProfile, HasContracts {\n /// @dev Mapping from id address => candidate profile.\n mapping(address => CandidateProfile) internal _id2Profile;\n\n /**\n * @dev Mapping from any address or keccak256(pubkey) => whether it is already registered.\n * This registry can only be toggled to `true` and NOT vice versa. All registered values\n * cannot be reused.\n */\n mapping(uint256 => bool) internal _registry;\n\n /// @dev Mapping from consensus address => id address.\n mapping(TConsensus => address) internal _consensus2Id;\n\n /// @dev Upgradeable gap.\n bytes32[48] __gap;\n\n /**\n * @dev Add a profile from memory to storage.\n */\n function _addNewProfile(CandidateProfile storage _profile, CandidateProfile memory newProfile) internal {\n _profile.id = newProfile.id;\n\n _setConsensus(_profile, newProfile.consensus);\n _setAdmin(_profile, newProfile.admin);\n _setTreasury(_profile, newProfile.treasury);\n _setGovernor(_profile, newProfile.__reservedGovernor);\n _setPubkey(_profile, newProfile.pubkey);\n\n emit ProfileAdded(newProfile.id);\n }\n\n function _setConsensus(CandidateProfile storage _profile, TConsensus consensus) internal {\n delete _consensus2Id[_profile.consensus];\n _consensus2Id[consensus] = _profile.id;\n\n _profile.consensus = consensus;\n _registry[uint256(uint160(TConsensus.unwrap(consensus)))] = true;\n }\n\n function _setAdmin(CandidateProfile storage _profile, address admin) internal {\n _profile.admin = admin;\n _registry[uint256(uint160(admin))] = true;\n }\n\n function _setTreasury(CandidateProfile storage _profile, address payable treasury) internal {\n _profile.treasury = treasury;\n _registry[uint256(uint160(address(treasury)))] = true;\n }\n\n /**\n * @dev Allow to registry a profile without governor address since not all validators are governing validators.\n */\n function _setGovernor(CandidateProfile storage _profile, address governor) internal {\n _profile.__reservedGovernor = governor;\n if (governor != address(0)) {\n _registry[uint256(uint160(governor))] = true;\n }\n }\n\n function _setPubkey(CandidateProfile storage _profile, bytes memory pubkey) internal {\n _profile.pubkey = pubkey;\n _registry[_hashPubkey(pubkey)] = true;\n }\n\n /**\n * @dev Get an existed profile struct from `id`. Revert if the profile does not exists.\n */\n function _getId2ProfileHelper(address id) internal view returns (CandidateProfile storage _profile) {\n _profile = _id2Profile[id];\n if (_profile.id == address(0)) revert ErrNonExistentProfile();\n }\n\n /**\n * @dev Returns hash of a public key.\n */\n function _hashPubkey(bytes memory pubkey) internal pure returns (uint256) {\n return uint256(keccak256(pubkey));\n }\n}\n" + }, + "contracts/ronin/profile/ProfileXComponents.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"../../interfaces/IProfile.sol\";\nimport { ContractType } from \"../../utils/ContractType.sol\";\nimport \"./ProfileHandler.sol\";\n\npragma solidity ^0.8.9;\n\nabstract contract ProfileXComponents is IProfile, ProfileHandler {\n /**\n * @inheritdoc IProfile\n */\n function execApplyValidatorCandidate(\n address admin,\n address id,\n address treasury,\n bytes calldata pubkey\n ) external override onlyContract(ContractType.STAKING) {\n // Check existent profile\n CandidateProfile storage _profile = _id2Profile[id];\n if (_profile.id != address(0)) revert ErrExistentProfile();\n\n // Validate the info and add the profile\n CandidateProfile memory profile = CandidateProfile({\n id: id,\n consensus: TConsensus.wrap(id),\n admin: admin,\n treasury: payable(treasury),\n __reservedGovernor: address(0),\n pubkey: pubkey\n });\n _requireNonDuplicatedInRegistry(profile);\n _addNewProfile(_profile, profile);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/CreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/IMaintenance.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/slash-indicator/ICreditScore.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/Math.sol\";\nimport { HasValidatorDeprecated, HasMaintenanceDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport { ErrUnauthorized, RoleAccess } from \"../../utils/CommonErrors.sol\";\n\nabstract contract CreditScore is\n ICreditScore,\n HasContracts,\n HasValidatorDeprecated,\n HasMaintenanceDeprecated,\n PercentageConsumer\n{\n /// @dev Mapping from validator id => period index => whether bailed out before\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\n /// @dev Mapping from validator address => credit score\n mapping(address => uint256) internal _creditScore;\n\n /// @dev The max gained number of credit score per period.\n uint256 internal _gainCreditScore;\n /// @dev The max number of credit score that a validator can hold.\n uint256 internal _maxCreditScore;\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n uint256 internal _bailOutCostMultiplier;\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\n uint256 internal _cutOffPercentageAfterBailout;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ICreditScore\n */\n function execUpdateCreditScores(\n address[] calldata validatorIds,\n uint256 period\n ) external override onlyContract(ContractType.VALIDATOR) {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(msg.sender);\n uint256 periodStartAtBlock = validatorContract.currentPeriodStartAtBlock();\n\n bool[] memory jaileds = validatorContract.checkManyJailedById(validatorIds);\n bool[] memory maintaineds = IMaintenance(getContract(ContractType.MAINTENANCE)).checkManyMaintainedInBlockRangeById(\n validatorIds,\n periodStartAtBlock,\n block.number\n );\n uint256[] memory updatedCreditScores = new uint256[](validatorIds.length);\n\n for (uint i = 0; i < validatorIds.length; ) {\n address vId = validatorIds[i];\n\n uint256 indicator = _getUnavailabilityIndicatorById(vId, period);\n bool isJailedInPeriod = jaileds[i];\n bool isMaintainingInPeriod = maintaineds[i];\n\n uint256 _actualGain = (isJailedInPeriod || isMaintainingInPeriod)\n ? 0\n : Math.subNonNegative(_gainCreditScore, indicator);\n\n _creditScore[vId] = Math.addWithUpperbound(_creditScore[vId], _actualGain, _maxCreditScore);\n updatedCreditScores[i] = _creditScore[vId];\n unchecked {\n ++i;\n }\n }\n\n emit CreditScoresUpdated(validatorIds, updatedCreditScores);\n }\n\n function execResetCreditScores(\n address[] calldata validatorIds\n ) external override onlyContract(ContractType.VALIDATOR) {\n uint256[] memory updatedCreditScores = new uint256[](validatorIds.length);\n for (uint i = 0; i < validatorIds.length; ) {\n address _validator = validatorIds[i];\n delete _creditScore[_validator];\n delete updatedCreditScores[i];\n\n unchecked {\n ++i;\n }\n }\n emit CreditScoresUpdated(validatorIds, updatedCreditScores);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function bailOut(TConsensus consensusAddr) external override {\n address validatorId = __css2cid(consensusAddr);\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n if (!validatorContract.isValidatorCandidate(consensusAddr))\n revert ErrUnauthorized(msg.sig, RoleAccess.VALIDATOR_CANDIDATE);\n\n if (!validatorContract.isCandidateAdmin(consensusAddr, msg.sender))\n revert ErrUnauthorized(msg.sig, RoleAccess.CANDIDATE_ADMIN);\n\n (bool isJailed, , uint256 jailedEpochLeft) = validatorContract.getJailedTimeLeft(consensusAddr);\n if (!isJailed) revert ErrCallerMustBeJailedInTheCurrentPeriod();\n\n uint256 period = validatorContract.currentPeriod();\n if (_checkBailedOutAtPeriod[validatorId][period]) revert ErrValidatorHasBailedOutPreviously();\n\n uint256 score = _creditScore[validatorId];\n uint256 cost = jailedEpochLeft * _bailOutCostMultiplier;\n if (score < cost) revert ErrInsufficientCreditScoreToBailOut();\n\n validatorContract.execBailOut(validatorId, period);\n\n _creditScore[validatorId] -= cost;\n _setUnavailabilityIndicator(validatorId, period, 0);\n _checkBailedOutAtPeriod[validatorId][period] = true;\n emit BailedOut(consensusAddr, period, cost);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external override onlyAdmin {\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n\n /**\n * @dev See `ISlashUnavailability`\n */\n function _getUnavailabilityIndicatorById(address validator, uint256 period) internal view virtual returns (uint256);\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScoreConfigs()\n external\n view\n override\n returns (\n uint256 gainCreditScore_,\n uint256 maxCreditScore_,\n uint256 bailOutCostMultiplier_,\n uint256 cutOffPercentageAfterBailout_\n )\n {\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScore(TConsensus consensusAddr) external view override returns (uint256) {\n return _creditScore[__css2cid(consensusAddr)];\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getManyCreditScores(\n TConsensus[] calldata consensusAddrs\n ) public view override returns (uint256[] memory resultList) {\n address[] memory validatorIds = __css2cidBatch(consensusAddrs);\n resultList = new uint256[](validatorIds.length);\n\n for (uint i = 0; i < resultList.length; ) {\n resultList[i] = _creditScore[validatorIds[i]];\n\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(TConsensus consensus, uint256 period) external view override returns (bool) {\n return _checkBailedOutAtPeriodById(__css2cid(consensus), period);\n }\n\n function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool) {\n return _checkBailedOutAtPeriod[validatorId][period];\n }\n\n /**\n * @dev See `SlashUnavailability`.\n */\n function _setUnavailabilityIndicator(address _validator, uint256 period, uint256 _indicator) internal virtual;\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view virtual returns (address[] memory);\n\n /**\n * @dev See `ICreditScore-setCreditScoreConfigs`.\n */\n function _setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) internal {\n if (_gainScore > _maxScore) revert ErrInvalidCreditScoreConfig();\n if (_cutOffPercentage > _MAX_PERCENTAGE) revert ErrInvalidCutOffPercentageConfig();\n\n _gainCreditScore = _gainScore;\n _maxCreditScore = _maxScore;\n _bailOutCostMultiplier = _bailOutMultiplier;\n _cutOffPercentageAfterBailout = _cutOffPercentage;\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/DeprecatedSlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasProxyAdmin.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\nabstract contract DeprecatedSlashBridgeOperator is HasProxyAdmin, HasContracts, HasValidatorDeprecated {\n /**\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\n * Values 0-10,000 map to 0%-100%.\n */\n uint256 private ____deprecatedMissingVotesRatioTier1;\n /**\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\n * more than the ratio. Values 0-10,000 map to 0%-100%.\n */\n uint256 private ____deprecatedMissingVotesRatioTier2;\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\n uint256 private ____deprecatedJailDurationForMissingVotesRatioTier2;\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\n uint256 private ____deprecatedSkipBridgeOperatorSlashingThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n}\n" + }, + "contracts/ronin/slash-indicator/DeprecatedSlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport { HasValidatorDeprecated, HasTrustedOrgDeprecated, HasGovernanceAdminDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\n\n// TODO: remove this from slashing logic of consensus contract\nabstract contract DeprecatedSlashBridgeVoting is\n HasContracts,\n HasValidatorDeprecated,\n HasTrustedOrgDeprecated,\n HasGovernanceAdminDeprecated\n{\n /// @dev Mapping from validator address => period index => bridge voting slashed\n mapping(address => mapping(uint256 => bool)) private __deprecatedBridgeVotingSlashed;\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\n uint256 private __deprecatedBridgeVotingThreshold;\n /// @dev The amount of RON to slash bridge voting.\n uint256 private __deprecatedBridgeVotingSlashAmount;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n}\n" + }, + "contracts/ronin/slash-indicator/SlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashDoubleSign.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\n\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasContracts, HasValidatorDeprecated, PCUValidateDoubleSign {\n /// @dev The amount of RON to slash double sign.\n uint256 internal _slashDoubleSignAmount;\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\n uint256 internal _doubleSigningJailUntilBlock;\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\n * This parameter is exposed for system transaction.\n **/\n uint256 internal _doubleSigningOffsetLimitBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) _submittedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[24] private ______gap;\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function slashDoubleSign(\n TConsensus consensusAddr,\n bytes calldata header1,\n bytes calldata header2\n ) external override onlyAdmin {\n bytes32 header1Checksum = keccak256(header1);\n bytes32 header2Checksum = keccak256(header2);\n\n if (_submittedEvidence[header1Checksum] || _submittedEvidence[header2Checksum]) {\n revert ErrEvidenceAlreadySubmitted();\n }\n\n address validatorId = __css2cid(consensusAddr);\n\n // NOTE: Edge case: non-validator who never apply for the candidate role, nor have a profile.\n // Must be slashed by the consensus address, since the validatorId will be address(0).\n if (validatorId == address(0)) {\n validatorId = TConsensus.unwrap(consensusAddr);\n }\n\n if (_pcValidateEvidence(validatorId, header1, header2)) {\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 period = validatorContract.currentPeriod();\n _submittedEvidence[header1Checksum] = true;\n _submittedEvidence[header2Checksum] = true;\n emit Slashed(validatorId, SlashType.DOUBLE_SIGNING, period);\n validatorContract.execSlash(validatorId, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\n }\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n override\n returns (\n uint256 slashDoubleSignAmount_,\n uint256 doubleSigningJailUntilBlock_,\n uint256 doubleSigningOffsetLimitBlock_\n )\n {\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) external override onlyAdmin {\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\n }\n\n /**\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\n */\n function _setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) internal {\n _slashDoubleSignAmount = _slashAmount;\n _doubleSigningJailUntilBlock = _jailUntilBlock;\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool);\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashFastFinality.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashFastFinality.sol\";\nimport { IRoninValidatorSet } from \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport { IProfile } from \"../../interfaces/IProfile.sol\";\nimport { IRoninTrustedOrganization } from \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../precompile-usages/PCUValidateFastFinality.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport \"../../utils/CommonErrors.sol\";\n\nabstract contract SlashFastFinality is ISlashFastFinality, HasContracts, PCUValidateFastFinality {\n /// @dev The amount of RON to slash fast finality.\n uint256 internal _slashFastFinalityAmount;\n /// @dev The block number that the punished validator will be jailed until, due to malicious fast finality.\n uint256 internal _fastFinalityJailUntilBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) internal _processedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[21] private ______gap;\n\n modifier onlyGoverningValidator() {\n if (_getGovernorWeight(msg.sender) == 0) revert ErrUnauthorized(msg.sig, RoleAccess.GOVERNOR);\n _;\n }\n\n /**\n * @inheritdoc ISlashFastFinality\n */\n function slashFastFinality(\n TConsensus consensusAddr,\n bytes calldata voterPublicKey,\n uint256 targetBlockNumber,\n bytes32[2] calldata targetBlockHash,\n bytes[][2] calldata listOfPublicKey,\n bytes[2] calldata aggregatedSignature\n ) external override onlyGoverningValidator {\n address validatorId = __css2cid(consensusAddr);\n IProfile profileContract = IProfile(getContract(ContractType.PROFILE));\n bytes memory expectingPubKey = (profileContract.getId2Profile(validatorId)).pubkey;\n if (keccak256(voterPublicKey) != keccak256(expectingPubKey)) revert ErrInvalidArguments(msg.sig);\n\n bytes32 evidenceHash = keccak256(abi.encodePacked(consensusAddr, targetBlockNumber));\n if (_processedEvidence[evidenceHash]) revert ErrEvidenceAlreadySubmitted();\n\n if (\n _pcValidateFastFinalityEvidence(\n voterPublicKey,\n targetBlockNumber,\n targetBlockHash,\n listOfPublicKey,\n aggregatedSignature\n )\n ) {\n _processedEvidence[evidenceHash] = true;\n\n IRoninValidatorSet validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 period = validatorContract.currentPeriod();\n emit Slashed(validatorId, SlashType.FAST_FINALITY, period);\n validatorContract.execSlash({\n cid: validatorId,\n newJailedUntil: _fastFinalityJailUntilBlock,\n slashAmount: _slashFastFinalityAmount,\n cannotBailout: true\n });\n }\n }\n\n /**\n * @inheritdoc ISlashFastFinality\n */\n function getFastFinalitySlashingConfigs()\n external\n view\n override\n returns (uint256 slashFastFinalityAmount_, uint256 fastFinalityJailUntilBlock_)\n {\n return (_slashFastFinalityAmount, _fastFinalityJailUntilBlock);\n }\n\n /**\n * @inheritdoc ISlashFastFinality\n */\n function setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) external override onlyAdmin {\n _setFastFinalitySlashingConfigs(slashAmount, jailUntilBlock);\n }\n\n /**\n * @dev See `ISlashFastFinality-setFastFinalitySlashingConfigs`.\n */\n function _setFastFinalitySlashingConfigs(uint256 slashAmount, uint256 jailUntilBlock) internal {\n _slashFastFinalityAmount = slashAmount;\n _fastFinalityJailUntilBlock = jailUntilBlock;\n emit FastFinalitySlashingConfigsUpdated(slashAmount, jailUntilBlock);\n }\n\n /**\n * @dev Get governor, i.e. governing validator's weight, of the `addr`.\n */\n function _getGovernorWeight(address addr) internal view returns (uint256) {\n return IRoninTrustedOrganization(getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).getGovernorWeight(addr);\n }\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\nimport \"../../interfaces/IProfile.sol\";\nimport \"./DeprecatedSlashBridgeOperator.sol\";\nimport \"./DeprecatedSlashBridgeVoting.sol\";\nimport \"./SlashDoubleSign.sol\";\nimport \"./SlashFastFinality.sol\";\nimport \"./SlashUnavailability.sol\";\nimport \"./CreditScore.sol\";\n\ncontract SlashIndicator is\n ISlashIndicator,\n SlashDoubleSign,\n SlashFastFinality,\n DeprecatedSlashBridgeVoting,\n DeprecatedSlashBridgeOperator,\n SlashUnavailability,\n CreditScore,\n Initializable\n{\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __roninGovernanceAdminContract,\n uint256[4] calldata /* _bridgeOperatorSlashingConfigs */,\n uint256[2] calldata /* _bridgeVotingSlashingConfigs */,\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\n uint256[3] calldata _doubleSignSlashingConfigs,\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\n uint256[4] calldata _unavailabilitySlashingConfigs,\n // _creditScoreConfigs[0]: _gainCreditScore\n // _creditScoreConfigs[1]: _maxCreditScore\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\n uint256[4] calldata _creditScoreConfigs\n ) external initializer {\n _setContract(ContractType.VALIDATOR, __validatorContract);\n _setContract(ContractType.MAINTENANCE, __maintenanceContract);\n _setContract(ContractType.GOVERNANCE_ADMIN, __roninGovernanceAdminContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, __roninTrustedOrganizationContract);\n\n _setDoubleSignSlashingConfigs(\n _doubleSignSlashingConfigs[0],\n _doubleSignSlashingConfigs[1],\n _doubleSignSlashingConfigs[2]\n );\n _setUnavailabilitySlashingConfigs(\n _unavailabilitySlashingConfigs[0],\n _unavailabilitySlashingConfigs[1],\n _unavailabilitySlashingConfigs[2],\n _unavailabilitySlashingConfigs[3]\n );\n _setCreditScoreConfigs(\n _creditScoreConfigs[0],\n _creditScoreConfigs[1],\n _creditScoreConfigs[2],\n _creditScoreConfigs[3]\n );\n }\n\n function initializeV2(address roninGovernanceAdminContract) external reinitializer(2) {\n _setContract(ContractType.VALIDATOR, ______deprecatedValidator);\n _setContract(ContractType.MAINTENANCE, ______deprecatedMaintenance);\n _setContract(ContractType.GOVERNANCE_ADMIN, roninGovernanceAdminContract);\n _setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, ______deprecatedTrustedOrg);\n\n delete ______deprecatedValidator;\n delete ______deprecatedMaintenance;\n delete ______deprecatedTrustedOrg;\n delete ______deprecatedGovernanceAdmin;\n }\n\n function initializeV3(address profileContract) external reinitializer(3) {\n _setContract(ContractType.PROFILE, profileContract);\n _setFastFinalitySlashingConfigs(_slashDoubleSignAmount, _doubleSigningJailUntilBlock);\n }\n\n /**\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\n */\n function _setUnavailabilityIndicator(\n address validator,\n uint256 period,\n uint256 indicator\n ) internal override(CreditScore, SlashUnavailability) {\n SlashUnavailability._setUnavailabilityIndicator(validator, period, indicator);\n }\n\n /**\n * @dev Helper for CreditScore contract to query indicator of the validator.\n */\n function _getUnavailabilityIndicatorById(\n address validatorId,\n uint256 period\n ) internal view override(CreditScore, SlashUnavailability) returns (uint256) {\n return SlashUnavailability._getUnavailabilityIndicatorById(validatorId, period);\n }\n\n function _checkBailedOutAtPeriodById(\n address cid,\n uint256 period\n ) internal view override(CreditScore, SlashUnavailability) returns (bool) {\n return CreditScore._checkBailedOutAtPeriodById(cid, period);\n }\n\n /**\n * @dev Sanity check the address to be slashed\n */\n function _shouldSlash(\n TConsensus consensus,\n address validatorId\n ) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\n return\n (msg.sender != TConsensus.unwrap(consensus)) &&\n (msg.sender != validatorId) &&\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).isBlockProducer(consensus) &&\n !IMaintenance(getContract(ContractType.MAINTENANCE)).checkMaintainedById(validatorId, block.number);\n }\n\n function __css2cid(\n TConsensus consensusAddr\n ) internal view override(CreditScore, SlashDoubleSign, SlashUnavailability, SlashFastFinality) returns (address) {\n return IProfile(getContract(ContractType.PROFILE)).getConsensus2Id(consensusAddr);\n }\n\n function __css2cidBatch(TConsensus[] memory consensusAddrs) internal view override returns (address[] memory) {\n return IProfile(getContract(ContractType.PROFILE)).getManyConsensus2Id(consensusAddrs);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./CreditScore.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/slash-indicator/ISlashUnavailability.sol\";\nimport \"../../extensions/collections/HasContracts.sol\";\nimport { HasValidatorDeprecated } from \"../../utils/DeprecatedSlots.sol\";\nimport { ErrInvalidThreshold } from \"../../utils/CommonErrors.sol\";\n\nabstract contract SlashUnavailability is ISlashUnavailability, HasContracts, HasValidatorDeprecated {\n /// @dev The last block that a validator is slashed for unavailability.\n uint256 internal _lastUnavailabilitySlashedBlock;\n /// @dev Mapping from validator address => period index => unavailability indicator.\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\n\n /**\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\n */\n uint256 internal _unavailabilityTier1Threshold;\n /**\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n */\n uint256 internal _unavailabilityTier2Threshold;\n /**\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\n * tier-2 or tier-3.\n **/\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n modifier oncePerBlock() {\n if (block.number <= _lastUnavailabilitySlashedBlock) {\n revert ErrCannotSlashAValidatorTwiceOrSlashMoreThanOneValidatorInOneBlock();\n }\n\n _lastUnavailabilitySlashedBlock = block.number;\n _;\n }\n\n function lastUnavailabilitySlashedBlock() external view returns (uint256) {\n return _lastUnavailabilitySlashedBlock;\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function slashUnavailability(TConsensus consensusAddr) external override oncePerBlock {\n if (msg.sender != block.coinbase) revert ErrUnauthorized(msg.sig, RoleAccess.COINBASE);\n\n address validatorId = __css2cid(consensusAddr);\n if (!_shouldSlash(consensusAddr, validatorId)) {\n // Should return instead of throwing error since this is a part of system transaction.\n return;\n }\n\n IRoninValidatorSet _validatorContract = IRoninValidatorSet(getContract(ContractType.VALIDATOR));\n uint256 period = _validatorContract.currentPeriod();\n uint256 count;\n unchecked {\n count = ++_unavailabilityIndicator[validatorId][period];\n }\n uint256 newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\n\n if (count == _unavailabilityTier2Threshold) {\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_2, period);\n _validatorContract.execSlash(\n validatorId,\n newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n false\n );\n } else if (count == _unavailabilityTier1Threshold) {\n bool tier1SecondTime = _checkBailedOutAtPeriodById(validatorId, period);\n if (!tier1SecondTime) {\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_1, period);\n _validatorContract.execSlash(validatorId, 0, 0, false);\n } else {\n /// Handles tier-3\n emit Slashed(validatorId, SlashType.UNAVAILABILITY_TIER_3, period);\n _validatorContract.execSlash(\n validatorId,\n newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n true\n );\n }\n }\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external override onlyAdmin {\n _setUnavailabilitySlashingConfigs(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n override\n returns (\n uint256 unavailabilityTier1Threshold_,\n uint256 unavailabilityTier2Threshold_,\n uint256 slashAmountForUnavailabilityTier2Threshold_,\n uint256 jailDurationForUnavailabilityTier2Threshold_\n )\n {\n return (\n _unavailabilityTier1Threshold,\n _unavailabilityTier2Threshold,\n _slashAmountForUnavailabilityTier2Threshold,\n _jailDurationForUnavailabilityTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function currentUnavailabilityIndicator(TConsensus consensus) external view override returns (uint256) {\n return\n _getUnavailabilityIndicatorById(\n __css2cid(consensus),\n IRoninValidatorSet(getContract(ContractType.VALIDATOR)).currentPeriod()\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilityIndicator(\n TConsensus consensus,\n uint256 period\n ) external view virtual override returns (uint256) {\n return _getUnavailabilityIndicatorById(__css2cid(consensus), period);\n }\n\n function _getUnavailabilityIndicatorById(\n address validatorId,\n uint256 period\n ) internal view virtual returns (uint256) {\n return _unavailabilityIndicator[validatorId][period];\n }\n\n /**\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\n */\n function _setUnavailabilityIndicator(address _validator, uint256 _period, uint256 _indicator) internal virtual {\n _unavailabilityIndicator[_validator][_period] = _indicator;\n }\n\n /**\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\n */\n function _setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) internal {\n if (_unavailabilityTier1Threshold > _unavailabilityTier2Threshold) revert ErrInvalidThreshold(msg.sig);\n\n _unavailabilityTier1Threshold = _tier1Threshold;\n _unavailabilityTier2Threshold = _tier2Threshold;\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\n emit UnavailabilitySlashingConfigsUpdated(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(TConsensus consensus, address validatorId) internal view virtual returns (bool);\n\n /**\n * @dev See `ICreditScore-checkBailedOutAtPeriodById`\n */\n function _checkBailedOutAtPeriodById(address validatorId, uint256 period) internal view virtual returns (bool);\n\n function __css2cid(TConsensus consensusAddr) internal view virtual returns (address);\n}\n" + }, + "contracts/udvts/Types.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ntype TPoolId is address;\ntype TConsensus is address;\n\nusing { TPoolIdEq as == } for TPoolId global;\nusing { TConsensusEq as == } for TConsensus global;\n\nfunction TPoolIdEq(TPoolId a, TPoolId b) pure returns (bool) {\n return TPoolId.unwrap(a) == TPoolId.unwrap(b);\n}\n\nfunction TConsensusEq(TConsensus a, TConsensus b) pure returns (bool) {\n return TConsensus.unwrap(a) == TConsensus.unwrap(b);\n}\n" + }, + "contracts/utils/CommonErrors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { ContractType } from \"./ContractType.sol\";\nimport { RoleAccess } from \"./RoleAccess.sol\";\n\nerror ErrSyncTooFarPeriod(uint256 period, uint256 latestRewardedPeriod);\n\n/**\n * @dev Error raised when a bridge operator update operation fails.\n * @param bridgeOperator The address of the bridge operator that failed to update.\n */\nerror ErrBridgeOperatorUpdateFailed(address bridgeOperator);\n\n/**\n * @dev Error thrown when an address is expected to be an already created externally owned account (EOA).\n * This error indicates that the provided address is invalid for certain contract operations that require already created EOA.\n */\nerror ErrAddressIsNotCreatedEOA(address addr, bytes32 codehash);\n\n/**\n * @dev Error thrown when attempting to add a bridge operator that already exists in the contract.\n * This error indicates that the provided bridge operator address is already registered as a bridge operator in the contract.\n */\nerror ErrBridgeOperatorAlreadyExisted(address bridgeOperator);\n\n/**\n * @dev The error indicating an unsupported interface.\n * @param interfaceId The bytes4 interface identifier that is not supported.\n * @param addr The address where the unsupported interface was encountered.\n */\nerror ErrUnsupportedInterface(bytes4 interfaceId, address addr);\n\n/**\n * @dev Error thrown when the return data from a callback function is invalid.\n * @param callbackFnSig The signature of the callback function that returned invalid data.\n * @param register The address of the register where the callback function was invoked.\n * @param returnData The invalid return data received from the callback function.\n */\nerror ErrInvalidReturnData(bytes4 callbackFnSig, address register, bytes returnData);\n\n/**\n * @dev Error of set to non-contract.\n */\nerror ErrZeroCodeContract(address addr);\n\n/**\n * @dev Error indicating that arguments are invalid.\n */\nerror ErrInvalidArguments(bytes4 msgSig);\n\n/**\n * @dev Error indicating that given address is null when it should not.\n */\nerror ErrZeroAddress(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the provided threshold is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that the invalid threshold applies to.\n */\nerror ErrInvalidThreshold(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a function can only be called by the contract itself.\n * @param msgSig The function signature (bytes4) that can only be called by the contract itself.\n */\nerror ErrOnlySelfCall(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\n * @param expectedRole The role required to perform the function.\n */\nerror ErrUnauthorized(bytes4 msgSig, RoleAccess expectedRole);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4) that the caller is unauthorized to perform.\n */\nerror ErrUnauthorizedCall(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the caller is unauthorized to perform a specific function.\n * @param msgSig The function signature (bytes4).\n * @param expectedContractType The contract type required to perform the function.\n * @param actual The actual address that called to the function.\n */\nerror ErrUnexpectedInternalCall(bytes4 msgSig, ContractType expectedContractType, address actual);\n\n/**\n * @dev Error indicating that an array is empty when it should contain elements.\n */\nerror ErrEmptyArray();\n\n/**\n * @dev Error indicating a mismatch in the length of input parameters or arrays for a specific function.\n * @param msgSig The function signature (bytes4) that has a length mismatch.\n */\nerror ErrLengthMismatch(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a proxy call to an external contract has failed.\n * @param msgSig The function signature (bytes4) of the proxy call that failed.\n * @param extCallSig The function signature (bytes4) of the external contract call that failed.\n */\nerror ErrProxyCallFailed(bytes4 msgSig, bytes4 extCallSig);\n\n/**\n * @dev Error indicating that a function tried to call a precompiled contract that is not allowed.\n * @param msgSig The function signature (bytes4) that attempted to call a precompiled contract.\n */\nerror ErrCallPrecompiled(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a native token transfer has failed.\n * @param msgSig The function signature (bytes4) of the token transfer that failed.\n */\nerror ErrNativeTransferFailed(bytes4 msgSig);\n\n/**\n * @dev Error indicating that an order is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid order.\n */\nerror ErrInvalidOrder(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the chain ID is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid chain ID.\n * @param actual Current chain ID that executing function.\n * @param expected Expected chain ID required for the tx to success.\n */\nerror ErrInvalidChainId(bytes4 msgSig, uint256 actual, uint256 expected);\n\n/**\n * @dev Error indicating that a vote type is not supported.\n * @param msgSig The function signature (bytes4) of the operation that encountered an unsupported vote type.\n */\nerror ErrUnsupportedVoteType(bytes4 msgSig);\n\n/**\n * @dev Error indicating that the proposal nonce is invalid.\n * @param msgSig The function signature (bytes4) of the operation that encountered an invalid proposal nonce.\n */\nerror ErrInvalidProposalNonce(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a voter has already voted.\n * @param voter The address of the voter who has already voted.\n */\nerror ErrAlreadyVoted(address voter);\n\n/**\n * @dev Error indicating that a signature is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that encountered an invalid signature.\n */\nerror ErrInvalidSignatures(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a relay call has failed.\n * @param msgSig The function signature (bytes4) of the relay call that failed.\n */\nerror ErrRelayFailed(bytes4 msgSig);\n/**\n * @dev Error indicating that a vote weight is invalid for a specific function signature.\n * @param msgSig The function signature (bytes4) that encountered an invalid vote weight.\n */\nerror ErrInvalidVoteWeight(bytes4 msgSig);\n\n/**\n * @dev Error indicating that a query was made for an outdated bridge operator set.\n */\nerror ErrQueryForOutdatedBridgeOperatorSet();\n\n/**\n * @dev Error indicating that a request is invalid.\n */\nerror ErrInvalidRequest();\n\n/**\n * @dev Error indicating that a token standard is invalid.\n */\nerror ErrInvalidTokenStandard();\n\n/**\n * @dev Error indicating that a token is not supported.\n */\nerror ErrUnsupportedToken();\n\n/**\n * @dev Error indicating that a receipt kind is invalid.\n */\nerror ErrInvalidReceiptKind();\n\n/**\n * @dev Error indicating that a receipt is invalid.\n */\nerror ErrInvalidReceipt();\n\n/**\n * @dev Error indicating that an address is not payable.\n */\nerror ErrNonpayableAddress(address);\n\n/**\n * @dev Error indicating that the period is already processed, i.e. scattered reward.\n */\nerror ErrPeriodAlreadyProcessed(uint256 requestingPeriod, uint256 latestPeriod);\n\n/**\n * @dev Error thrown when an invalid vote hash is provided.\n */\nerror ErrInvalidVoteHash();\n\n/**\n * @dev Error thrown when querying for an empty vote.\n */\nerror ErrQueryForEmptyVote();\n\n/**\n * @dev Error thrown when querying for an expired vote.\n */\nerror ErrQueryForExpiredVote();\n\n/**\n * @dev Error thrown when querying for a non-existent vote.\n */\nerror ErrQueryForNonExistentVote();\n\n/**\n * @dev Error indicating that the method is only called once per block.\n */\nerror ErrOncePerBlock();\n\n/**\n * @dev Error of method caller must be coinbase\n */\nerror ErrCallerMustBeCoinbase();\n" + }, + "contracts/utils/ContractType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nenum ContractType {\n /* 0 */ UNKNOWN,\n /* 1 */ PAUSE_ENFORCER,\n /* 2 */ BRIDGE,\n /* 3 */ BRIDGE_TRACKING,\n /* 4 */ GOVERNANCE_ADMIN,\n /* 5 */ MAINTENANCE,\n /* 6 */ SLASH_INDICATOR,\n /* 7 */ STAKING_VESTING,\n /* 8 */ VALIDATOR,\n /* 9 */ STAKING,\n /* 10 */ RONIN_TRUSTED_ORGANIZATION,\n /* 11 */ BRIDGE_MANAGER,\n /* 12 */ BRIDGE_SLASH,\n /* 13 */ BRIDGE_REWARD,\n /* 14 */ FAST_FINALITY_TRACKING,\n /* 15 */ PROFILE\n}\n" + }, + "contracts/utils/DeprecatedSlots.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Deprecated Contracts\n * @dev These abstract contracts are deprecated and should not be used in new implementations.\n * They provide functionality related to various aspects of a smart contract but have been marked\n * as deprecated to indicate that they are no longer actively maintained or recommended for use.\n * The purpose of these contracts is to preserve the slots for already deployed contracts.\n */\ncontract HasSlashIndicatorDeprecated {\n /// @custom:deprecated Previously `_slashIndicatorContract` (non-zero value)\n address internal ______deprecatedSlashIndicator;\n}\n\ncontract HasStakingVestingDeprecated {\n /// @custom:deprecated Previously `_stakingVestingContract` (non-zero value)\n address internal ______deprecatedStakingVesting;\n}\n\ncontract HasBridgeDeprecated {\n /// @custom:deprecated Previously `_bridgeContract` (non-zero value)\n address internal ______deprecatedBridge;\n}\n\ncontract HasValidatorDeprecated {\n /// @custom:deprecated Previously `_validatorContract` (non-zero value)\n address internal ______deprecatedValidator;\n}\n\ncontract HasStakingDeprecated {\n /// @custom:deprecated Previously `_stakingContract` (non-zero value)\n address internal ______deprecatedStakingContract;\n}\n\ncontract HasMaintenanceDeprecated {\n /// @custom:deprecated Previously `_maintenanceContract` (non-zero value)\n address internal ______deprecatedMaintenance;\n}\n\ncontract HasTrustedOrgDeprecated {\n /// @custom:deprecated Previously `_trustedOrgContract` (non-zero value)\n address internal ______deprecatedTrustedOrg;\n}\n\ncontract HasGovernanceAdminDeprecated {\n /// @custom:deprecated Previously `_governanceAdminContract` (non-zero value)\n address internal ______deprecatedGovernanceAdmin;\n}\n\ncontract HasBridgeTrackingDeprecated {\n /// @custom:deprecated Previously `_bridgeTrackingContract` (non-zero value)\n address internal ______deprecatedBridgeTracking;\n}\n" + }, + "contracts/utils/IdentityGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { AddressArrayUtils } from \"../libraries/AddressArrayUtils.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport { TransparentUpgradeableProxyV2 } from \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport { ErrAddressIsNotCreatedEOA, ErrZeroAddress, ErrOnlySelfCall, ErrZeroCodeContract, ErrUnsupportedInterface } from \"./CommonErrors.sol\";\n\nabstract contract IdentityGuard {\n using AddressArrayUtils for address[];\n\n /// @dev value is equal to keccak256(abi.encode())\n /// @dev see: https://eips.ethereum.org/EIPS/eip-1052\n bytes32 internal constant CREATED_ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n\n /**\n * @dev Modifier to restrict functions to only be called by this contract.\n * @dev Reverts if the caller is not this contract.\n */\n modifier onlySelfCall() virtual {\n _requireSelfCall();\n _;\n }\n\n /**\n * @dev Modifier to ensure that the elements in the `arr` array are non-duplicates.\n * It calls the internal `_checkDuplicate` function to perform the duplicate check.\n *\n * Requirements:\n * - The elements in the `arr` array must not contain any duplicates.\n */\n modifier nonDuplicate(address[] memory arr) virtual {\n _requireNonDuplicate(arr);\n _;\n }\n\n /**\n * @dev Internal method to check the method caller.\n * @dev Reverts if the method caller is not this contract.\n */\n function _requireSelfCall() internal view virtual {\n if (msg.sender != address(this)) revert ErrOnlySelfCall(msg.sig);\n }\n\n /**\n * @dev Internal function to check if a contract address has code.\n * @param addr The address of the contract to check.\n * @dev Throws an error if the contract address has no code.\n */\n function _requireHasCode(address addr) internal view {\n if (addr.code.length == 0) revert ErrZeroCodeContract(addr);\n }\n\n /**\n * @dev Checks if an address is zero and reverts if it is.\n * @param addr The address to check.\n */\n function _requireNonZeroAddress(address addr) internal pure {\n if (addr == address(0)) revert ErrZeroAddress(msg.sig);\n }\n\n /**\n * @dev Check if arr is empty and revert if it is.\n * Checks if an array contains any duplicate addresses and reverts if duplicates are found.\n * @param arr The array of addresses to check.\n */\n function _requireNonDuplicate(address[] memory arr) internal pure {\n if (arr.hasDuplicate()) revert AddressArrayUtils.ErrDuplicated(msg.sig);\n }\n\n /**\n * @dev Internal function to require that the provided address is a created externally owned account (EOA).\n * This internal function is used to ensure that the provided address is a valid externally owned account (EOA).\n * It checks the codehash of the address against a predefined constant to confirm that the address is a created EOA.\n * @notice This method only works with non-state EOA accounts\n */\n function _requireCreatedEOA(address addr) internal view {\n _requireNonZeroAddress(addr);\n bytes32 codehash = addr.codehash;\n if (codehash != CREATED_ACCOUNT_HASH) revert ErrAddressIsNotCreatedEOA(addr, codehash);\n }\n\n /**\n * @dev Internal function to require that the specified contract supports the given interface. This method handle in\n * both case that the callee is either or not the proxy admin of the caller. If the contract does not support the\n * interface `interfaceId` or EIP165, a revert with the corresponding error message is triggered.\n *\n * @param contractAddr The address of the contract to check for interface support.\n * @param interfaceId The interface ID to check for support.\n */\n function _requireSupportsInterface(address contractAddr, bytes4 interfaceId) internal view {\n bytes memory supportsInterfaceParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));\n (bool success, bytes memory returnOrRevertData) = contractAddr.staticcall(supportsInterfaceParams);\n if (!success) {\n (success, returnOrRevertData) = contractAddr.staticcall(\n abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (supportsInterfaceParams))\n );\n if (!success) revert ErrUnsupportedInterface(interfaceId, contractAddr);\n }\n if (!abi.decode(returnOrRevertData, (bool))) revert ErrUnsupportedInterface(interfaceId, contractAddr);\n }\n}\n" + }, + "contracts/utils/RoleAccess.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nenum RoleAccess {\n /* 0 */ UNKNOWN,\n /* 1 */ ADMIN,\n /* 2 */ COINBASE,\n /* 3 */ GOVERNOR,\n /* 4 */ CANDIDATE_ADMIN,\n /* 5 */ WITHDRAWAL_MIGRATOR,\n /* 6 */ __DEPRECATED_BRIDGE_OPERATOR,\n /* 7 */ BLOCK_PRODUCER,\n /* 8 */ VALIDATOR_CANDIDATE,\n /* 9 */ CONSENSUS,\n /* 10 */ TREASURY\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index 877b15662..d66af8373 100644 --- a/foundry.toml +++ b/foundry.toml @@ -13,7 +13,7 @@ libs = [ # See more config options https://github.com/foundry-rs/foundry/tree/master/config -solc = '0.8.21' +solc = '0.8.22' extra_output = ["devdoc", "userdoc", "storagelayout"] evm_version = 'istanbul' cache_path = 'cache_foundry' diff --git a/hardhat.config.ts b/hardhat.config.ts index 9682b77cb..86ff1c260 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -96,7 +96,7 @@ const ethereum: NetworkUserConfig = { }; const compilerConfig: SolcUserConfig = { - version: '0.8.17', + version: '0.8.19', settings: { optimizer: { enabled: true, @@ -110,7 +110,7 @@ const config: HardhatUserConfig = { compilers: [compilerConfig], overrides: { 'contracts/ronin/validator/RoninValidatorSet.sol': { - version: '0.8.17', + version: '0.8.19', settings: { optimizer: { enabled: true, @@ -122,6 +122,7 @@ const config: HardhatUserConfig = { // and we want all generated code to be deterministic // https://docs.soliditylang.org/en/v0.8.17/metadata.html bytecodeHash: 'none', + useLiteralContent: true, }, }, }, diff --git a/logs/contract_code_sizes.log b/logs/contract_code_sizes.log index 1606b70e9..c54eb4886 100644 --- a/logs/contract_code_sizes.log +++ b/logs/contract_code_sizes.log @@ -1,175 +1,175 @@ - ·-------------------------------------------|---------------------------|----------------· - | Solc version: 0.8.17 · Optimizer enabled: true · Runs: 200 │ - ············································|···························|················· - | Contract Name · Size (KiB) · Change (KiB) │ - ············································|···························|················· - | Address · 0.084 · │ - ············································|···························|················· - | AddressArrayUtils · 0.084 · │ - ············································|···························|················· - | Ballot · 0.084 · │ - ············································|···························|················· - | BridgeOperatorsBallot · 0.162 · │ - ············································|···························|················· - | BridgeReward · 5.890 · │ - ············································|···························|················· - | BridgeSlash · 5.503 · │ - ············································|···························|················· - | BridgeTracking · 6.712 · │ - ············································|···························|················· - | ECDSA · 0.084 · │ - ············································|···························|················· - | EmergencyExitBallot · 0.084 · │ - ············································|···························|················· - | EnumerableSet · 0.084 · │ - ············································|···························|················· - | EnumFlags · 0.084 · │ - ············································|···························|················· - | ERC1967Proxy · 0.670 · │ - ············································|···························|················· - | ERC20 · 2.121 · │ - ············································|···························|················· - | ERC20PresetMinterPauser · 6.219 · │ - ············································|···························|················· - | ErrorHandler · 0.084 · │ - ············································|···························|················· - | FastFinalityTracking · 2.104 · │ - ············································|···························|················· - | Forwarder · 3.438 · │ - ············································|···························|················· - | GlobalProposal · 0.162 · │ - ············································|···························|················· - | HasBridgeDeprecated · 0.062 · │ - ············································|···························|················· - | HasBridgeTrackingDeprecated · 0.062 · │ - ············································|···························|················· - | HasGovernanceAdminDeprecated · 0.062 · │ - ············································|···························|················· - | HasMaintenanceDeprecated · 0.062 · │ - ············································|···························|················· - | HasSlashIndicatorDeprecated · 0.062 · │ - ············································|···························|················· - | HasStakingDeprecated · 0.062 · │ - ············································|···························|················· - | HasStakingVestingDeprecated · 0.062 · │ - ············································|···························|················· - | HasTrustedOrgDeprecated · 0.062 · │ - ············································|···························|················· - | HasValidatorDeprecated · 0.062 · │ - ············································|···························|················· - | IsolatedGovernance · 0.084 · │ - ············································|···························|················· - | LibTUint256Slot · 0.084 · │ - ············································|···························|················· - | MainchainBridgeManager · 18.883 · │ - ············································|···························|················· - | MainchainGatewayV3 · 17.804 · │ - ············································|···························|················· - | Maintenance · 5.359 · │ - ············································|···························|················· - | Math · 0.084 · │ - ············································|···························|················· - | MockActor · 0.269 · │ - ············································|···························|················· - | MockBridge · 1.272 · │ - ············································|···························|················· - | MockBridgeManager · 10.542 · │ - ············································|···························|················· - | MockBridgeReward · 6.611 · │ - ············································|···························|················· - | MockBridgeSlash · 5.656 · │ - ············································|···························|················· - | MockConditionalImplementControl · 3.278 · │ - ············································|···························|················· - | MockForwarderTarget · 1.312 · │ - ············································|···························|················· - | MockGatewayForTracking · 1.623 · │ - ············································|···························|················· - | MockLogicV1 · 0.442 · │ - ············································|···························|················· - | MockLogicV2 · 0.442 · │ - ············································|···························|················· - | MockLogicValidatorSetV1 · 0.484 · │ - ············································|···························|················· - | MockLogicValidatorSetV2 · 0.484 · │ - ············································|···························|················· - | MockPaymentFallback · 0.119 · │ - ············································|···························|················· - | MockPaymentFallbackExpensive · 0.295 · │ - ············································|···························|················· - | MockPCUPickValidatorSet · 1.246 · │ - ············································|···························|················· - | MockPCUSortValidators · 1.016 · │ - ············································|···························|················· - | MockPCUValidateDoubleSign · 0.839 · │ - ············································|···························|················· - | MockPCUValidateFastFinality · 1.652 · │ - ············································|···························|················· - | MockPrecompile · 4.054 · │ - ············································|···························|················· - | MockRoninBridgeManager · 24.007 · │ - ············································|···························|················· - | MockRoninGatewayV3Extended · 19.568 · │ - ············································|···························|················· - | MockRoninValidatorSetExtended · 23.961 · │ - ············································|···························|················· - | MockRoninValidatorSetOverridePrecompile · 23.158 · │ - ············································|···························|················· - | MockSlashIndicatorExtended · 16.420 · │ - ············································|···························|················· - | MockSorting · 3.030 · │ - ············································|···························|················· - | MockStaking · 4.519 · │ - ············································|···························|················· - | MockTransfer · 0.394 · │ - ············································|···························|················· - | MockTUint256Slot · 2.665 · │ - ············································|···························|················· - | MockValidatorContract · 0.168 · │ - ············································|···························|················· - | MockValidatorSet · 7.823 · │ - ············································|···························|················· - | NotifiedMigrator · 3.056 · │ - ············································|···························|················· - | PauseEnforcer · 4.441 · │ - ············································|···························|················· - | Profile · 5.095 · │ - ············································|···························|················· - | Proposal · 0.162 · │ - ············································|···························|················· - | ProxyAdmin · 1.644 · │ - ············································|···························|················· - | RoninBridgeManager · 23.714 · │ - ············································|···························|················· - | RoninGatewayV3 · 19.292 · │ - ············································|···························|················· - | RoninGovernanceAdmin · 14.471 · │ - ············································|···························|················· - | RoninTrustedOrganization · 7.671 · │ - ············································|···························|················· - | RoninValidatorSet · 19.215 · │ - ············································|···························|················· - | RoninValidatorSetTimedMigrator · 3.742 · │ - ············································|···························|················· - | SlashIndicator · 12.991 · │ - ············································|···························|················· - | Sorting · 0.084 · │ - ············································|···························|················· - | Staking · 14.430 · │ - ············································|···························|················· - | StakingVesting · 3.061 · │ - ············································|···························|················· - | StorageSlot · 0.084 · │ - ············································|···························|················· - | Strings · 0.084 · │ - ············································|···························|················· - | Token · 0.209 · │ - ············································|···························|················· - | Transfer · 0.162 · │ - ············································|···························|················· - | TransparentUpgradeableProxy · 2.034 · │ - ············································|···························|················· - | TransparentUpgradeableProxyV2 · 2.320 · │ - ············································|···························|················· - | VaultForwarder · 3.769 · │ - ·-------------------------------------------|---------------------------|----------------· + ·-------------------------------------------|--------------------------------|--------------------------------· + | Solc version: 0.8.19 · Optimizer enabled: true · Runs: 200 │ + ············································|································|································· + | Contract Name · Deployed size (KiB) (change) · Initcode size (KiB) (change) │ + ············································|································|································· + | Address · 0.084 · 0.138 │ + ············································|································|································· + | AddressArrayUtils · 0.084 · 0.138 │ + ············································|································|································· + | Ballot · 0.084 · 0.138 │ + ············································|································|································· + | BridgeOperatorsBallot · 0.162 · 0.217 │ + ············································|································|································· + | BridgeReward · 5.890 · 6.124 │ + ············································|································|································· + | BridgeSlash · 5.503 · 5.722 │ + ············································|································|································· + | BridgeTracking · 6.712 · 6.956 │ + ············································|································|································· + | ECDSA · 0.084 · 0.138 │ + ············································|································|································· + | EmergencyExitBallot · 0.084 · 0.138 │ + ············································|································|································· + | EnumerableSet · 0.084 · 0.138 │ + ············································|································|································· + | EnumFlags · 0.084 · 0.138 │ + ············································|································|································· + | ERC1967Proxy · 0.173 · 1.207 │ + ············································|································|································· + | ERC20 · 2.121 · 2.859 │ + ············································|································|································· + | ERC20PresetMinterPauser · 6.219 · 7.394 │ + ············································|································|································· + | ErrorHandler · 0.084 · 0.138 │ + ············································|································|································· + | FastFinalityTracking · 2.104 · 2.335 │ + ············································|································|································· + | Forwarder · 3.438 · 4.293 │ + ············································|································|································· + | GlobalProposal · 0.162 · 0.217 │ + ············································|································|································· + | HasBridgeDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasBridgeTrackingDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasGovernanceAdminDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasMaintenanceDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasSlashIndicatorDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasStakingDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasStakingVestingDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasTrustedOrgDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | HasValidatorDeprecated · 0.062 · 0.090 │ + ············································|································|································· + | IsolatedGovernance · 0.084 · 0.138 │ + ············································|································|································· + | LibTUint256Slot · 0.084 · 0.138 │ + ············································|································|································· + | MainchainBridgeManager · 18.879 · 25.355 │ + ············································|································|································· + | MainchainGatewayV3 · 17.761 · 17.802 │ + ············································|································|································· + | Maintenance · 6.399 · 6.644 │ + ············································|································|································· + | Math · 0.084 · 0.138 │ + ············································|································|································· + | MockActor · 0.269 · 0.412 │ + ············································|································|································· + | MockBridge · 1.272 · 1.304 │ + ············································|································|································· + | MockBridgeManager · 10.543 · 16.253 │ + ············································|································|································· + | MockBridgeReward · 6.611 · 6.858 │ + ············································|································|································· + | MockBridgeSlash · 5.656 · 5.888 │ + ············································|································|································· + | MockConditionalImplementControl · 3.123 · 3.951 │ + ············································|································|································· + | MockForwarderTarget · 1.312 · 1.456 │ + ············································|································|································· + | MockGatewayForTracking · 1.623 · 1.929 │ + ············································|································|································· + | MockLogicV1 · 0.442 · 0.474 │ + ············································|································|································· + | MockLogicV2 · 0.442 · 0.474 │ + ············································|································|································· + | MockLogicValidatorSetV1 · 0.484 · 0.516 │ + ············································|································|································· + | MockLogicValidatorSetV2 · 0.484 · 0.516 │ + ············································|································|································· + | MockPaymentFallback · 0.119 · 0.148 │ + ············································|································|································· + | MockPaymentFallbackExpensive · 0.295 · 0.373 │ + ············································|································|································· + | MockPCUPickValidatorSet · 1.246 · 1.386 │ + ············································|································|································· + | MockPCUSortValidators · 1.016 · 1.155 │ + ············································|································|································· + | MockPCUValidateDoubleSign · 0.839 · 0.979 │ + ············································|································|································· + | MockPCUValidateFastFinality · 1.652 · 1.792 │ + ············································|································|································· + | MockPrecompile · 4.054 · 4.085 │ + ············································|································|································· + | MockRoninBridgeManager · 24.003 · 30.573 │ + ············································|································|································· + | MockRoninGatewayV3Extended · 19.568 · 19.609 │ + ············································|································|································· + | MockRoninValidatorSetExtended · 25.274 · 25.513 │ + ············································|································|································· + | MockRoninValidatorSetOverridePrecompile · 24.553 · 24.791 │ + ············································|································|································· + | MockSlashIndicatorExtended · 15.468 · 15.709 │ + ············································|································|································· + | MockSorting · 3.030 · 3.062 │ + ············································|································|································· + | MockStaking · 4.567 · 4.711 │ + ············································|································|································· + | MockTransfer · 0.394 · 0.412 │ + ············································|································|································· + | MockTUint256Slot · 2.665 · 2.696 │ + ············································|································|································· + | MockValidatorContract · 0.168 · 0.197 │ + ············································|································|································· + | MockValidatorSet · 8.446 · 8.987 │ + ············································|································|································· + | NotifiedMigrator · 2.900 · 3.707 │ + ············································|································|································· + | PauseEnforcer · 4.441 · 4.673 │ + ············································|································|································· + | Profile · 6.888 · 7.119 │ + ············································|································|································· + | Proposal · 0.162 · 0.217 │ + ············································|································|································· + | ProxyAdmin · 1.644 · 1.767 │ + ············································|································|································· + | RoninBridgeManager · 23.714 · 30.533 │ + ············································|································|································· + | RoninGatewayV3 · 19.292 · 19.333 │ + ············································|································|································· + | RoninGovernanceAdmin · 14.471 · 15.106 │ + ············································|································|································· + | RoninTrustedOrganization · 8.975 · 9.006 │ + ············································|································|································· + | RoninValidatorSet · 20.563 · 20.801 │ + ············································|································|································· + | RoninValidatorSetTimedMigrator · 3.587 · 4.372 │ + ············································|································|································· + | SlashIndicator · 12.250 · 12.491 │ + ············································|································|································· + | Sorting · 0.084 · 0.138 │ + ············································|································|································· + | Staking · 16.581 · 16.824 │ + ············································|································|································· + | StakingVesting · 3.056 · 3.300 │ + ············································|································|································· + | StorageSlot · 0.084 · 0.138 │ + ············································|································|································· + | Strings · 0.084 · 0.138 │ + ············································|································|································· + | Token · 0.209 · 0.265 │ + ············································|································|································· + | Transfer · 0.162 · 0.217 │ + ············································|································|································· + | TransparentUpgradeableProxy · 2.020 · 3.424 │ + ············································|································|································· + | TransparentUpgradeableProxyV2 · 2.306 · 3.716 │ + ············································|································|································· + | VaultForwarder · 3.769 · 4.643 │ + ·-------------------------------------------|--------------------------------|--------------------------------· diff --git a/logs/storage_layout.log b/logs/storage_layout.log index 2bce21b4a..041794e69 100644 --- a/logs/storage_layout.log +++ b/logs/storage_layout.log @@ -773,7 +773,7 @@ StakingVesting:_initialized (storage_slot: 0) (offset: 20) (type: t_uint8) (numb StakingVesting:_initializing (storage_slot: 0) (offset: 21) (type: t_bool) (numberOfBytes: 1) StakingVesting:_blockProducerBonusPerBlock (storage_slot: 1) (offset: 0) (type: t_uint256) (numberOfBytes: 32) StakingVesting:_bridgeOperatorBonusPerBlock (storage_slot: 2) (offset: 0) (type: t_uint256) (numberOfBytes: 32) -StakingVesting:lastBlockSendingBonus (storage_slot: 3) (offset: 0) (type: t_uint256) (numberOfBytes: 32) +StakingVesting:_lastBlockSendingBonus (storage_slot: 3) (offset: 0) (type: t_uint256) (numberOfBytes: 32) StakingVesting:_fastFinalityRewardPercentage (storage_slot: 4) (offset: 0) (type: t_uint256) (numberOfBytes: 32) TimingStorage:_numberOfBlocksInEpoch (storage_slot: 0) (offset: 0) (type: t_uint256) (numberOfBytes: 32) TimingStorage:_lastUpdatedBlock (storage_slot: 1) (offset: 0) (type: t_uint256) (numberOfBytes: 32) diff --git a/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_ActualProposals.s.sol b/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_ActualProposals.s.sol index 4a0a623e5..a9bc400eb 100644 --- a/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_ActualProposals.s.sol +++ b/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_ActualProposals.s.sol @@ -65,10 +65,12 @@ contract Simulation_20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_A vm.prank(0x3200A8eb56767c3760e108Aa27C65bfFF036d8E6); vm.resumeGasMetering(); - address(_roninBridgeManager).call( + (bool success, ) = address(_roninBridgeManager).call( hex"663ac01100000000000000000000000000000000000000000000000000000000653cba7e00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000090401a5f43f000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000016000000000000000000000000e880802580a1fbdef67ace39d1b21c5b2c74f0590000000000000000000000004b18cebeb9797ea594b5977109cc07b21c37e8c3000000000000000000000000a441f1399c8c023798586fbbbcf35f27279638a100000000000000000000000072a69b04b59c36fced19ac54209bef878e84fcbf000000000000000000000000e258f9996723b910712d6e67ada4eafc15f7f101000000000000000000000000020dd9a5e318695a61dda88db7ad077ec306e3e90000000000000000000000002d593a0087029501ee419b9415dec3fac195fe4a0000000000000000000000009b0612e43855ef9a7c329ee89653ba45273b550e00000000000000000000000047cfcb64f8ea44d6ea7fab32f13efa2f8e65eec1000000000000000000000000ad23e87306aa3c7b95ee760e86f40f3021e5fa18000000000000000000000000bacb04ea617b3e5eee0e3f6e8fcb5ba886b8395800000000000000000000000077ab649caa7b4b673c9f2cf069900df48114d79d0000000000000000000000000dca20728c8bb7173d3452559f40e95c609157990000000000000000000000000d48adbdc523681c0dee736dbdc4497e02bec210000000000000000000000000ea172676e4105e92cc52dbf45fd93b274ec96676000000000000000000000000ed448901cc62be10c5525ba19645ddca1fd9da1d0000000000000000000000008d4f4e4ba313c4332e720445d8268e087d5c19b800000000000000000000000058abcbcab52dee942491700cd0db67826bbaa8c60000000000000000000000004620fb95eabdab4bf681d987e116e0aaef1adef2000000000000000000000000c092fa0c772b3c850e676c57d8737bb39084b9ac00000000000000000000000060c4b72fc62b3e3a74e283aa9ba20d61dd4d8f1b000000000000000000000000ed3805fb65ff51a99fef4676bdbc97abeca93d1100000000000000000000000000000000000000000000000000000000000000160000000000000000000000004b3844a29cfa5824f53e2137edb6dc2b54501bea0000000000000000000000004a4217d8751a027d853785824ef40522c512a3fe00000000000000000000000032cb6da260726bb2192c4085b857afd945a215cb000000000000000000000000a91d05b7c6e684f43e8fe0c25b3c4bb1747a2a9e000000000000000000000000e38afbe7738b6ec4280a6bca1176c1c1a928a19c000000000000000000000000e795f18f2f5df5a666994e839b98263dba86c902000000000000000000000000772112c7e5dd4ed663e844e79d77c1569a2e88ce000000000000000000000000f0c48b7f020bb61e6a3500abc4b4954bde7a2039000000000000000000000000063105d0e7215b703909a7274fe38393302f3134000000000000000000000000d9d5b3e58fa693b468a20c716793b18a1195380a000000000000000000000000ff30ed09e3ae60d39bce1727ee3292fd76a6face0000000000000000000000008c4ad2dc12adb9ad115e37ee9ad2e00e343edf8500000000000000000000000073f5b22312b7b2b3b1cd179fc62269ab369c82060000000000000000000000005e04dc8156ce222289d52487dbadcb01c8c990f9000000000000000000000000564dcb855eb360826f27d1eb9c57cbbe6c76f50f000000000000000000000000ec5c90401f95f8c49b1e133e94f09d85b21d96a4000000000000000000000000332253265e36689d9830e57112cd1aadb1a773f9000000000000000000000000236af2ffdb611b14e3042a982d13eda1627d9c9600000000000000000000000054c8c42f07007d43c3049bef6f10ea68687d43ef00000000000000000000000066225acc78be789c57a11c9a18f051c779d678b5000000000000000000000000f4682b9263d1ba9bd9db09da125708607d1edd3a000000000000000000000000c23f2907bc11848b5d5cedbb835e915d7b760d99000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064e9c034980000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000032015e8b982c61bc8a593816fdbf03a603eec823000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000f4240" ); vm.pauseGasMetering(); + require(success, "internal call failed"); + vm.warp(block.timestamp + 3 seconds); vm.roll(block.number + 1); @@ -90,9 +92,10 @@ contract Simulation_20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_A ]; vm.prank(governors[0]); - address(_roninGovernanceAdmin).call( + (success, ) = address(_roninGovernanceAdmin).call( hex"663ac01100000000000000000000000000000000000000000000000000000000653cba7e00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000012e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000617c5d73662282ea7ffd231e020eca6d2b0d552f000000000000000000000000617c5d73662282ea7ffd231e020eca6d2b0d552f000000000000000000000000545edb750eb8769c868429be9586f5857a768758000000000000000000000000ebfff2b32fa0df9c5c8c5d5aaa7e8b51d5207ba3000000000000000000000000ebfff2b32fa0df9c5c8c5d5aaa7e8b51d5207ba300000000000000000000000098d0230884448b3e2f09a177433d60fb1e19c0900000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000c768423a2ae2b5024cb58f3d6449a8f5db6d8816000000000000000000000000c768423a2ae2b5024cb58f3d6449a8f5db6d88160000000000000000000000006f45c1f8d84849d497c6c0ac4c3842dc82f498940000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000796a163a21e9a659fc9773166e0afdc1eb01aad10000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000273cda3afe17eb7bcb028b058382a9010ae82b240000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000000c1dee1b435c464b4e94781f94f991cb90e3399d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb000000000000000000000000a30b2932cd8b8a89e34551cdfa13810af38da576000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000008ae952d538e9c25120e9c75fba0718750f81313a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a44f1ef286000000000000000000000000440baf1c4b008ee4d617a83401f06aa80f5163e90000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002429b6eca9000000000000000000000000946397dedfd2f79b75a72b322944a21c3240c9c3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb000000000000000000000000840ebf1ca767cb690029e91856a357a43b85d035000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243659cfe60000000000000000000000000aada85a2b3c9fb1be158d43e71cdcca6fe85e020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef286000000000000000000000000e4ccf400e99cb07eb76d3a169532916069b7dc32000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000007ccbb3cd1b19bc1f1d5b7048400d41b1b796abad000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243c3d84100000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef286000000000000000000000000ca9f10769292f26850333264d618c1b5e91f394d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000001477db6bf449b0eb1191a1f4023867ddceadc504000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e44bb5274a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000084ca21287e0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000273cda3afe17eb7bcb028b058382a9010ae82b24000000000000000000000000796a163a21e9a659fc9773166e0afdc1eb01aad1000000000000000000000000946397dedfd2f79b75a72b322944a21c3240c9c3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043b1544550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000644bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000043b154455000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043b1544550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000248f2839700000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f4240" ); + require(success, "internal call failed"); // -------------- Day #2 (execute proposal on ronin) -------------------- _fastForwardToNextDay(); @@ -105,9 +108,10 @@ contract Simulation_20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_A for (uint i = 1; i < governors.length - 3; i++) { vm.prank(governors[i]); - address(_roninGovernanceAdmin).call( + (success, ) = address(_roninGovernanceAdmin).call( hex"a8a0e32c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000007e400000000000000000000000000000000000000000000000000000000653cba7e00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000617c5d73662282ea7ffd231e020eca6d2b0d552f000000000000000000000000617c5d73662282ea7ffd231e020eca6d2b0d552f000000000000000000000000545edb750eb8769c868429be9586f5857a768758000000000000000000000000ebfff2b32fa0df9c5c8c5d5aaa7e8b51d5207ba3000000000000000000000000ebfff2b32fa0df9c5c8c5d5aaa7e8b51d5207ba300000000000000000000000098d0230884448b3e2f09a177433d60fb1e19c0900000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000c768423a2ae2b5024cb58f3d6449a8f5db6d8816000000000000000000000000c768423a2ae2b5024cb58f3d6449a8f5db6d88160000000000000000000000006f45c1f8d84849d497c6c0ac4c3842dc82f498940000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000796a163a21e9a659fc9773166e0afdc1eb01aad10000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000273cda3afe17eb7bcb028b058382a9010ae82b240000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000000c1dee1b435c464b4e94781f94f991cb90e3399d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb000000000000000000000000a30b2932cd8b8a89e34551cdfa13810af38da576000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000008ae952d538e9c25120e9c75fba0718750f81313a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a44f1ef286000000000000000000000000440baf1c4b008ee4d617a83401f06aa80f5163e90000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002429b6eca9000000000000000000000000946397dedfd2f79b75a72b322944a21c3240c9c3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb000000000000000000000000840ebf1ca767cb690029e91856a357a43b85d035000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243659cfe60000000000000000000000000aada85a2b3c9fb1be158d43e71cdcca6fe85e020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef286000000000000000000000000e4ccf400e99cb07eb76d3a169532916069b7dc32000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000007ccbb3cd1b19bc1f1d5b7048400d41b1b796abad000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243c3d84100000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef286000000000000000000000000ca9f10769292f26850333264d618c1b5e91f394d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000001477db6bf449b0eb1191a1f4023867ddceadc504000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e44bb5274a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000084ca21287e0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000273cda3afe17eb7bcb028b058382a9010ae82b24000000000000000000000000796a163a21e9a659fc9773166e0afdc1eb01aad1000000000000000000000000946397dedfd2f79b75a72b322944a21c3240c9c3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043b1544550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000644bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000043b154455000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043b1544550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000248f2839700000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f4240" ); + require(success, "internal call failed"); } // -- done execute proposal diff --git a/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_Approve.sol b/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_Approve.sol index 101c366a2..905221f78 100644 --- a/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_Approve.sol +++ b/script/20231003-rep-002-rep-003/20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_Approve.sol @@ -88,9 +88,10 @@ contract Simulation_20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_A for (uint i = 1; i < governors.length - 2; i++) { vm.prank(governors[i]); - address(_roninGovernanceAdmin).call( + (bool success, ) = address(_roninGovernanceAdmin).call( hex"a8a0e32c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000007e400000000000000000000000000000000000000000000000000000000653cda8b00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000056000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000617c5d73662282ea7ffd231e020eca6d2b0d552f000000000000000000000000617c5d73662282ea7ffd231e020eca6d2b0d552f000000000000000000000000545edb750eb8769c868429be9586f5857a768758000000000000000000000000ebfff2b32fa0df9c5c8c5d5aaa7e8b51d5207ba3000000000000000000000000ebfff2b32fa0df9c5c8c5d5aaa7e8b51d5207ba300000000000000000000000098d0230884448b3e2f09a177433d60fb1e19c0900000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000c768423a2ae2b5024cb58f3d6449a8f5db6d8816000000000000000000000000c768423a2ae2b5024cb58f3d6449a8f5db6d88160000000000000000000000006f45c1f8d84849d497c6c0ac4c3842dc82f498940000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000796a163a21e9a659fc9773166e0afdc1eb01aad10000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000273cda3afe17eb7bcb028b058382a9010ae82b240000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df0000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007e000000000000000000000000000000000000000000000000000000000000008a000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000ae00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000ce00000000000000000000000000000000000000000000000000000000000000d2000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000000c1dee1b435c464b4e94781f94f991cb90e3399d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb000000000000000000000000a30b2932cd8b8a89e34551cdfa13810af38da576000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000008ae952d538e9c25120e9c75fba0718750f81313a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a44f1ef286000000000000000000000000440baf1c4b008ee4d617a83401f06aa80f5163e90000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002429b6eca9000000000000000000000000946397dedfd2f79b75a72b322944a21c3240c9c3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb000000000000000000000000840ebf1ca767cb690029e91856a357a43b85d035000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243659cfe60000000000000000000000000aada85a2b3c9fb1be158d43e71cdcca6fe85e020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef286000000000000000000000000e4ccf400e99cb07eb76d3a169532916069b7dc32000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000007ccbb3cd1b19bc1f1d5b7048400d41b1b796abad000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243c3d84100000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef286000000000000000000000000ca9f10769292f26850333264d618c1b5e91f394d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844f1ef2860000000000000000000000001477db6bf449b0eb1191a1f4023867ddceadc504000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000045cd8a76b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000844bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243101cfcb0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e44bb5274a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000084ca21287e0000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a000000000000000000000000273cda3afe17eb7bcb028b058382a9010ae82b24000000000000000000000000796a163a21e9a659fc9773166e0afdc1eb01aad1000000000000000000000000946397dedfd2f79b75a72b322944a21c3240c9c3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043b1544550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000644bb5274a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000043b154455000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043b1544550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000248f2839700000000000000000000000005fa49e6ca54a9daa8eca4f403adbde5ee075d84a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f4240" ); + require(success, "internal call failed"); } // -- done execute proposal diff --git a/script/20231003-rep-002-rep-003/20231003_REP002_AddBridgeOperators_ActualProposal.s.sol b/script/20231003-rep-002-rep-003/20231003_REP002_AddBridgeOperators_ActualProposal.s.sol index 5941fac27..096a93a9d 100644 --- a/script/20231003-rep-002-rep-003/20231003_REP002_AddBridgeOperators_ActualProposal.s.sol +++ b/script/20231003-rep-002-rep-003/20231003_REP002_AddBridgeOperators_ActualProposal.s.sol @@ -24,8 +24,9 @@ contract Simulation_20231003_REP002AndREP003_RON_NonConditional_GatewayUpgrade_A // -------------- Day #1 -------------------- vm.prank(0x3200A8eb56767c3760e108Aa27C65bfFF036d8E6); - address(_roninBridgeManager).call( + (bool success, ) = address(_roninBridgeManager).call( hex"663ac01100000000000000000000000000000000000000000000000000000000653b5c1100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005a6073071f151fe282aa1267870cde1aff85ff280000000000000000000000005a6073071f151fe282aa1267870cde1aff85ff28000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000090401a5f43f000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000016000000000000000000000000e880802580a1fbdef67ace39d1b21c5b2c74f0590000000000000000000000004b18cebeb9797ea594b5977109cc07b21c37e8c3000000000000000000000000a441f1399c8c023798586fbbbcf35f27279638a100000000000000000000000072a69b04b59c36fced19ac54209bef878e84fcbf000000000000000000000000e258f9996723b910712d6e67ada4eafc15f7f101000000000000000000000000020dd9a5e318695a61dda88db7ad077ec306e3e90000000000000000000000002d593a0087029501ee419b9415dec3fac195fe4a0000000000000000000000009b0612e43855ef9a7c329ee89653ba45273b550e00000000000000000000000047cfcb64f8ea44d6ea7fab32f13efa2f8e65eec1000000000000000000000000ad23e87306aa3c7b95ee760e86f40f3021e5fa18000000000000000000000000bacb04ea617b3e5eee0e3f6e8fcb5ba886b8395800000000000000000000000077ab649caa7b4b673c9f2cf069900df48114d79d0000000000000000000000000dca20728c8bb7173d3452559f40e95c609157990000000000000000000000000d48adbdc523681c0dee736dbdc4497e02bec210000000000000000000000000ea172676e4105e92cc52dbf45fd93b274ec96676000000000000000000000000ed448901cc62be10c5525ba19645ddca1fd9da1d0000000000000000000000008d4f4e4ba313c4332e720445d8268e087d5c19b800000000000000000000000058abcbcab52dee942491700cd0db67826bbaa8c60000000000000000000000004620fb95eabdab4bf681d987e116e0aaef1adef2000000000000000000000000c092fa0c772b3c850e676c57d8737bb39084b9ac00000000000000000000000060c4b72fc62b3e3a74e283aa9ba20d61dd4d8f1b000000000000000000000000ed3805fb65ff51a99fef4676bdbc97abeca93d1100000000000000000000000000000000000000000000000000000000000000160000000000000000000000004b3844a29cfa5824f53e2137edb6dc2b54501bea0000000000000000000000004a4217d8751a027d853785824ef40522c512a3fe00000000000000000000000032cb6da260726bb2192c4085b857afd945a215cb000000000000000000000000a91d05b7c6e684f43e8fe0c25b3c4bb1747a2a9e000000000000000000000000e38afbe7738b6ec4280a6bca1176c1c1a928a19c000000000000000000000000e795f18f2f5df5a666994e839b98263dba86c902000000000000000000000000772112c7e5dd4ed663e844e79d77c1569a2e88ce000000000000000000000000f0c48b7f020bb61e6a3500abc4b4954bde7a2039000000000000000000000000063105d0e7215b703909a7274fe38393302f3134000000000000000000000000d9d5b3e58fa693b468a20c716793b18a1195380a000000000000000000000000ff30ed09e3ae60d39bce1727ee3292fd76a6face0000000000000000000000008c4ad2dc12adb9ad115e37ee9ad2e00e343edf8500000000000000000000000073f5b22312b7b2b3b1cd179fc62269ab369c82060000000000000000000000005e04dc8156ce222289d52487dbadcb01c8c990f9000000000000000000000000564dcb855eb360826f27d1eb9c57cbbe6c76f50f000000000000000000000000ec5c90401f95f8c49b1e133e94f09d85b21d96a4000000000000000000000000332253265e36689d9830e57112cd1aadb1a773f9000000000000000000000000236af2ffdb611b14e3042a982d13eda1627d9c9600000000000000000000000054c8c42f07007d43c3049bef6f10ea68687d43ef00000000000000000000000066225acc78be789c57a11c9a18f051c779d678b5000000000000000000000000f4682b9263d1ba9bd9db09da125708607d1edd3a000000000000000000000000c23f2907bc11848b5d5cedbb835e915d7b760d99000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064e9c034980000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000032015e8b982c61bc8a593816fdbf03a603eec82300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f4240" ); + require(success, "internal call failed"); } } diff --git a/script/20231003-rep-002-rep-003/20231016_ReconfigBridgeTracking.sol b/script/20231003-rep-002-rep-003/20231016_ReconfigBridgeTracking.sol index 565e053c2..31eef1175 100644 --- a/script/20231003-rep-002-rep-003/20231016_ReconfigBridgeTracking.sol +++ b/script/20231003-rep-002-rep-003/20231016_ReconfigBridgeTracking.sol @@ -23,8 +23,9 @@ contract Simulation_20231016_ReconfigBridgeTracking is vm.prank(0x3200A8eb56767c3760e108Aa27C65bfFF036d8E6); // vm.prank(address(0)); - address(_roninBridgeManager).call( + (bool success, ) = address(_roninBridgeManager).call( hex"663ac01100000000000000000000000000000000000000000000000000000000653a2ec800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000005a6073071f151fe282aa1267870cde1aff85ff28000000000000000000000000323092ab0900281efd0ef5954b0a612ce7755f9c0000000000000000000000001c952d6717ebfd2e92e5f43ef7c1c3f7677f007d0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000c4800eaab3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000010000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a44bb5274a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000044865e6fd300000000000000000000000000000000000000000000000000000000000000030000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a44bb5274a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000044865e6fd300000000000000000000000000000000000000000000000000000000000000030000000000000000000000003fb325b251ee80945d3fc8c7692f5affca1b8bc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f4240" ); + require(success, "internal call failed"); } } diff --git a/script/20231003-rep-002-rep-003/contracts/ProfileDeploy.s.sol b/script/20231003-rep-002-rep-003/contracts/ProfileDeploy.s.sol index 2a1c372a6..fc2d0774e 100644 --- a/script/20231003-rep-002-rep-003/contracts/ProfileDeploy.s.sol +++ b/script/20231003-rep-002-rep-003/contracts/ProfileDeploy.s.sol @@ -6,10 +6,10 @@ import { BaseDeploy, ContractKey } from "script/BaseDeploy.s.sol"; contract ProfileDeploy is BaseDeploy { function _defaultArguments() internal view override returns (bytes memory args) { - args = abi.encodeCall(Profile.initialize, _config.getAddressFromCurrentNetwork(ContractKey.RoninValidatorSet)); + args = abi.encodeCall(Profile.initialize, (_config.getAddressFromCurrentNetwork(ContractKey.RoninValidatorSet))); } function run() public virtual trySetUp returns (Profile) { return Profile(_deployProxy(ContractKey.Profile)); } -} +} \ No newline at end of file diff --git a/src/configs/addresses.ts b/src/configs/addresses.ts index f18eeed95..4d5d303cd 100644 --- a/src/configs/addresses.ts +++ b/src/configs/addresses.ts @@ -34,77 +34,77 @@ const trustedOrgGoerliForDevnetConfig: TrustedOrganizationStruct[] = [ { consensusAddr: '0xB6bc5bc0410773A3F86B1537ce7495C52e38f88B', governor: '0x6e61779A5aFf6F3400480981100d8f297Be98dB7', - bridgeVoter: '0xB2106e0b921c682d824bd5276902a3DF822654DC', + __deprecatedBridgeVoter: '0xB2106e0b921c682d824bd5276902a3DF822654DC', weight: 100, addedBlock: 0, }, { consensusAddr: '0x4a4bc674A97737376cFE990aE2fE0d2B6E738393', governor: '0x41c80F826fD726cc35C991ADabbf9C9765D4EE58', - bridgeVoter: '0xEB6C9373bdD55348d6ef7C456a824705C6140222', + __deprecatedBridgeVoter: '0xEB6C9373bdD55348d6ef7C456a824705C6140222', weight: 100, addedBlock: 0, }, { consensusAddr: '0x3B9F2587d55E96276B09b258ac909D809961F6C2', governor: '0x6A55f2E6F3DdF2e2FC31f914d3d510f994E3E9E9', - bridgeVoter: '0x95436f7544E1AbF9C9113fF9e5B37Eb6C9FFD075', + __deprecatedBridgeVoter: '0x95436f7544E1AbF9C9113fF9e5B37Eb6C9FFD075', weight: 100, addedBlock: 0, }, { consensusAddr: '0x283b4Baa1d0415603C81edc1C68FadD3C790837C', governor: '0x79F9D12Bf1C43556cA638c93De8299be18F4c13C', - bridgeVoter: '0xCA8CD8490cfD91eecC1C9CA6a78c2EC7bd0b586B', + __deprecatedBridgeVoter: '0xCA8CD8490cfD91eecC1C9CA6a78c2EC7bd0b586B', weight: 100, addedBlock: 0, }, { consensusAddr: '0x0E3341Ae4Ed9dA65Fc30a7Fa6357e8B5Ac40b0A3', governor: '0x8a8B59B6a015faCF15aDe0e2Ac759EF1e4339f18', - bridgeVoter: '0xb4e483A1A4B2a8214CA130A7AC4c0e5E82eAe6ee', + __deprecatedBridgeVoter: '0xb4e483A1A4B2a8214CA130A7AC4c0e5E82eAe6ee', weight: 100, addedBlock: 0, }, { consensusAddr: '0xAfB9554299491a34d303f2C5A91bebB162f6B2Cf', governor: '0xa835C99C3EBE69Ea2940c3D009D541e452D47FE3', - bridgeVoter: '0x324eD3822d6eC798824268De0895623165A4c3bc', + __deprecatedBridgeVoter: '0x324eD3822d6eC798824268De0895623165A4c3bc', weight: 100, addedBlock: 0, }, { consensusAddr: '0x912fb48E1C220699cC1Ee0bF5C00172c1C4d7733', governor: '0x60c44Bfb13B10Bb0897f8537bB987927a198842a', - bridgeVoter: '0x107aA9956A8E2979C5DcaD3599AC9dF090E53D36', + __deprecatedBridgeVoter: '0x107aA9956A8E2979C5DcaD3599AC9dF090E53D36', weight: 100, addedBlock: 0, }, { consensusAddr: '0x4F7B04Cceb6aDbeBFb0b64d2acb6FEBe2393F914', governor: '0x5ea8CC101AA90668594f473ef175d061225d62aa', - bridgeVoter: '0xa19877E2c0cbb5C5eb7f37c417CAF1Fe14223840', + __deprecatedBridgeVoter: '0xa19877E2c0cbb5C5eb7f37c417CAF1Fe14223840', weight: 100, addedBlock: 0, }, { consensusAddr: '0xC2dbED259700DDE15eE95f797345a65ACABa511f', governor: '0x9484Cb3FC30ACa08732d423108A1212380d6CAd8', - bridgeVoter: '0x16b655d62b4213ce9cb51b29A923b22B2EBb4375', + __deprecatedBridgeVoter: '0x16b655d62b4213ce9cb51b29A923b22B2EBb4375', weight: 100, addedBlock: 0, }, { consensusAddr: '0x4F7B05263cd535a561ab72059B4390cbC80f133D', governor: '0x10C9a7F733Fd74c5403190fD43529B651Ea53A74', - bridgeVoter: '0x3F43595F669E77B67D11D02aa3498da6751C479B', + __deprecatedBridgeVoter: '0x3F43595F669E77B67D11D02aa3498da6751C479B', weight: 100, addedBlock: 0, }, { consensusAddr: '0x23c148098A80fC3A47A87Fd7989C4b2D032dC906', governor: '0x755955288cFDd1143d3BBDE3C868972608376B9c', - bridgeVoter: '0xAF83FdF1Cb2995f0767B2cc3480faaf970B1Bbd2', + __deprecatedBridgeVoter: '0xAF83FdF1Cb2995f0767B2cc3480faaf970B1Bbd2', weight: 100, addedBlock: 0, }, @@ -113,28 +113,28 @@ const trustedOrgGoerliForDevnetConfig: TrustedOrganizationStruct[] = [ const testnetTrustedOrgConfig: TrustedOrganizationStruct[] = [ { consensusAddr: '0xAcf8Bf98D1632e602d0B1761771049aF21dd6597', - bridgeVoter: '0x2295EdAA6BD5c07fB3227628c62Af12248106667', + __deprecatedBridgeVoter: '0x2295EdAA6BD5c07fB3227628c62Af12248106667', governor: '0xd24D87DDc1917165435b306aAC68D99e0F49A3Fa', weight: 100, addedBlock: 0, }, { consensusAddr: '0xCaba9D9424D6bAD99CE352A943F59279B533417a', - bridgeVoter: '0xb9e7cb842e24E92F49BF6dbAA1f2184C742cEb64', + __deprecatedBridgeVoter: '0xb9e7cb842e24E92F49BF6dbAA1f2184C742cEb64', governor: '0xb033ba62EC622dC54D0ABFE0254e79692147CA26', weight: 100, addedBlock: 0, }, { consensusAddr: '0x9f1Abc67beA4db5560371fF3089F4Bfe934c36Bc', - bridgeVoter: '0x7D1dA6CE4f3B908b8440889e6CeAcfD61839E8aC', + __deprecatedBridgeVoter: '0x7D1dA6CE4f3B908b8440889e6CeAcfD61839E8aC', governor: '0x087D08e3ba42e64E3948962dd1371F906D1278b9', weight: 100, addedBlock: 0, }, { consensusAddr: '0xA85ddDdCeEaB43DccAa259dd4936aC104386F9aa', - bridgeVoter: '0xcE6958090E8C57BB91A03dFc85D724Fb3903eEbf', + __deprecatedBridgeVoter: '0xcE6958090E8C57BB91A03dFc85D724Fb3903eEbf', governor: '0x52ec2e6BBcE45AfFF8955Da6410bb13812F4289F', weight: 100, addedBlock: 0, @@ -145,7 +145,7 @@ const mainnetTrustedOrgConfig: TrustedOrganizationStruct[] = [ { consensusAddr: '0xf41af21f0a800dc4d86efb14ad46cfb9884fdf38', governor: '0xe880802580a1fbdef67ace39d1b21c5b2c74f059', - bridgeVoter: '0x7bb3127bdb8eb364c3cc827331252e53af119993', + __deprecatedBridgeVoter: '0x7bb3127bdb8eb364c3cc827331252e53af119993', weight: 100, addedBlock: 0, }, diff --git a/src/configs/config.ts b/src/configs/config.ts index 746e28e1e..ea05cdf11 100644 --- a/src/configs/config.ts +++ b/src/configs/config.ts @@ -260,7 +260,7 @@ const defaultRoninTrustedOrganizationConf: RoninTrustedOrganizationArguments = { trustedOrganizations: ['0x93b8eed0a1e082ae2f478fd7f8c14b1fc0261bb1'].map((addr) => ({ consensusAddr: addr, governor: addr, - bridgeVoter: addr, + __deprecatedBridgeVoter: addr, weight: 100, addedBlock: 0, })), diff --git a/src/deploy/calculate-address/calculate-dpos.ts b/src/deploy/calculate-address/calculate-dpos.ts index 56c72148a..9dd648d78 100644 --- a/src/deploy/calculate-address/calculate-dpos.ts +++ b/src/deploy/calculate-address/calculate-dpos.ts @@ -19,6 +19,7 @@ const deploy = async ({ getNamedAccounts }: HardhatRuntimeEnvironment) => { slashIndicatorContract: calculateAddress(deployer, nonce++), stakingContract: calculateAddress(deployer, nonce++), validatorContract: calculateAddress(deployer, nonce++), + profileContract: calculateAddress(deployer, nonce++), }; } @@ -35,6 +36,7 @@ deploy.dependencies = [ 'StakingLogic', 'RoninValidatorSetLogic', 'RoninTrustedOrganizationLogic', + 'ProfileLogic', ]; export default deploy; diff --git a/src/deploy/logic/profile.ts b/src/deploy/logic/profile.ts index d7a9b9023..5e40e14ac 100644 --- a/src/deploy/logic/profile.ts +++ b/src/deploy/logic/profile.ts @@ -2,6 +2,7 @@ import { network } from 'hardhat'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { roninchainNetworks } from '../../configs/config'; +import { Network } from '../../utils'; const deploy = async ({ getNamedAccounts, deployments }: HardhatRuntimeEnvironment) => { if (!roninchainNetworks.includes(network.name!)) { @@ -11,8 +12,18 @@ const deploy = async ({ getNamedAccounts, deployments }: HardhatRuntimeEnvironme const { deploy } = deployments; const { deployer } = await getNamedAccounts(); + let contractToDeploy; + switch (network.name!) { + case Network.Testnet: + contractToDeploy = 'Profile_Testnet'; + case Network.Mainnet: + contractToDeploy = 'Profile_Mainnet'; + default: + contractToDeploy = 'Profile'; + } + await deploy('ProfileLogic', { - contract: 'Profile', + contract: contractToDeploy, from: deployer, log: true, }); diff --git a/src/deploy/proxy/profile-proxy.ts b/src/deploy/proxy/profile-proxy.ts index 7e85d6f21..4dcaa8180 100644 --- a/src/deploy/proxy/profile-proxy.ts +++ b/src/deploy/proxy/profile-proxy.ts @@ -2,6 +2,7 @@ import { network } from 'hardhat'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { generalRoninConf, roninchainNetworks } from '../../configs/config'; +import { verifyAddress } from '../../script/verify-address'; import { Address } from 'hardhat-deploy/dist/types'; import { Network } from '../../utils'; import { Profile__factory } from '../../types'; @@ -16,7 +17,7 @@ const deploy = async ({ getNamedAccounts, deployments }: HardhatRuntimeEnvironme const logicContract = await deployments.get('ProfileLogic'); - const nonce = undefined; + const nonce = generalRoninConf[network.name].profileContract?.nonce; // console.log(`Deploying ProfileProxy (nonce: ${nonce})...`); let governanceAdmin: Address | undefined = generalRoninConf[network.name]!.governanceAdmin?.address; @@ -35,15 +36,16 @@ const deploy = async ({ getNamedAccounts, deployments }: HardhatRuntimeEnvironme const data = new Profile__factory().interface.encodeFunctionData('initialize', [validatorContractAddress]); - await deploy('ProfileProxy', { + const deployment = await deploy('ProfileProxy', { contract: 'TransparentUpgradeableProxyV2', from: deployer, log: true, args: [logicContract.address, governanceAdmin, data], }); + verifyAddress(deployment.address, generalRoninConf[network.name].profileContract?.address); }; deploy.tags = ['ProfileProxy']; -deploy.dependencies = ['ProfileLogic']; +deploy.dependencies = ['ProfileLogic', '_HelperDposCalculate', 'RoninValidatorSetProxy']; export default deploy; diff --git a/src/script/proposal.ts b/src/script/proposal.ts index 21199a0fa..0e2106be6 100644 --- a/src/script/proposal.ts +++ b/src/script/proposal.ts @@ -88,7 +88,7 @@ export const BridgeOperatorsBallotTypes = { export const EmergencyExitBallotTypes = { EmergencyExitBallot: [ - { name: 'consensusAddress', type: 'address' }, + { name: 'validatorId', type: 'address' }, { name: 'recipientAfterUnlockedFund', type: 'address' }, { name: 'requestedAt', type: 'uint256' }, { name: 'expiredAt', type: 'uint256' }, @@ -193,7 +193,7 @@ export const getBOsBallotHash = (period: BigNumberish, epoch: BigNumberish, oper ); export const getEmergencyExitBallotHash = ( - consensusAddress: Address, + validatorId: Address, recipientAfterUnlockedFund: Address, requestedAt: BigNumberish, expiredAt: BigNumberish @@ -201,7 +201,7 @@ export const getEmergencyExitBallotHash = ( keccak256( AbiCoder.prototype.encode(emergencyExitBallotParamTypes, [ emergencyExitBallotTypehash, - consensusAddress, + validatorId, recipientAfterUnlockedFund, requestedAt, expiredAt, diff --git a/src/upgrades/230411-add-GVs.ts b/src/upgrades/230411-add-GVs.ts index d092d5fd5..6ca288e69 100644 --- a/src/upgrades/230411-add-GVs.ts +++ b/src/upgrades/230411-add-GVs.ts @@ -100,7 +100,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE orgs.map((_) => ({ consensusAddr: _.consensus, governor: _.governor, - bridgeVoter: _.bridge, + __deprecatedBridgeVoter: _.bridge, weight: 100, addedBlock: 0, })), diff --git a/src/upgrades/REP-004--testnet/20231109-proposal-on-roninchain.ts b/src/upgrades/REP-004--testnet/20231109-proposal-on-roninchain.ts new file mode 100644 index 000000000..83a3e8ff5 --- /dev/null +++ b/src/upgrades/REP-004--testnet/20231109-proposal-on-roninchain.ts @@ -0,0 +1,148 @@ +import { HardhatRuntimeEnvironment } from 'hardhat/types'; +import { Instance, ProposalSegmentArguments, defaultSegment, explorerUrl, proxyInterface } from '../upgradeUtils'; +import { VoteType } from '../../script/proposal'; +import { roninchainNetworks, stakingVestingConfig } from '../../configs/config'; +import { network } from 'hardhat'; +import { + Maintenance__factory, + Profile__factory, + RoninTrustedOrganization__factory, + RoninValidatorSet__factory, + Staking__factory, +} from '../../types'; +import { ProposalDetailStruct } from '../../types/GovernanceAdmin'; +import { Address } from 'hardhat-deploy/dist/types'; + +const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { + if (!roninchainNetworks.includes(network.name!)) { + return; + } + + const { execute } = deployments; + let { governor } = await getNamedAccounts(); // NOTE: Should double check the `governor` account in the `hardhat.config.ts` file + console.log('Governor:', governor); + + const allDeployments: Instance = { + RoninGovernanceAdmin: await deployments.get('RoninGovernanceAdmin'), + RoninValidatorSetProxy: await deployments.get('RoninValidatorSetProxy'), + ProfileProxy: await deployments.get('ProfileProxy'), + StakingProxy: await deployments.get('StakingProxy'), + SlashIndicatorProxy: await deployments.get('SlashIndicatorProxy'), + MaintenanceProxy: await deployments.get('MaintenanceProxy'), + RoninTrustedOrganizationProxy: await deployments.get('RoninTrustedOrganizationProxy'), + StakingVestingProxy: await deployments.get('StakingVestingProxy'), + FastFinalityTrackingProxy: await deployments.get('FastFinalityTrackingProxy'), + RoninBridgeManager: await deployments.get('RoninBridgeManager'), + + RoninValidatorSetLogic: await deployments.get('RoninValidatorSetLogic'), + ProfileLogic: await deployments.get('ProfileLogic'), + StakingLogic: await deployments.get('StakingLogic'), + SlashIndicatorLogic: await deployments.get('SlashIndicatorLogic'), + MaintenanceLogic: await deployments.get('MaintenanceLogic'), + RoninTrustedOrganizationLogic: await deployments.get('RoninTrustedOrganizationLogic'), + StakingVestingLogic: await deployments.get('StakingVestingLogic'), + FastFinalityTrackingLogic: await deployments.get('FastFinalityTrackingLogic'), + }; + + // Upgrade DPoS Contracts + // See `test/foundry/forking/REP-004/ChangeConsensusAddress.t.sol` + let proposalSegments = await upgradeDPoSContractSetProposalPart(allDeployments); + + console.log(proposalSegments); + + // return; + + ////////////////////////////////////////// + // Propose the proposal + ////////////////////////////////////////// + const blockNumBefore = await ethers.provider.getBlockNumber(); + const blockBefore = await ethers.provider.getBlock(blockNumBefore); + const timestampBefore = blockBefore.timestamp; + const proposalExpiryTimestamp = timestampBefore + 3600 * 24 * 10; // expired in 10 days + + const tx = await execute( + 'RoninGovernanceAdmin', + { from: governor, log: true }, + 'proposeProposalForCurrentNetwork', + proposalExpiryTimestamp, // expiryTimestamp + [...proposalSegments.map((_) => _.target)], // targets + [...proposalSegments.map((_) => _.value)], // values + [...proposalSegments.map((_) => _.data)], // datas + [...proposalSegments.map((_) => _.gasAmount)], // gasAmounts + VoteType.For // ballot type + ); + deployments.log(`${explorerUrl[network.name!]}/tx/${tx.transactionHash}`); +}; + +async function upgradeDPoSContractSetProposalPart(instance: Instance): Promise { + let segments: ProposalSegmentArguments[] = []; + // upgrade `Profile` and bump to V2 + segments.push({ + ...defaultSegment, + gasAmount: 15_000_000, + target: instance.ProfileProxy!.address, + data: proxyInterface.encodeFunctionData('upgradeToAndCall', [ + instance.ProfileLogic!.address, + new Profile__factory().interface.encodeFunctionData('initializeV2', [ + instance.StakingProxy!.address, + instance.RoninTrustedOrganizationProxy?.address, + ]), + ]), + }); + + // upgrade `Staking` and bump to V3 + segments.push({ + ...defaultSegment, + target: instance.StakingProxy!.address, + data: proxyInterface.encodeFunctionData('upgradeToAndCall', [ + instance.StakingLogic!.address, + new Staking__factory().interface.encodeFunctionData('initializeV3', [instance.ProfileProxy!.address]), + ]), + }); + + // upgrade `RoninValidatorSet` and bump to V4 + segments.push({ + ...defaultSegment, + target: instance.RoninValidatorSetProxy!.address, + data: proxyInterface.encodeFunctionData('upgradeToAndCall', [ + instance.RoninValidatorSetLogic?.address, + new RoninValidatorSet__factory().interface.encodeFunctionData('initializeV4', [instance.ProfileProxy!.address]), + ]), + }); + + // upgrade `Maintenance` and bump to V3 + segments.push({ + ...defaultSegment, + target: instance.MaintenanceProxy!.address, + data: proxyInterface.encodeFunctionData('upgradeToAndCall', [ + instance.MaintenanceLogic!.address, + new Maintenance__factory().interface.encodeFunctionData('initializeV3', [instance.ProfileProxy!.address]), + ]), + }); + + // upgrade `SlashIndicator` and bump to V3 + segments.push({ + ...defaultSegment, + target: instance.SlashIndicatorProxy!.address, + data: proxyInterface.encodeFunctionData('upgradeTo', [instance.SlashIndicatorLogic!.address]), + }); + + // upgrade `RoninTrustedOrganization` and bump to V2 + segments.push({ + ...defaultSegment, + target: instance.RoninTrustedOrganizationProxy!.address, + data: proxyInterface.encodeFunctionData('upgradeToAndCall', [ + instance.RoninTrustedOrganizationLogic!.address, + new RoninTrustedOrganization__factory().interface.encodeFunctionData('initializeV2', [ + instance.ProfileProxy?.address, + ]), + ]), + }); + + return segments; +} + +// yarn hardhat deploy --tags 230231109__ProposalOnRoninChain__V0_7_0 --network ronin-testnet +deploy.tags = ['230231109__ProposalOnRoninChain__V0_7_0']; + +export default deploy; diff --git a/src/utils.ts b/src/utils.ts index d7c44d3eb..a49274d01 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -69,6 +69,7 @@ export interface GeneralConfig { stakingContract?: AddressExtended; validatorContract?: AddressExtended; roninTrustedOrganizationContract?: AddressExtended; + profileContract?: AddressExtended; bridgeTrackingContract?: AddressExtended; bridgeManagerContract?: AddressExtended; bridgeSlashContract?: AddressExtended; diff --git a/storageLayout/profile-after.txt b/storageLayout/profile-after.txt new file mode 100644 index 000000000..a2dd05676 --- /dev/null +++ b/storageLayout/profile-after.txt @@ -0,0 +1,1519 @@ +┌─────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────┬─────┬──────────┬───────────────┐ +│ contract │ state_variable │ storage_slot │ offset │ type │ idx │ artifact │ numberOfBytes │ +├─────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────────┼───────────────┤ +│ AccessControl │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControl │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ BaseStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10664_storage)) │ │ │ 32 │ +│ BaseStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11444_storage)) │ │ │ 32 │ +│ BaseStaking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11450_storage) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ BaseStaking │ _profileContract │ 53 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ BaseStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ BaseStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)11051_storage) │ │ │ 32 │ +│ BaseStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ BaseStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ BaseStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ BaseStaking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ BaseStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ BaseStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ BaseStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ BaseStaking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ BOsGovernanceProposal │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12596_storage │ │ │ 96 │ +│ BOsGovernanceProposal │ _bridgeOperatorVote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13097_storage)) │ │ │ 32 │ +│ BOsGovernanceProposal │ _lastVotedBlock │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ BOsGovernanceProposal │ _bridgeVoterSig │ 5 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10674_storage))) │ │ │ 32 │ +│ BOsGovernanceProposal │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ BOsGovernanceProposal │ _bridgeOperatorVote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ BOsGovernanceProposal │ _lastVotedBlock │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ BOsGovernanceProposal │ _bridgeVoterSig │ 5 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10569_storage))) │ │ │ 32 │ +│ BOsGovernanceRelay │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12596_storage │ │ │ 96 │ +│ BOsGovernanceRelay │ _vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13097_storage)) │ │ │ 32 │ +│ BOsGovernanceRelay │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ BOsGovernanceRelay │ _vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ BridgeTracking │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9291 │ │ │ 20 │ +│ BridgeTracking │ _validatorContract │ 1 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ BridgeTracking │ _initialized │ 1 │ 20 │ t_uint8 │ │ │ 1 │ +│ BridgeTracking │ _initializing │ 1 │ 21 │ t_bool │ │ │ 1 │ +│ BridgeTracking │ startedAtBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ BridgeTracking │ _bufferMetric │ 3 │ 0 │ t_struct(PeriodVotingMetricTimeWrapper)23377_storage │ │ │ 192 │ +│ BridgeTracking │ _periodMetric │ 9 │ 0 │ t_mapping(t_uint256,t_struct(PeriodVotingMetric)23367_storage) │ │ │ 32 │ +│ BridgeTracking │ _receiptTrackingInfo │ 10 │ 0 │ t_mapping(t_enum(VoteKind)9303,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23393_storage)) │ │ │ 32 │ +│ BridgeTracking │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ BridgeTracking │ _validatorContract │ 1 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ BridgeTracking │ _initialized │ 1 │ 20 │ t_uint8 │ │ │ 1 │ +│ BridgeTracking │ _initializing │ 1 │ 21 │ t_bool │ │ │ 1 │ +│ BridgeTracking │ startedAtBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ BridgeTracking │ _bufferMetric │ 3 │ 0 │ t_struct(PeriodVotingMetricTimeWrapper)23108_storage │ │ │ 192 │ +│ BridgeTracking │ _periodMetric │ 9 │ 0 │ t_mapping(t_uint256,t_struct(PeriodVotingMetric)23098_storage) │ │ │ 32 │ +│ BridgeTracking │ _receiptTrackingInfo │ 10 │ 0 │ t_mapping(t_enum(VoteKind)9224,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23124_storage)) │ │ │ 32 │ +│ CandidateManager │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ CandidateManager │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CandidateManager │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CandidateManager │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ CandidateManager │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ CandidateManager │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateManager │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ CandidateManager │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CandidateManager │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CandidateManager │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ CandidateManager │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ CandidateManager │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10664_storage)) │ │ │ 32 │ +│ CandidateStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11444_storage)) │ │ │ 32 │ +│ CandidateStaking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11450_storage) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CandidateStaking │ _profileContract │ 53 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ CandidateStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ CandidateStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)11051_storage) │ │ │ 32 │ +│ CandidateStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CandidateStaking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ CandidateStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ CandidateStaking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CandidateStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ CandidateStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ CandidateStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ CandidateStaking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateStaking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CoinbaseExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ CoinbaseExecution │ _stakingVestingContract │ 107 │ 0 │ t_contract(IStakingVesting)10357 │ │ │ 20 │ +│ CoinbaseExecution │ _bridgeTrackingContract │ 108 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ CoinbaseExecution │ _maintenanceContract │ 109 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ CoinbaseExecution │ _slashIndicatorContract │ 110 │ 0 │ t_contract(ISlashIndicator)10961 │ │ │ 20 │ +│ CoinbaseExecution │ _stakingContract │ 111 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorCandidate │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidates │ 113 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _candidateIndex │ 114 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _candidateInfo │ 115 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _minEffectiveDaysOnwards │ 116 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidateCommissionChangeSchedule │ 117 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 118 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _profileContract │ 166 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ CoinbaseExecution │ _roninTrustedOrganizationContract │ 167 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ validatorCount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _validators │ 170 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CoinbaseExecution │ _validatorMap │ 171 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ CoinbaseExecution │ _maxPrioritizedValidatorNumber │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 173 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CoinbaseExecution │ _miningReward │ 223 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _delegatingReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalBridgeReward │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeOperatingReward │ 226 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalDeprecatedReward │ 227 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitLockedAmount │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExpiryDuration │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lockedConsensusList │ 230 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _exitInfo │ 231 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _lockedFundReleased │ 232 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 233 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CoinbaseExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CoinbaseExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _stakingVestingContract │ 108 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ CoinbaseExecution │ _bridgeTrackingContract │ 109 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ CoinbaseExecution │ _maintenanceContract │ 110 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ CoinbaseExecution │ _slashIndicatorContract │ 111 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ CoinbaseExecution │ _stakingContract │ 112 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorCandidate │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidates │ 114 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _candidateIndex │ 115 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _candidateInfo │ 116 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _minEffectiveDaysOnwards │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidateCommissionChangeSchedule │ 118 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 119 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _roninTrustedOrganizationContract │ 167 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ validatorCount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _validators │ 170 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CoinbaseExecution │ _validatorMap │ 171 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ CoinbaseExecution │ _maxPrioritizedValidatorNumber │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 173 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CoinbaseExecution │ _miningReward │ 223 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _delegatingReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalBridgeReward │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeOperatingReward │ 226 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalDeprecatedReward │ 227 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitLockedAmount │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExpiryDuration │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lockedConsensusList │ 230 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _exitInfo │ 231 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _lockedFundReleased │ 232 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 233 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CommonStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CommonStorage │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 60 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ CommonStorage │ _profileContract │ 107 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ CommonStorage │ _roninTrustedOrganizationContract │ 108 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ CommonStorage │ _maxValidatorNumber │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ validatorCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _validators │ 111 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CommonStorage │ _validatorMap │ 112 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ CommonStorage │ _maxPrioritizedValidatorNumber │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ ______gap │ 114 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CommonStorage │ _miningReward │ 164 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _delegatingReward │ 165 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalBridgeReward │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _bridgeOperatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalDeprecatedReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExitLockedAmount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExpiryDuration │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lockedConsensusList │ 171 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CommonStorage │ _exitInfo │ 172 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ CommonStorage │ _lockedFundReleased │ 173 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 174 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CommonStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CommonStorage │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CommonStorage │ _roninTrustedOrganizationContract │ 108 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ CommonStorage │ _maxValidatorNumber │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ validatorCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _validators │ 111 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CommonStorage │ _validatorMap │ 112 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ CommonStorage │ _maxPrioritizedValidatorNumber │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ ______gap │ 114 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CommonStorage │ _miningReward │ 164 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _delegatingReward │ 165 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalBridgeReward │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _bridgeOperatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalDeprecatedReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExitLockedAmount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExpiryDuration │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lockedConsensusList │ 171 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CommonStorage │ _exitInfo │ 172 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ CommonStorage │ _lockedFundReleased │ 173 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 174 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CoreGovernance │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoreGovernance │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7418_storage)) │ │ │ 32 │ +│ CoreGovernance │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoreGovernance │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoreGovernance │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ CoreGovernance │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ CreditScore │ _maintenanceContract │ 1 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ CreditScore │ _checkBailedOutAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CreditScore │ _creditScore │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CreditScore │ _gainCreditScore │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _maxCreditScore │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _bailOutCostMultiplier │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _cutOffPercentageAfterBailout │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ ______gap │ 8 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CreditScore │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ CreditScore │ _maintenanceContract │ 1 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ CreditScore │ _checkBailedOutAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CreditScore │ _creditScore │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CreditScore │ _gainCreditScore │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _maxCreditScore │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _bailOutCostMultiplier │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _cutOffPercentageAfterBailout │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ ______gap │ 8 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10664_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11444_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11450_storage) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ DelegatorStaking │ _profileContract │ 53 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ DelegatorStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ DelegatorStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)11051_storage) │ │ │ 32 │ +│ DelegatorStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ DelegatorStaking │ ______gap │ 108 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ DelegatorStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ DelegatorStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ DelegatorStaking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ DelegatorStaking │ ______gap │ 108 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ EmergencyExit │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ EmergencyExit │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 60 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ EmergencyExit │ _stakingContract │ 107 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorCandidate │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidates │ 109 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _candidateIndex │ 110 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _candidateInfo │ 111 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ EmergencyExit │ _minEffectiveDaysOnwards │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidateCommissionChangeSchedule │ 113 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 114 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _profileContract │ 162 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ EmergencyExit │ _roninTrustedOrganizationContract │ 163 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorNumber │ 164 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ validatorCount │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _validators │ 166 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ EmergencyExit │ _validatorMap │ 167 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ EmergencyExit │ _maxPrioritizedValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ EmergencyExit │ _miningReward │ 219 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _delegatingReward │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalBridgeReward │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _bridgeOperatingReward │ 222 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalDeprecatedReward │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitLockedAmount │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExpiryDuration │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lockedConsensusList │ 226 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _exitInfo │ 227 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ EmergencyExit │ _lockedFundReleased │ 228 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 229 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ EmergencyExit │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ EmergencyExit │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _stakingContract │ 108 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorCandidate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidates │ 110 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _candidateIndex │ 111 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _candidateInfo │ 112 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ EmergencyExit │ _minEffectiveDaysOnwards │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidateCommissionChangeSchedule │ 114 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 115 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _roninTrustedOrganizationContract │ 163 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorNumber │ 164 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ validatorCount │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _validators │ 166 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ EmergencyExit │ _validatorMap │ 167 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ EmergencyExit │ _maxPrioritizedValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ EmergencyExit │ _miningReward │ 219 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _delegatingReward │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalBridgeReward │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _bridgeOperatingReward │ 222 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalDeprecatedReward │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitLockedAmount │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExpiryDuration │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lockedConsensusList │ 226 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _exitInfo │ 227 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ EmergencyExit │ _lockedFundReleased │ 228 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 229 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ ERC20 │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20 │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20 │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20 │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20 │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20 │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20 │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20 │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20 │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20 │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Burnable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Burnable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Burnable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Burnable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Burnable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Burnable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Pausable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Pausable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Pausable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _paused │ 5 │ 0 │ t_bool │ │ │ 1 │ +│ ERC20Pausable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Pausable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Pausable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Pausable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _paused │ 5 │ 0 │ t_bool │ │ │ 1 │ +│ ERC20PresetMinterPauser │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _balances │ 2 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _allowances │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _totalSupply │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _name │ 5 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _symbol │ 6 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _paused │ 7 │ 0 │ t_bool │ │ │ 1 │ +│ ERC20PresetMinterPauser │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _balances │ 2 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _allowances │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _totalSupply │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _name │ 5 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _symbol │ 6 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _paused │ 7 │ 0 │ t_bool │ │ │ 1 │ +│ Forwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ Forwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ Forwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ Forwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ GatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ GatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ GatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ GatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ GovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7418_storage)) │ │ │ 32 │ +│ GovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ GovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9291 │ │ │ 20 │ +│ GovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ GovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ GovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ GovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ GovernanceProposal │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceProposal │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7418_storage)) │ │ │ 32 │ +│ GovernanceProposal │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceProposal │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceProposal │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceProposal │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceRelay │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceRelay │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7418_storage)) │ │ │ 32 │ +│ GovernanceRelay │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceRelay │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceRelay │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceRelay │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ HasBridgeContract │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9291 │ │ │ 20 │ +│ HasBridgeContract │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ HasBridgeTrackingContract │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ HasBridgeTrackingContract │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ HasMaintenanceContract │ _maintenanceContract │ 0 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ HasMaintenanceContract │ _maintenanceContract │ 0 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ HasProfileContract │ _profileContract │ 0 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ HasRoninGovernanceAdminContract │ _roninGovernanceAdminContract │ 0 │ 0 │ t_contract(IRoninGovernanceAdmin)10089 │ │ │ 20 │ +│ HasRoninGovernanceAdminContract │ _roninGovernanceAdminContract │ 0 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ HasRoninTrustedOrganizationContract │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ HasRoninTrustedOrganizationContract │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ HasSlashIndicatorContract │ _slashIndicatorContract │ 0 │ 0 │ t_contract(ISlashIndicator)10961 │ │ │ 20 │ +│ HasSlashIndicatorContract │ _slashIndicatorContract │ 0 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ HasStakingContract │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ HasStakingContract │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ HasStakingVestingContract │ _stakingVestingContract │ 0 │ 0 │ t_contract(IStakingVesting)10357 │ │ │ 20 │ +│ HasStakingVestingContract │ _stakingVestingContract │ 0 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ HasValidatorContract │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ HasValidatorContract │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ Initializable │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ Initializable │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ Initializable │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ Initializable │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ JailingStorage │ _miningRewardDeprecatedAtPeriod │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _miningRewardBailoutCutOffAtPeriod │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _bridgeRewardDeprecatedAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _blockProducerJailedBlock │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _emergencyExitJailedTimestamp │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _cannotBailoutUntilBlock │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ JailingStorage │ _miningRewardDeprecatedAtPeriod │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _miningRewardBailoutCutOffAtPeriod │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _bridgeRewardDeprecatedAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _blockProducerJailedBlock │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _emergencyExitJailedTimestamp │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _cannotBailoutUntilBlock │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MainchainGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MainchainGatewayV2 │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MainchainGatewayV2 │ _initialized │ 113 │ 0 │ t_uint8 │ │ │ 1 │ +│ MainchainGatewayV2 │ _initializing │ 113 │ 1 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _roles │ 114 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ _roleMembers │ 115 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ wrappedNativeToken │ 116 │ 0 │ t_contract(IWETH)10375 │ │ │ 20 │ +│ MainchainGatewayV2 │ roninChainId │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ depositCount │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _domainSeparator │ 119 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGatewayV2 │ _roninToken │ 120 │ 0 │ t_mapping(t_address,t_struct(MappedToken)10656_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalHash │ 121 │ 0 │ t_mapping(t_uint256,t_bytes32) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalLocked │ 122 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperatorAddedBlock │ 123 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperators │ 124 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MainchainGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MainchainGatewayV2 │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MainchainGatewayV2 │ _initialized │ 113 │ 0 │ t_uint8 │ │ │ 1 │ +│ MainchainGatewayV2 │ _initializing │ 113 │ 1 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _roles │ 114 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ _roleMembers │ 115 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ wrappedNativeToken │ 116 │ 0 │ t_contract(IWETH)10296 │ │ │ 20 │ +│ MainchainGatewayV2 │ roninChainId │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ depositCount │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _domainSeparator │ 119 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGatewayV2 │ _roninToken │ 120 │ 0 │ t_mapping(t_address,t_struct(MappedToken)10551_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalHash │ 121 │ 0 │ t_mapping(t_uint256,t_bytes32) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalLocked │ 122 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperatorAddedBlock │ 123 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperators │ 124 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ round │ 2 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7418_storage)) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _proposalExpiryDuration │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roninTrustedOrganizationContract │ 5 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ _bridgeContract │ 6 │ 0 │ t_contract(IBridge)9291 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ roninChainId │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ DOMAIN_SEPARATOR │ 8 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 9 │ 0 │ t_struct(BridgeOperatorSet)12596_storage │ │ │ 96 │ +│ MainchainGovernanceAdmin │ _vote │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13097_storage)) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ round │ 2 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _proposalExpiryDuration │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roninTrustedOrganizationContract │ 5 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ _bridgeContract │ 6 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ roninChainId │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ DOMAIN_SEPARATOR │ 8 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 9 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ MainchainGovernanceAdmin │ _vote │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ Maintenance │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ Maintenance │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ Maintenance │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ Maintenance │ _schedule │ 1 │ 0 │ t_mapping(t_address,t_struct(Schedule)9566_storage) │ │ │ 32 │ +│ Maintenance │ minMaintenanceDurationInBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxMaintenanceDurationInBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ minOffsetToStartSchedule │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxOffsetToStartSchedule │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxSchedules │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ cooldownSecsToMaintain │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ Maintenance │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ Maintenance │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ Maintenance │ _schedule │ 1 │ 0 │ t_mapping(t_address,t_struct(Schedule)9487_storage) │ │ │ 32 │ +│ Maintenance │ minMaintenanceDurationInBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxMaintenanceDurationInBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ minOffsetToStartSchedule │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxOffsetToStartSchedule │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxSchedules │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ cooldownSecsToMaintain │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ MinimumWithdrawal │ minimumThreshold │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MinimumWithdrawal │ ______gap │ 1 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MinimumWithdrawal │ minimumThreshold │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MinimumWithdrawal │ ______gap │ 1 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockBridge │ bridgeOperatorAddedBlock │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockBridge │ bridgeOperators │ 1 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockBridge │ bridgeOperatorAddedBlock │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockBridge │ bridgeOperators │ 1 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockForwarderTarget │ owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockForwarderTarget │ data │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockForwarderTarget │ owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockForwarderTarget │ data │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockGatewayForTracking │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ MockGatewayForTracking │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockPaymentFallbackExpensive │ array │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockPaymentFallbackExpensive │ array │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockPCUPickValidatorSet │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUPickValidatorSet │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUSortValidators │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUSortValidators │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUValidateDoubleSign │ _precompileValidateDoubleSignAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUValidateDoubleSign │ _precompileValidateDoubleSignAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninGatewayV2Extended │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninGatewayV2Extended │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13097_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13097_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14565_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10656_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13097_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninGatewayV2Extended │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninGatewayV2Extended │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14469_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10551_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetExtended │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 61 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ MockRoninValidatorSetExtended │ _stakingVestingContract │ 108 │ 0 │ t_contract(IStakingVesting)10357 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _bridgeTrackingContract │ 109 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maintenanceContract │ 110 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _slashIndicatorContract │ 111 │ 0 │ t_contract(ISlashIndicator)10961 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _stakingContract │ 112 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorCandidate │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidates │ 114 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateIndex │ 115 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateInfo │ 116 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _minEffectiveDaysOnwards │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateCommissionChangeSchedule │ 118 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 119 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _profileContract │ 167 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetExtended │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockRoninValidatorSetExtended │ _initialized │ 278 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _epochs │ 279 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetExtended │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetExtended │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockRoninValidatorSetExtended │ _initialized │ 278 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _epochs │ 279 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 61 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingVestingContract │ 108 │ 0 │ t_contract(IStakingVesting)10357 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeTrackingContract │ 109 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maintenanceContract │ 110 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _slashIndicatorContract │ 111 │ 0 │ t_contract(ISlashIndicator)10961 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingContract │ 112 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorCandidate │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidates │ 114 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateIndex │ 115 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateInfo │ 116 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _minEffectiveDaysOnwards │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateCommissionChangeSchedule │ 118 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 119 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _profileContract │ 167 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockRoninValidatorSetOverridePrecompile │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockSlashIndicatorExtended │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockSlashIndicatorExtended │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10089 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockSlashIndicatorExtended │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ MockSlashIndicatorExtended │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockSlashIndicatorExtended │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockSlashIndicatorExtended │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ MockSorting │ data │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockSorting │ data │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockStaking │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10664_storage)) │ │ │ 32 │ +│ MockStaking │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11444_storage)) │ │ │ 32 │ +│ MockStaking │ _stakingPool │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11450_storage) │ │ │ 32 │ +│ MockStaking │ ______gap │ 3 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockStaking │ _stakingAmount │ 52 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockStaking │ _periodSlashed │ 53 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MockStaking │ _stakingTotal │ 54 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ lastUpdatedPeriod │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ pendingReward │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ poolAddr │ 57 │ 0 │ t_address │ │ │ 20 │ +│ MockStaking │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ MockStaking │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ MockStaking │ _stakingPoolField │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ MockStaking │ ______gap │ 3 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockStaking │ _stakingAmount │ 53 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockStaking │ _periodSlashed │ 54 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MockStaking │ _stakingTotal │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ lastUpdatedPeriod │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ pendingReward │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ poolAddr │ 58 │ 0 │ t_address │ │ │ 20 │ +│ MockTransfer │ track │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockTransfer │ track │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ MockValidatorSet │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockValidatorSet │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockValidatorSet │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ MockValidatorSet │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ MockValidatorSet │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockValidatorSet │ stakingVestingContract │ 55 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ slashIndicatorContract │ 56 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ _lastUpdatedPeriod │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _numberOfBlocksInEpoch │ 58 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _periodSlashed │ 59 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MockValidatorSet │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ MockValidatorSet │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockValidatorSet │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockValidatorSet │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ MockValidatorSet │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ MockValidatorSet │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockValidatorSet │ stakingVestingContract │ 55 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ slashIndicatorContract │ 56 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ _lastUpdatedPeriod │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _numberOfBlocksInEpoch │ 58 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _periodSlashed │ 59 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ Ownable │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ Ownable │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ Pausable │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ Pausable │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ PauseEnforcer │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ PauseEnforcer │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ PauseEnforcer │ target │ 2 │ 0 │ t_contract(IPauseTarget)9750 │ │ │ 20 │ +│ PauseEnforcer │ emergency │ 2 │ 20 │ t_bool │ │ │ 1 │ +│ PauseEnforcer │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ PauseEnforcer │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ PauseEnforcer │ target │ 2 │ 0 │ t_contract(IPauseTarget)9671 │ │ │ 20 │ +│ PauseEnforcer │ emergency │ 2 │ 20 │ t_bool │ │ │ 1 │ +│ Profile │ _id2Profile │ 0 │ 0 │ t_mapping(t_address,t_struct(CandidateProfile)21624_storage) │ │ │ 32 │ +│ Profile │ _consensus2Id │ 1 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ ProxyAdmin │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ ProxyAdmin │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ ReentrancyGuard │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ ReentrancyGuard │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ RewardCalculation │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10664_storage)) │ │ │ 32 │ +│ RewardCalculation │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11444_storage)) │ │ │ 32 │ +│ RewardCalculation │ _stakingPool │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11450_storage) │ │ │ 32 │ +│ RewardCalculation │ ______gap │ 3 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RewardCalculation │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ RewardCalculation │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ RewardCalculation │ _stakingPoolField │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ RewardCalculation │ ______gap │ 3 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninGatewayV2 │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninGatewayV2 │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGatewayV2 │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninGatewayV2 │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13097_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13097_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14565_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10656_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ RoninGatewayV2 │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ RoninGatewayV2 │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13097_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ RoninGatewayV2 │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninGatewayV2 │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninGatewayV2 │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGatewayV2 │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninGatewayV2 │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14469_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10551_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ RoninGatewayV2 │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ RoninGatewayV2 │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninGatewayV2 │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7418_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9291 │ │ │ 20 │ +│ RoninGovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 7 │ 0 │ t_struct(BridgeOperatorSet)12596_storage │ │ │ 96 │ +│ RoninGovernanceAdmin │ _bridgeOperatorVote │ 10 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13097_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastVotedBlock │ 11 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _bridgeVoterSig │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10674_storage))) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _validatorContract │ 13 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _emergencyExitPoll │ 14 │ 0 │ t_mapping(t_bytes32,t_struct(Vote)13097_storage) │ │ │ 32 │ +│ RoninGovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ RoninGovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 7 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ RoninGovernanceAdmin │ _bridgeOperatorVote │ 10 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastVotedBlock │ 11 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _bridgeVoterSig │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10569_storage))) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _validatorContract │ 13 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _emergencyExitPoll │ 14 │ 0 │ t_mapping(t_bytes32,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ RoninTrustedOrganization │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninTrustedOrganization │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninTrustedOrganization │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _totalWeight │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusWeight │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorWeight │ 6 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterWeight │ 7 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _addedBlock │ 8 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusList │ 9 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorList │ 10 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterList │ 11 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninTrustedOrganization │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninTrustedOrganization │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _totalWeight │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusWeight │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorWeight │ 6 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterWeight │ 7 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _addedBlock │ 8 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusList │ 9 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorList │ 10 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterList │ 11 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninValidatorSet │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninValidatorSet │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninValidatorSet │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 61 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ RoninValidatorSet │ _stakingVestingContract │ 108 │ 0 │ t_contract(IStakingVesting)10357 │ │ │ 20 │ +│ RoninValidatorSet │ _bridgeTrackingContract │ 109 │ 0 │ t_contract(IBridgeTracking)9362 │ │ │ 20 │ +│ RoninValidatorSet │ _maintenanceContract │ 110 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ RoninValidatorSet │ _slashIndicatorContract │ 111 │ 0 │ t_contract(ISlashIndicator)10961 │ │ │ 20 │ +│ RoninValidatorSet │ _stakingContract │ 112 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorCandidate │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidates │ 114 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _candidateIndex │ 115 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _candidateInfo │ 116 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11618_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _minEffectiveDaysOnwards │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidateCommissionChangeSchedule │ 118 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11623_storage) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 119 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _profileContract │ 167 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ RoninValidatorSet │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ RoninValidatorSet │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ RoninValidatorSet │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninValidatorSet │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ RoninValidatorSet │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninValidatorSet │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninValidatorSet │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninValidatorSet │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ RoninValidatorSet │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ RoninValidatorSet │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ RoninValidatorSet │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ RoninValidatorSet │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ RoninValidatorSet │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ RoninValidatorSet │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninValidatorSet │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ SlashBridgeOperator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ SlashBridgeOperator │ _missingVotesRatioTier1 │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _missingVotesRatioTier2 │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _jailDurationForMissingVotesRatioTier2 │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _skipBridgeOperatorSlashingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ ______gap │ 5 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashBridgeOperator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashBridgeOperator │ _missingVotesRatioTier1 │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _missingVotesRatioTier2 │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _jailDurationForMissingVotesRatioTier2 │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _skipBridgeOperatorSlashingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ ______gap │ 5 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashBridgeVoting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninTrustedOrganizationContract │ 1 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninGovernanceAdminContract │ 2 │ 0 │ t_contract(IRoninGovernanceAdmin)10089 │ │ │ 20 │ +│ SlashBridgeVoting │ _bridgeVotingSlashed │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingSlashAmount │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashBridgeVoting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninTrustedOrganizationContract │ 1 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninGovernanceAdminContract │ 2 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ SlashBridgeVoting │ _bridgeVotingSlashed │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingSlashAmount │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashDoubleSign │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ SlashDoubleSign │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashDoubleSign │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashDoubleSign │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashDoubleSign │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashDoubleSign │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashIndicator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ SlashIndicator │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashIndicator │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ SlashIndicator │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10089 │ │ │ 20 │ +│ SlashIndicator │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9736 │ │ │ 20 │ +│ SlashIndicator │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashIndicator │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ SlashIndicator │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ SlashIndicator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashIndicator │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashIndicator │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashIndicator │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ SlashIndicator │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ SlashIndicator │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashIndicator │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ SlashIndicator │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ SlashingExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ SlashingExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)47_storage │ │ │ 1504 │ +│ SlashingExecution │ _slashIndicatorContract │ 107 │ 0 │ t_contract(ISlashIndicator)10961 │ │ │ 20 │ +│ SlashingExecution │ _stakingContract │ 108 │ 0 │ t_contract(IStaking)11601 │ │ │ 20 │ +│ SlashingExecution │ _profileContract │ 109 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ SlashingExecution │ _roninTrustedOrganizationContract │ 110 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ SlashingExecution │ _maxValidatorNumber │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ validatorCount │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _validators │ 113 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ SlashingExecution │ _validatorMap │ 114 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ SlashingExecution │ _maxPrioritizedValidatorNumber │ 115 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 116 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashingExecution │ _miningReward │ 166 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _delegatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalBridgeReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _bridgeOperatingReward │ 169 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalDeprecatedReward │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitLockedAmount │ 171 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExpiryDuration │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lockedConsensusList │ 173 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ SlashingExecution │ _exitInfo │ 174 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12151_storage) │ │ │ 32 │ +│ SlashingExecution │ _lockedFundReleased │ 175 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 176 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ SlashingExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ SlashingExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashingExecution │ _slashIndicatorContract │ 108 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ SlashingExecution │ _stakingContract │ 109 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ SlashingExecution │ _roninTrustedOrganizationContract │ 110 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashingExecution │ _maxValidatorNumber │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ validatorCount │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _validators │ 113 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ SlashingExecution │ _validatorMap │ 114 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ SlashingExecution │ _maxPrioritizedValidatorNumber │ 115 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 116 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashingExecution │ _miningReward │ 166 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _delegatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalBridgeReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _bridgeOperatingReward │ 169 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalDeprecatedReward │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitLockedAmount │ 171 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExpiryDuration │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lockedConsensusList │ 173 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ SlashingExecution │ _exitInfo │ 174 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ SlashingExecution │ _lockedFundReleased │ 175 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 176 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ SlashUnavailability │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ SlashUnavailability │ lastUnavailabilitySlashedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityIndicator │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier1Threshold │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier2Threshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _slashAmountForUnavailabilityTier2Threshold │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _jailDurationForUnavailabilityTier2Threshold │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ ______gap │ 7 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashUnavailability │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashUnavailability │ lastUnavailabilitySlashedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityIndicator │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier1Threshold │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier2Threshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _slashAmountForUnavailabilityTier2Threshold │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _jailDurationForUnavailabilityTier2Threshold │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ ______gap │ 7 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10664_storage)) │ │ │ 32 │ +│ Staking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11444_storage)) │ │ │ 32 │ +│ Staking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11450_storage) │ │ │ 32 │ +│ Staking │ ______gap │ 4 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ Staking │ _profileContract │ 53 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ Staking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ Staking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)11051_storage) │ │ │ 32 │ +│ Staking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ Staking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ Staking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ Staking │ ______gap │ 159 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _initialized │ 209 │ 0 │ t_uint8 │ │ │ 1 │ +│ Staking │ _initializing │ 209 │ 1 │ t_bool │ │ │ 1 │ +│ Staking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ Staking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ Staking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ Staking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ Staking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ Staking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ Staking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ Staking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ Staking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ Staking │ ______gap │ 159 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _initialized │ 209 │ 0 │ t_uint8 │ │ │ 1 │ +│ Staking │ _initializing │ 209 │ 1 │ t_bool │ │ │ 1 │ +│ StakingVesting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)12085 │ │ │ 20 │ +│ StakingVesting │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ StakingVesting │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ StakingVesting │ _blockProducerBonusPerBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ _bridgeOperatorBonusPerBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ lastBlockSendingBonus │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ StakingVesting │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ StakingVesting │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ StakingVesting │ _blockProducerBonusPerBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ _bridgeOperatorBonusPerBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ lastBlockSendingBonus │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ TimingStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ TimingStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ TimingStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ ValidatorInfoStorage │ _profileContract │ 0 │ 0 │ t_contract(IProfile)21640 │ │ │ 20 │ +│ ValidatorInfoStorage │ _roninTrustedOrganizationContract │ 1 │ 0 │ t_contract(IRoninTrustedOrganization)10268 │ │ │ 20 │ +│ ValidatorInfoStorage │ _maxValidatorNumber │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ validatorCount │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ _validators │ 4 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ ValidatorInfoStorage │ _validatorMap │ 5 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12730) │ │ │ 32 │ +│ ValidatorInfoStorage │ _maxPrioritizedValidatorNumber │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ ______gap │ 7 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ ValidatorInfoStorage │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ ValidatorInfoStorage │ _maxValidatorNumber │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ validatorCount │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ _validators │ 3 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ ValidatorInfoStorage │ _validatorMap │ 4 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ ValidatorInfoStorage │ _maxPrioritizedValidatorNumber │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ VaultForwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ VaultForwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ VaultForwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ VaultForwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ WithdrawalLimitation │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ WithdrawalLimitation │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ WithdrawalLimitation │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ WithdrawalLimitation │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ WithdrawalLimitation │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ WithdrawalLimitation │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +└─────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────────┴───────────────┘ \ No newline at end of file diff --git a/storageLayout/profile-before.txt b/storageLayout/profile-before.txt new file mode 100644 index 000000000..d20571a5e --- /dev/null +++ b/storageLayout/profile-before.txt @@ -0,0 +1,1504 @@ +┌─────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────┬─────┬──────────┬───────────────┐ +│ contract │ state_variable │ storage_slot │ offset │ type │ idx │ artifact │ numberOfBytes │ +├─────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────────┼───────────────┤ +│ AccessControl │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControl │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ AccessControlEnumerable │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ BaseStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ BaseStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11339_storage)) │ │ │ 32 │ +│ BaseStaking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11345_storage) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ BaseStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ BaseStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ BaseStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ BaseStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ BaseStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ BaseStaking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ BaseStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ BaseStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ BaseStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ BaseStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ BaseStaking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ BaseStaking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ BOsGovernanceProposal │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12491_storage │ │ │ 96 │ +│ BOsGovernanceProposal │ _bridgeOperatorVote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12992_storage)) │ │ │ 32 │ +│ BOsGovernanceProposal │ _lastVotedBlock │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ BOsGovernanceProposal │ _bridgeVoterSig │ 5 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10569_storage))) │ │ │ 32 │ +│ BOsGovernanceProposal │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ BOsGovernanceProposal │ _bridgeOperatorVote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ BOsGovernanceProposal │ _lastVotedBlock │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ BOsGovernanceProposal │ _bridgeVoterSig │ 5 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10569_storage))) │ │ │ 32 │ +│ BOsGovernanceRelay │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12491_storage │ │ │ 96 │ +│ BOsGovernanceRelay │ _vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12992_storage)) │ │ │ 32 │ +│ BOsGovernanceRelay │ _lastSyncedBridgeOperatorSetInfo │ 0 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ BOsGovernanceRelay │ _vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ BridgeTracking │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ BridgeTracking │ _validatorContract │ 1 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ BridgeTracking │ _initialized │ 1 │ 20 │ t_uint8 │ │ │ 1 │ +│ BridgeTracking │ _initializing │ 1 │ 21 │ t_bool │ │ │ 1 │ +│ BridgeTracking │ startedAtBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ BridgeTracking │ _bufferMetric │ 3 │ 0 │ t_struct(PeriodVotingMetricTimeWrapper)23099_storage │ │ │ 192 │ +│ BridgeTracking │ _periodMetric │ 9 │ 0 │ t_mapping(t_uint256,t_struct(PeriodVotingMetric)23089_storage) │ │ │ 32 │ +│ BridgeTracking │ _receiptTrackingInfo │ 10 │ 0 │ t_mapping(t_enum(VoteKind)9224,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23115_storage)) │ │ │ 32 │ +│ BridgeTracking │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ BridgeTracking │ _validatorContract │ 1 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ BridgeTracking │ _initialized │ 1 │ 20 │ t_uint8 │ │ │ 1 │ +│ BridgeTracking │ _initializing │ 1 │ 21 │ t_bool │ │ │ 1 │ +│ BridgeTracking │ startedAtBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ BridgeTracking │ _bufferMetric │ 3 │ 0 │ t_struct(PeriodVotingMetricTimeWrapper)23108_storage │ │ │ 192 │ +│ BridgeTracking │ _periodMetric │ 9 │ 0 │ t_mapping(t_uint256,t_struct(PeriodVotingMetric)23098_storage) │ │ │ 32 │ +│ BridgeTracking │ _receiptTrackingInfo │ 10 │ 0 │ t_mapping(t_enum(VoteKind)9224,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23124_storage)) │ │ │ 32 │ +│ CandidateManager │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ CandidateManager │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CandidateManager │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CandidateManager │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ CandidateManager │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ CandidateManager │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateManager │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ CandidateManager │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CandidateManager │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CandidateManager │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ CandidateManager │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateManager │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ CandidateManager │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ CandidateStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11339_storage)) │ │ │ 32 │ +│ CandidateStaking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11345_storage) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CandidateStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ CandidateStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ CandidateStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CandidateStaking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ CandidateStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ CandidateStaking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CandidateStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ CandidateStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ CandidateStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ CandidateStaking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CandidateStaking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CandidateStaking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CoinbaseExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _stakingVestingContract │ 108 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ CoinbaseExecution │ _bridgeTrackingContract │ 109 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ CoinbaseExecution │ _maintenanceContract │ 110 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ CoinbaseExecution │ _slashIndicatorContract │ 111 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ CoinbaseExecution │ _stakingContract │ 112 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorCandidate │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidates │ 114 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _candidateIndex │ 115 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _candidateInfo │ 116 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _minEffectiveDaysOnwards │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidateCommissionChangeSchedule │ 118 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 119 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _roninTrustedOrganizationContract │ 167 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ validatorCount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _validators │ 170 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CoinbaseExecution │ _validatorMap │ 171 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ CoinbaseExecution │ _maxPrioritizedValidatorNumber │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 173 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CoinbaseExecution │ _miningReward │ 223 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _delegatingReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalBridgeReward │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeOperatingReward │ 226 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalDeprecatedReward │ 227 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitLockedAmount │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExpiryDuration │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lockedConsensusList │ 230 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _exitInfo │ 231 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _lockedFundReleased │ 232 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 233 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CoinbaseExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CoinbaseExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CoinbaseExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _stakingVestingContract │ 108 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ CoinbaseExecution │ _bridgeTrackingContract │ 109 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ CoinbaseExecution │ _maintenanceContract │ 110 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ CoinbaseExecution │ _slashIndicatorContract │ 111 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ CoinbaseExecution │ _stakingContract │ 112 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorCandidate │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidates │ 114 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _candidateIndex │ 115 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _candidateInfo │ 116 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _minEffectiveDaysOnwards │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _candidateCommissionChangeSchedule │ 118 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 119 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CoinbaseExecution │ _roninTrustedOrganizationContract │ 167 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ CoinbaseExecution │ _maxValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ validatorCount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _validators │ 170 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CoinbaseExecution │ _validatorMap │ 171 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ CoinbaseExecution │ _maxPrioritizedValidatorNumber │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 173 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CoinbaseExecution │ _miningReward │ 223 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _delegatingReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalBridgeReward │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _bridgeOperatingReward │ 226 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CoinbaseExecution │ _totalDeprecatedReward │ 227 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExitLockedAmount │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _emergencyExpiryDuration │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoinbaseExecution │ _lockedConsensusList │ 230 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CoinbaseExecution │ _exitInfo │ 231 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ CoinbaseExecution │ _lockedFundReleased │ 232 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CoinbaseExecution │ ______gap │ 233 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CommonStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CommonStorage │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CommonStorage │ _roninTrustedOrganizationContract │ 108 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ CommonStorage │ _maxValidatorNumber │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ validatorCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _validators │ 111 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CommonStorage │ _validatorMap │ 112 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ CommonStorage │ _maxPrioritizedValidatorNumber │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ ______gap │ 114 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CommonStorage │ _miningReward │ 164 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _delegatingReward │ 165 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalBridgeReward │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _bridgeOperatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalDeprecatedReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExitLockedAmount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExpiryDuration │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lockedConsensusList │ 171 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CommonStorage │ _exitInfo │ 172 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ CommonStorage │ _lockedFundReleased │ 173 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 174 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CommonStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ CommonStorage │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CommonStorage │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ CommonStorage │ _roninTrustedOrganizationContract │ 108 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ CommonStorage │ _maxValidatorNumber │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ validatorCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _validators │ 111 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ CommonStorage │ _validatorMap │ 112 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ CommonStorage │ _maxPrioritizedValidatorNumber │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ ______gap │ 114 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CommonStorage │ _miningReward │ 164 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _delegatingReward │ 165 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalBridgeReward │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _bridgeOperatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CommonStorage │ _totalDeprecatedReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExitLockedAmount │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _emergencyExpiryDuration │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ CommonStorage │ _lockedConsensusList │ 171 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ CommonStorage │ _exitInfo │ 172 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ CommonStorage │ _lockedFundReleased │ 173 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ CommonStorage │ ______gap │ 174 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ CoreGovernance │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoreGovernance │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ CoreGovernance │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CoreGovernance │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ CoreGovernance │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ CoreGovernance │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ CreditScore │ _maintenanceContract │ 1 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ CreditScore │ _checkBailedOutAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CreditScore │ _creditScore │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CreditScore │ _gainCreditScore │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _maxCreditScore │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _bailOutCostMultiplier │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _cutOffPercentageAfterBailout │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ ______gap │ 8 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ CreditScore │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ CreditScore │ _maintenanceContract │ 1 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ CreditScore │ _checkBailedOutAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ CreditScore │ _creditScore │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ CreditScore │ _gainCreditScore │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _maxCreditScore │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _bailOutCostMultiplier │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ _cutOffPercentageAfterBailout │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ CreditScore │ ______gap │ 8 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11339_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11345_storage) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ DelegatorStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ DelegatorStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ DelegatorStaking │ ______gap │ 108 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ DelegatorStaking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ DelegatorStaking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ DelegatorStaking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ DelegatorStaking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ DelegatorStaking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ DelegatorStaking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ DelegatorStaking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ DelegatorStaking │ ______gap │ 108 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ EmergencyExit │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ EmergencyExit │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _stakingContract │ 108 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorCandidate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidates │ 110 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _candidateIndex │ 111 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _candidateInfo │ 112 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ EmergencyExit │ _minEffectiveDaysOnwards │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidateCommissionChangeSchedule │ 114 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 115 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _roninTrustedOrganizationContract │ 163 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorNumber │ 164 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ validatorCount │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _validators │ 166 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ EmergencyExit │ _validatorMap │ 167 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ EmergencyExit │ _maxPrioritizedValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ EmergencyExit │ _miningReward │ 219 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _delegatingReward │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalBridgeReward │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _bridgeOperatingReward │ 222 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalDeprecatedReward │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitLockedAmount │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExpiryDuration │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lockedConsensusList │ 226 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _exitInfo │ 227 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ EmergencyExit │ _lockedFundReleased │ 228 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 229 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ EmergencyExit │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ EmergencyExit │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ EmergencyExit │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _stakingContract │ 108 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorCandidate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidates │ 110 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _candidateIndex │ 111 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _candidateInfo │ 112 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ EmergencyExit │ _minEffectiveDaysOnwards │ 113 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _candidateCommissionChangeSchedule │ 114 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 115 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ EmergencyExit │ _roninTrustedOrganizationContract │ 163 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ EmergencyExit │ _maxValidatorNumber │ 164 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ validatorCount │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _validators │ 166 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ EmergencyExit │ _validatorMap │ 167 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ EmergencyExit │ _maxPrioritizedValidatorNumber │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ EmergencyExit │ _miningReward │ 219 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _delegatingReward │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalBridgeReward │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _bridgeOperatingReward │ 222 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ EmergencyExit │ _totalDeprecatedReward │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExitLockedAmount │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _emergencyExpiryDuration │ 225 │ 0 │ t_uint256 │ │ │ 32 │ +│ EmergencyExit │ _lockedConsensusList │ 226 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ EmergencyExit │ _exitInfo │ 227 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ EmergencyExit │ _lockedFundReleased │ 228 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ EmergencyExit │ ______gap │ 229 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ ERC20 │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20 │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20 │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20 │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20 │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20 │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20 │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20 │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20 │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20 │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Burnable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Burnable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Burnable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Burnable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Burnable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Burnable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Burnable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Pausable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Pausable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Pausable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _paused │ 5 │ 0 │ t_bool │ │ │ 1 │ +│ ERC20Pausable │ _balances │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20Pausable │ _allowances │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20Pausable │ _totalSupply │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20Pausable │ _name │ 3 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _symbol │ 4 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20Pausable │ _paused │ 5 │ 0 │ t_bool │ │ │ 1 │ +│ ERC20PresetMinterPauser │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _balances │ 2 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _allowances │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _totalSupply │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _name │ 5 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _symbol │ 6 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _paused │ 7 │ 0 │ t_bool │ │ │ 1 │ +│ ERC20PresetMinterPauser │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _balances │ 2 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _allowances │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_uint256)) │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _totalSupply │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _name │ 5 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _symbol │ 6 │ 0 │ t_string_storage │ │ │ 32 │ +│ ERC20PresetMinterPauser │ _paused │ 7 │ 0 │ t_bool │ │ │ 1 │ +│ Forwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ Forwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ Forwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ Forwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ GatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ GatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ GatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ GatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ GatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ GatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ GovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ GovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ GovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ GovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ GovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ GovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ GovernanceProposal │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceProposal │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceProposal │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceProposal │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceProposal │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceProposal │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceRelay │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceRelay │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceRelay │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ GovernanceRelay │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ GovernanceRelay │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ GovernanceRelay │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ HasBridgeContract │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ HasBridgeContract │ _bridgeContract │ 0 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ HasBridgeTrackingContract │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ HasBridgeTrackingContract │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ HasMaintenanceContract │ _maintenanceContract │ 0 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ HasMaintenanceContract │ _maintenanceContract │ 0 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ HasRoninGovernanceAdminContract │ _roninGovernanceAdminContract │ 0 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ HasRoninGovernanceAdminContract │ _roninGovernanceAdminContract │ 0 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ HasRoninTrustedOrganizationContract │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ HasRoninTrustedOrganizationContract │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ HasSlashIndicatorContract │ _slashIndicatorContract │ 0 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ HasSlashIndicatorContract │ _slashIndicatorContract │ 0 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ HasStakingContract │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ HasStakingContract │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ HasStakingVestingContract │ _stakingVestingContract │ 0 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ HasStakingVestingContract │ _stakingVestingContract │ 0 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ HasValidatorContract │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ HasValidatorContract │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ Initializable │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ Initializable │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ Initializable │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ Initializable │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ JailingStorage │ _miningRewardDeprecatedAtPeriod │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _miningRewardBailoutCutOffAtPeriod │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _bridgeRewardDeprecatedAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _blockProducerJailedBlock │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _emergencyExitJailedTimestamp │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _cannotBailoutUntilBlock │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ JailingStorage │ _miningRewardDeprecatedAtPeriod │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _miningRewardBailoutCutOffAtPeriod │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _bridgeRewardDeprecatedAtPeriod │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ JailingStorage │ _blockProducerJailedBlock │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _emergencyExitJailedTimestamp │ 4 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ _cannotBailoutUntilBlock │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ JailingStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MainchainGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MainchainGatewayV2 │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MainchainGatewayV2 │ _initialized │ 113 │ 0 │ t_uint8 │ │ │ 1 │ +│ MainchainGatewayV2 │ _initializing │ 113 │ 1 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _roles │ 114 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ _roleMembers │ 115 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ wrappedNativeToken │ 116 │ 0 │ t_contract(IWETH)10296 │ │ │ 20 │ +│ MainchainGatewayV2 │ roninChainId │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ depositCount │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _domainSeparator │ 119 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGatewayV2 │ _roninToken │ 120 │ 0 │ t_mapping(t_address,t_struct(MappedToken)10551_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalHash │ 121 │ 0 │ t_mapping(t_uint256,t_bytes32) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalLocked │ 122 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperatorAddedBlock │ 123 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperators │ 124 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MainchainGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MainchainGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MainchainGatewayV2 │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MainchainGatewayV2 │ _initialized │ 113 │ 0 │ t_uint8 │ │ │ 1 │ +│ MainchainGatewayV2 │ _initializing │ 113 │ 1 │ t_bool │ │ │ 1 │ +│ MainchainGatewayV2 │ _roles │ 114 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ _roleMembers │ 115 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ wrappedNativeToken │ 116 │ 0 │ t_contract(IWETH)10296 │ │ │ 20 │ +│ MainchainGatewayV2 │ roninChainId │ 117 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ depositCount │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGatewayV2 │ _domainSeparator │ 119 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGatewayV2 │ _roninToken │ 120 │ 0 │ t_mapping(t_address,t_struct(MappedToken)10551_storage) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalHash │ 121 │ 0 │ t_mapping(t_uint256,t_bytes32) │ │ │ 32 │ +│ MainchainGatewayV2 │ withdrawalLocked │ 122 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperatorAddedBlock │ 123 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MainchainGatewayV2 │ _bridgeOperators │ 124 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ round │ 2 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _proposalExpiryDuration │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roninTrustedOrganizationContract │ 5 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ _bridgeContract │ 6 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ roninChainId │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ DOMAIN_SEPARATOR │ 8 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 9 │ 0 │ t_struct(BridgeOperatorSet)12491_storage │ │ │ 96 │ +│ MainchainGovernanceAdmin │ _vote │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12992_storage)) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ round │ 2 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ vote │ 3 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _proposalExpiryDuration │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _roninTrustedOrganizationContract │ 5 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ _bridgeContract │ 6 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ MainchainGovernanceAdmin │ roninChainId │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ DOMAIN_SEPARATOR │ 8 │ 0 │ t_bytes32 │ │ │ 32 │ +│ MainchainGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 9 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ MainchainGovernanceAdmin │ _vote │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ Maintenance │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ Maintenance │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ Maintenance │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ Maintenance │ _schedule │ 1 │ 0 │ t_mapping(t_address,t_struct(Schedule)9487_storage) │ │ │ 32 │ +│ Maintenance │ minMaintenanceDurationInBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxMaintenanceDurationInBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ minOffsetToStartSchedule │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxOffsetToStartSchedule │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxSchedules │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ cooldownSecsToMaintain │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ Maintenance │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ Maintenance │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ Maintenance │ _schedule │ 1 │ 0 │ t_mapping(t_address,t_struct(Schedule)9487_storage) │ │ │ 32 │ +│ Maintenance │ minMaintenanceDurationInBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxMaintenanceDurationInBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ minOffsetToStartSchedule │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxOffsetToStartSchedule │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ maxSchedules │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ Maintenance │ cooldownSecsToMaintain │ 7 │ 0 │ t_uint256 │ │ │ 32 │ +│ MinimumWithdrawal │ minimumThreshold │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MinimumWithdrawal │ ______gap │ 1 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MinimumWithdrawal │ minimumThreshold │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MinimumWithdrawal │ ______gap │ 1 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockBridge │ bridgeOperatorAddedBlock │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockBridge │ bridgeOperators │ 1 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockBridge │ bridgeOperatorAddedBlock │ 0 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockBridge │ bridgeOperators │ 1 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockForwarderTarget │ owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockForwarderTarget │ data │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockForwarderTarget │ owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockForwarderTarget │ data │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockGatewayForTracking │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockGatewayForTracking │ _bridgeTrackingContract │ 0 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockPaymentFallbackExpensive │ array │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockPaymentFallbackExpensive │ array │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockPCUPickValidatorSet │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUPickValidatorSet │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUSortValidators │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUSortValidators │ _precompileSortValidatorAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUValidateDoubleSign │ _precompileValidateDoubleSignAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockPCUValidateDoubleSign │ _precompileValidateDoubleSignAddress │ 0 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninGatewayV2Extended │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninGatewayV2Extended │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12992_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)12992_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14460_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10551_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)12992_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninGatewayV2Extended │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninGatewayV2Extended │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninGatewayV2Extended │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14469_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10551_storage)) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninGatewayV2Extended │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninGatewayV2Extended │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetExtended │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetExtended │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockRoninValidatorSetExtended │ _initialized │ 278 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _epochs │ 279 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetExtended │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetExtended │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninValidatorSetExtended │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetExtended │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetExtended │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockRoninValidatorSetExtended │ _initialized │ 278 │ 0 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetExtended │ _epochs │ 279 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockRoninValidatorSetOverridePrecompile │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ MockRoninValidatorSetOverridePrecompile │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockRoninValidatorSetOverridePrecompile │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockRoninValidatorSetOverridePrecompile │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ MockRoninValidatorSetOverridePrecompile │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ MockSlashIndicatorExtended │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockSlashIndicatorExtended │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockSlashIndicatorExtended │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ MockSlashIndicatorExtended │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockSlashIndicatorExtended │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockSlashIndicatorExtended │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockSlashIndicatorExtended │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ MockSlashIndicatorExtended │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ MockSorting │ data │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockSorting │ data │ 0 │ 0 │ t_array(t_uint256)dyn_storage │ │ │ 32 │ +│ MockStaking │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ MockStaking │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11339_storage)) │ │ │ 32 │ +│ MockStaking │ _stakingPool │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11345_storage) │ │ │ 32 │ +│ MockStaking │ ______gap │ 3 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockStaking │ _stakingAmount │ 53 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockStaking │ _periodSlashed │ 54 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MockStaking │ _stakingTotal │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ lastUpdatedPeriod │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ pendingReward │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ poolAddr │ 58 │ 0 │ t_address │ │ │ 20 │ +│ MockStaking │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ MockStaking │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ MockStaking │ _stakingPoolField │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ MockStaking │ ______gap │ 3 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ MockStaking │ _stakingAmount │ 53 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockStaking │ _periodSlashed │ 54 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MockStaking │ _stakingTotal │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ lastUpdatedPeriod │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ pendingReward │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockStaking │ poolAddr │ 58 │ 0 │ t_address │ │ │ 20 │ +│ MockTransfer │ track │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockTransfer │ track │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ MockValidatorSet │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockValidatorSet │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockValidatorSet │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ MockValidatorSet │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ MockValidatorSet │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockValidatorSet │ stakingVestingContract │ 55 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ slashIndicatorContract │ 56 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ _lastUpdatedPeriod │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _numberOfBlocksInEpoch │ 58 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _periodSlashed │ 59 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ MockValidatorSet │ _stakingContract │ 0 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ MockValidatorSet │ _maxValidatorCandidate │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidates │ 2 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ MockValidatorSet │ _candidateIndex │ 3 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ MockValidatorSet │ _candidateInfo │ 4 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ MockValidatorSet │ _minEffectiveDaysOnwards │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _candidateCommissionChangeSchedule │ 6 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ MockValidatorSet │ ______gap │ 7 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ MockValidatorSet │ stakingVestingContract │ 55 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ slashIndicatorContract │ 56 │ 0 │ t_address │ │ │ 20 │ +│ MockValidatorSet │ _lastUpdatedPeriod │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _numberOfBlocksInEpoch │ 58 │ 0 │ t_uint256 │ │ │ 32 │ +│ MockValidatorSet │ _periodSlashed │ 59 │ 0 │ t_mapping(t_uint256,t_bool) │ │ │ 32 │ +│ Ownable │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ Ownable │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ Pausable │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ Pausable │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ PauseEnforcer │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ PauseEnforcer │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ PauseEnforcer │ target │ 2 │ 0 │ t_contract(IPauseTarget)9671 │ │ │ 20 │ +│ PauseEnforcer │ emergency │ 2 │ 20 │ t_bool │ │ │ 1 │ +│ PauseEnforcer │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ PauseEnforcer │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ PauseEnforcer │ target │ 2 │ 0 │ t_contract(IPauseTarget)9671 │ │ │ 20 │ +│ PauseEnforcer │ emergency │ 2 │ 20 │ t_bool │ │ │ 1 │ +│ ProxyAdmin │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ ProxyAdmin │ _owner │ 0 │ 0 │ t_address │ │ │ 20 │ +│ ReentrancyGuard │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ ReentrancyGuard │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ RewardCalculation │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ RewardCalculation │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11339_storage)) │ │ │ 32 │ +│ RewardCalculation │ _stakingPool │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11345_storage) │ │ │ 32 │ +│ RewardCalculation │ ______gap │ 3 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RewardCalculation │ _accumulatedRps │ 0 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ RewardCalculation │ _userReward │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ RewardCalculation │ _stakingPoolField │ 2 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ RewardCalculation │ ______gap │ 3 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninGatewayV2 │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninGatewayV2 │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGatewayV2 │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninGatewayV2 │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12992_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)12992_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14460_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10551_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ RoninGatewayV2 │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ RoninGatewayV2 │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)12992_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninGatewayV2 │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ RoninGatewayV2 │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninGatewayV2 │ _initialized │ 55 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninGatewayV2 │ _initializing │ 55 │ 1 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ minimumThreshold │ 56 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGatewayV2 │ ______gap │ 57 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninGatewayV2 │ _roles │ 107 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _roleMembers │ 108 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawalMigrated │ 109 │ 0 │ t_bool │ │ │ 1 │ +│ RoninGatewayV2 │ withdrawalCount │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ depositVote │ 111 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ mainchainWithdrewVote │ 112 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ withdrawal │ 113 │ 0 │ t_mapping(t_uint256,t_struct(Receipt)14469_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _withdrawalSig │ 114 │ 0 │ t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _mainchainToken │ 115 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10551_storage)) │ │ │ 32 │ +│ RoninGatewayV2 │ _validatorContract │ 116 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ RoninGatewayV2 │ _bridgeTrackingContract │ 117 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ RoninGatewayV2 │ withdrawalStatVote │ 118 │ 0 │ t_mapping(t_uint256,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedOrgContract │ 119 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninGatewayV2 │ _trustedNum │ 120 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGatewayV2 │ _trustedDenom │ 121 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ RoninGovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 7 │ 0 │ t_struct(BridgeOperatorSet)12491_storage │ │ │ 96 │ +│ RoninGovernanceAdmin │ _bridgeOperatorVote │ 10 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12992_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastVotedBlock │ 11 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _bridgeVoterSig │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10569_storage))) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _validatorContract │ 13 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _emergencyExitPoll │ 14 │ 0 │ t_mapping(t_bytes32,t_struct(Vote)12992_storage) │ │ │ 32 │ +│ RoninGovernanceAdmin │ round │ 0 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ vote │ 1 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _proposalExpiryDuration │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _roninTrustedOrganizationContract │ 3 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _bridgeContract │ 4 │ 0 │ t_contract(IBridge)9212 │ │ │ 20 │ +│ RoninGovernanceAdmin │ roninChainId │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninGovernanceAdmin │ DOMAIN_SEPARATOR │ 6 │ 0 │ t_bytes32 │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastSyncedBridgeOperatorSetInfo │ 7 │ 0 │ t_struct(BridgeOperatorSet)12500_storage │ │ │ 96 │ +│ RoninGovernanceAdmin │ _bridgeOperatorVote │ 10 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)13001_storage)) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _lastVotedBlock │ 11 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _bridgeVoterSig │ 12 │ 0 │ t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10569_storage))) │ │ │ 32 │ +│ RoninGovernanceAdmin │ _validatorContract │ 13 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ RoninGovernanceAdmin │ _emergencyExitPoll │ 14 │ 0 │ t_mapping(t_bytes32,t_struct(Vote)13001_storage) │ │ │ 32 │ +│ RoninTrustedOrganization │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninTrustedOrganization │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninTrustedOrganization │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _totalWeight │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusWeight │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorWeight │ 6 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterWeight │ 7 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _addedBlock │ 8 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusList │ 9 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorList │ 10 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterList │ 11 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninTrustedOrganization │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninTrustedOrganization │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _totalWeight │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusWeight │ 5 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorWeight │ 6 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterWeight │ 7 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _addedBlock │ 8 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninTrustedOrganization │ _consensusList │ 9 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _governorList │ 10 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninTrustedOrganization │ _bridgeVoterList │ 11 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninValidatorSet │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninValidatorSet │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninValidatorSet │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ RoninValidatorSet │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ RoninValidatorSet │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ RoninValidatorSet │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ RoninValidatorSet │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11513_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11518_storage) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ RoninValidatorSet │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ RoninValidatorSet │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninValidatorSet │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ RoninValidatorSet │ _initialized │ 0 │ 0 │ t_uint8 │ │ │ 1 │ +│ RoninValidatorSet │ _initializing │ 0 │ 1 │ t_bool │ │ │ 1 │ +│ RoninValidatorSet │ _numberOfBlocksInEpoch │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lastUpdatedPeriod │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _currentPeriodStartAtBlock │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _periodOf │ 5 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ RoninValidatorSet │ _miningRewardDeprecatedAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _miningRewardBailoutCutOffAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeRewardDeprecatedAtPeriod │ 57 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ RoninValidatorSet │ _blockProducerJailedBlock │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitJailedTimestamp │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _cannotBailoutUntilBlock │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 61 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _stakingVestingContract │ 109 │ 0 │ t_contract(IStakingVesting)10278 │ │ │ 20 │ +│ RoninValidatorSet │ _bridgeTrackingContract │ 110 │ 0 │ t_contract(IBridgeTracking)9283 │ │ │ 20 │ +│ RoninValidatorSet │ _maintenanceContract │ 111 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ RoninValidatorSet │ _slashIndicatorContract │ 112 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ RoninValidatorSet │ _stakingContract │ 113 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorCandidate │ 114 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidates │ 115 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _candidateIndex │ 116 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _candidateInfo │ 117 │ 0 │ t_mapping(t_address,t_struct(ValidatorCandidate)11522_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _minEffectiveDaysOnwards │ 118 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _candidateCommissionChangeSchedule │ 119 │ 0 │ t_mapping(t_address,t_struct(CommissionSchedule)11527_storage) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 120 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ RoninValidatorSet │ _roninTrustedOrganizationContract │ 168 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ RoninValidatorSet │ _maxValidatorNumber │ 169 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ validatorCount │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _validators │ 171 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ RoninValidatorSet │ _validatorMap │ 172 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ RoninValidatorSet │ _maxPrioritizedValidatorNumber │ 173 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 174 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ RoninValidatorSet │ _miningReward │ 224 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _delegatingReward │ 225 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalBridgeReward │ 226 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _bridgeOperatingReward │ 227 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ RoninValidatorSet │ _totalDeprecatedReward │ 228 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExitLockedAmount │ 229 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _emergencyExpiryDuration │ 230 │ 0 │ t_uint256 │ │ │ 32 │ +│ RoninValidatorSet │ _lockedConsensusList │ 231 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ RoninValidatorSet │ _exitInfo │ 232 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ RoninValidatorSet │ _lockedFundReleased │ 233 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ RoninValidatorSet │ ______gap │ 234 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ SlashBridgeOperator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ SlashBridgeOperator │ _missingVotesRatioTier1 │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _missingVotesRatioTier2 │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _jailDurationForMissingVotesRatioTier2 │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _skipBridgeOperatorSlashingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ ______gap │ 5 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashBridgeOperator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashBridgeOperator │ _missingVotesRatioTier1 │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _missingVotesRatioTier2 │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _jailDurationForMissingVotesRatioTier2 │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ _skipBridgeOperatorSlashingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeOperator │ ______gap │ 5 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashBridgeVoting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninTrustedOrganizationContract │ 1 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninGovernanceAdminContract │ 2 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ SlashBridgeVoting │ _bridgeVotingSlashed │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingSlashAmount │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashBridgeVoting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninTrustedOrganizationContract │ 1 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashBridgeVoting │ _roninGovernanceAdminContract │ 2 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ SlashBridgeVoting │ _bridgeVotingSlashed │ 3 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingThreshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ _bridgeVotingSlashAmount │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashBridgeVoting │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashDoubleSign │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ SlashDoubleSign │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashDoubleSign │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashDoubleSign │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashDoubleSign │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashDoubleSign │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashDoubleSign │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashIndicator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ SlashIndicator │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashIndicator │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashIndicator │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ SlashIndicator │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ SlashIndicator │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashIndicator │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ SlashIndicator │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ SlashIndicator │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashIndicator │ _slashDoubleSignAmount │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningJailUntilBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _doubleSigningOffsetLimitBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _submittedEvidence │ 4 │ 0 │ t_mapping(t_bytes32,t_bool) │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 5 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashIndicator │ _roninTrustedOrganizationContract │ 53 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashIndicator │ _roninGovernanceAdminContract │ 54 │ 0 │ t_contract(IRoninGovernanceAdmin)10010 │ │ │ 20 │ +│ SlashIndicator │ _bridgeVotingSlashed │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingThreshold │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bridgeVotingSlashAmount │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 58 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _maintenanceContract │ 108 │ 0 │ t_contract(IMaintenance)9657 │ │ │ 20 │ +│ SlashIndicator │ _missingVotesRatioTier1 │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _missingVotesRatioTier2 │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForMissingVotesRatioTier2 │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _skipBridgeOperatorSlashingThreshold │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 113 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ lastUnavailabilitySlashedBlock │ 163 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityIndicator │ 164 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier1Threshold │ 165 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _unavailabilityTier2Threshold │ 166 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _slashAmountForUnavailabilityTier2Threshold │ 167 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _jailDurationForUnavailabilityTier2Threshold │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 169 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _checkBailedOutAtPeriod │ 219 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashIndicator │ _creditScore │ 220 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashIndicator │ _gainCreditScore │ 221 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _maxCreditScore │ 222 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _bailOutCostMultiplier │ 223 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ _cutOffPercentageAfterBailout │ 224 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashIndicator │ ______gap │ 225 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashIndicator │ _initialized │ 275 │ 0 │ t_uint8 │ │ │ 1 │ +│ SlashIndicator │ _initializing │ 275 │ 1 │ t_bool │ │ │ 1 │ +│ SlashingExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ SlashingExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashingExecution │ _slashIndicatorContract │ 108 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ SlashingExecution │ _stakingContract │ 109 │ 0 │ t_contract(IStaking)11496 │ │ │ 20 │ +│ SlashingExecution │ _roninTrustedOrganizationContract │ 110 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashingExecution │ _maxValidatorNumber │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ validatorCount │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _validators │ 113 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ SlashingExecution │ _validatorMap │ 114 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ SlashingExecution │ _maxPrioritizedValidatorNumber │ 115 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 116 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashingExecution │ _miningReward │ 166 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _delegatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalBridgeReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _bridgeOperatingReward │ 169 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalDeprecatedReward │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitLockedAmount │ 171 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExpiryDuration │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lockedConsensusList │ 173 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ SlashingExecution │ _exitInfo │ 174 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12046_storage) │ │ │ 32 │ +│ SlashingExecution │ _lockedFundReleased │ 175 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 176 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ SlashingExecution │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ SlashingExecution │ _miningRewardDeprecatedAtPeriod │ 54 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _miningRewardBailoutCutOffAtPeriod │ 55 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _bridgeRewardDeprecatedAtPeriod │ 56 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_bool)) │ │ │ 32 │ +│ SlashingExecution │ _blockProducerJailedBlock │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitJailedTimestamp │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _cannotBailoutUntilBlock │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ SlashingExecution │ _slashIndicatorContract │ 108 │ 0 │ t_contract(ISlashIndicator)10856 │ │ │ 20 │ +│ SlashingExecution │ _stakingContract │ 109 │ 0 │ t_contract(IStaking)11505 │ │ │ 20 │ +│ SlashingExecution │ _roninTrustedOrganizationContract │ 110 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ SlashingExecution │ _maxValidatorNumber │ 111 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ validatorCount │ 112 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _validators │ 113 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ SlashingExecution │ _validatorMap │ 114 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ SlashingExecution │ _maxPrioritizedValidatorNumber │ 115 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 116 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashingExecution │ _miningReward │ 166 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _delegatingReward │ 167 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalBridgeReward │ 168 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _bridgeOperatingReward │ 169 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ SlashingExecution │ _totalDeprecatedReward │ 170 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExitLockedAmount │ 171 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _emergencyExpiryDuration │ 172 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashingExecution │ _lockedConsensusList │ 173 │ 0 │ t_array(t_address)dyn_storage │ │ │ 32 │ +│ SlashingExecution │ _exitInfo │ 174 │ 0 │ t_mapping(t_address,t_struct(EmergencyExitInfo)12055_storage) │ │ │ 32 │ +│ SlashingExecution │ _lockedFundReleased │ 175 │ 0 │ t_mapping(t_address,t_bool) │ │ │ 32 │ +│ SlashingExecution │ ______gap │ 176 │ 0 │ t_array(t_uint256)44_storage │ │ │ 1408 │ +│ SlashUnavailability │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ SlashUnavailability │ lastUnavailabilitySlashedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityIndicator │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier1Threshold │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier2Threshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _slashAmountForUnavailabilityTier2Threshold │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _jailDurationForUnavailabilityTier2Threshold │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ ______gap │ 7 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ SlashUnavailability │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ SlashUnavailability │ lastUnavailabilitySlashedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityIndicator │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_uint256)) │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier1Threshold │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _unavailabilityTier2Threshold │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _slashAmountForUnavailabilityTier2Threshold │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ _jailDurationForUnavailabilityTier2Threshold │ 6 │ 0 │ t_uint256 │ │ │ 32 │ +│ SlashUnavailability │ ______gap │ 7 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ Staking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11339_storage)) │ │ │ 32 │ +│ Staking │ _stakingPool │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11345_storage) │ │ │ 32 │ +│ Staking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ Staking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ Staking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ Staking │ ______gap │ 59 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ Staking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ Staking │ ______gap │ 159 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _initialized │ 209 │ 0 │ t_uint8 │ │ │ 1 │ +│ Staking │ _initializing │ 209 │ 1 │ t_bool │ │ │ 1 │ +│ Staking │ _status │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _accumulatedRps │ 1 │ 0 │ t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10559_storage)) │ │ │ 32 │ +│ Staking │ _userReward │ 2 │ 0 │ t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage)) │ │ │ 32 │ +│ Staking │ _stakingPoolField │ 3 │ 0 │ t_mapping(t_address,t_struct(PoolFields)11352_storage) │ │ │ 32 │ +│ Staking │ ______gap │ 4 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _validatorContract │ 54 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ Staking │ _stakingPool │ 55 │ 0 │ t_mapping(t_address,t_struct(PoolDetail)10946_storage) │ │ │ 32 │ +│ Staking │ _cooldownSecsToUndelegate │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _waitingSecsToRevoke │ 57 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _adminOfActivePoolMapping │ 58 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ Staking │ poolOfConsensusMapping │ 59 │ 0 │ t_mapping(t_address,t_address) │ │ │ 32 │ +│ Staking │ ______gap │ 60 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ Staking │ _minValidatorStakingAmount │ 108 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _maxCommissionRate │ 109 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ _minCommissionRate │ 110 │ 0 │ t_uint256 │ │ │ 32 │ +│ Staking │ ______gap │ 111 │ 0 │ t_array(t_uint256)48_storage │ │ │ 1536 │ +│ Staking │ ______gap │ 159 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ Staking │ _initialized │ 209 │ 0 │ t_uint8 │ │ │ 1 │ +│ Staking │ _initializing │ 209 │ 1 │ t_bool │ │ │ 1 │ +│ StakingVesting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11980 │ │ │ 20 │ +│ StakingVesting │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ StakingVesting │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ StakingVesting │ _blockProducerBonusPerBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ _bridgeOperatorBonusPerBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ lastBlockSendingBonus │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ _validatorContract │ 0 │ 0 │ t_contract(IRoninValidatorSet)11989 │ │ │ 20 │ +│ StakingVesting │ _initialized │ 0 │ 20 │ t_uint8 │ │ │ 1 │ +│ StakingVesting │ _initializing │ 0 │ 21 │ t_bool │ │ │ 1 │ +│ StakingVesting │ _blockProducerBonusPerBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ _bridgeOperatorBonusPerBlock │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ StakingVesting │ lastBlockSendingBonus │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ TimingStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ TimingStorage │ _numberOfBlocksInEpoch │ 0 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedBlock │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _lastUpdatedPeriod │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _currentPeriodStartAtBlock │ 3 │ 0 │ t_uint256 │ │ │ 32 │ +│ TimingStorage │ _periodOf │ 4 │ 0 │ t_mapping(t_uint256,t_uint256) │ │ │ 32 │ +│ TimingStorage │ ______gap │ 5 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ ValidatorInfoStorage │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ ValidatorInfoStorage │ _maxValidatorNumber │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ validatorCount │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ _validators │ 3 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ ValidatorInfoStorage │ _validatorMap │ 4 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12625) │ │ │ 32 │ +│ ValidatorInfoStorage │ _maxPrioritizedValidatorNumber │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ ValidatorInfoStorage │ _roninTrustedOrganizationContract │ 0 │ 0 │ t_contract(IRoninTrustedOrganization)10189 │ │ │ 20 │ +│ ValidatorInfoStorage │ _maxValidatorNumber │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ validatorCount │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ _validators │ 3 │ 0 │ t_mapping(t_uint256,t_address) │ │ │ 32 │ +│ ValidatorInfoStorage │ _validatorMap │ 4 │ 0 │ t_mapping(t_address,t_enum(ValidatorFlag)12634) │ │ │ 32 │ +│ ValidatorInfoStorage │ _maxPrioritizedValidatorNumber │ 5 │ 0 │ t_uint256 │ │ │ 32 │ +│ ValidatorInfoStorage │ ______gap │ 6 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ VaultForwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ VaultForwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ VaultForwarder │ _roles │ 0 │ 0 │ t_mapping(t_bytes32,t_struct(RoleData)19_storage) │ │ │ 32 │ +│ VaultForwarder │ _roleMembers │ 1 │ 0 │ t_mapping(t_bytes32,t_struct(AddressSet)4026_storage) │ │ │ 32 │ +│ WithdrawalLimitation │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ WithdrawalLimitation │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ WithdrawalLimitation │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +│ WithdrawalLimitation │ _paused │ 0 │ 0 │ t_bool │ │ │ 1 │ +│ WithdrawalLimitation │ _num │ 1 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _denom │ 2 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ ______deprecated │ 3 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ nonce │ 4 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ emergencyPauser │ 5 │ 0 │ t_address │ │ │ 20 │ +│ WithdrawalLimitation │ ______gap │ 6 │ 0 │ t_array(t_uint256)49_storage │ │ │ 1568 │ +│ WithdrawalLimitation │ _highTierVWNum │ 55 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ _highTierVWDenom │ 56 │ 0 │ t_uint256 │ │ │ 32 │ +│ WithdrawalLimitation │ highTierThreshold │ 57 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lockedThreshold │ 58 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ unlockFeePercentages │ 59 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ dailyWithdrawalLimit │ 60 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastSyncedWithdrawal │ 61 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ lastDateSynced │ 62 │ 0 │ t_mapping(t_address,t_uint256) │ │ │ 32 │ +│ WithdrawalLimitation │ ______gap │ 63 │ 0 │ t_array(t_uint256)50_storage │ │ │ 1600 │ +└─────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────────┴───────────────┘ \ No newline at end of file diff --git a/test/foundry/forking/REP-002/UnattachBridgeForkTest.t.sol b/test/foundry/forking/REP-002/UnattachBridgeForkTest.t.sol index 6c878be20..16f68b79c 100644 --- a/test/foundry/forking/REP-002/UnattachBridgeForkTest.t.sol +++ b/test/foundry/forking/REP-002/UnattachBridgeForkTest.t.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.0; import "../RoninTest.t.sol"; +import { TConsensus } from "@ronin/contracts/udvts/Types.sol"; import { RoninValidatorSetTimedMigrator } from "@ronin/contracts/ronin/validator/migrations/RoninValidatorSetTimedMigrator.sol"; import { ContractType } from "@ronin/contracts/utils/ContractType.sol"; import { Staking } from "@ronin/contracts/ronin/staking/Staking.sol"; @@ -177,7 +178,7 @@ contract UnattachBridgeForkTest is RoninTest { function _applyValidatorCandidate(uint256 seed) internal onWhichFork(_roninFork) { address candidateAdmin = vm.addr(seed + 1); - address consensusAddr = vm.addr(seed + 2); + TConsensus consensusAddr = TConsensus.wrap(vm.addr(seed + 2)); (uint256 min, uint256 max) = Staking(payable(_stakingProxy)).getCommissionRateRange(); uint256 commissionRate = (min + max) / 2; @@ -189,7 +190,8 @@ contract UnattachBridgeForkTest is RoninTest { candidateAdmin, consensusAddr, payable(candidateAdmin), - commissionRate + commissionRate, + abi.encodePacked(candidateAdmin, consensusAddr) ); } diff --git a/test/foundry/forking/REP-004/ChangeConsensusAddress.t.sol b/test/foundry/forking/REP-004/ChangeConsensusAddress.t.sol new file mode 100644 index 000000000..3e821deda --- /dev/null +++ b/test/foundry/forking/REP-004/ChangeConsensusAddress.t.sol @@ -0,0 +1,1005 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.22; + +import { Test } from "forge-std/Test.sol"; +import { console2 } from "forge-std/console2.sol"; +import { StdStyle } from "forge-std/StdStyle.sol"; +import { TConsensus } from "@ronin/contracts/udvts/Types.sol"; +import { Maintenance } from "@ronin/contracts/ronin/Maintenance.sol"; +import { ContractType } from "@ronin/contracts/utils/ContractType.sol"; +import { MockPrecompile } from "@ronin/contracts/mocks/MockPrecompile.sol"; +import { IProfile, Profile } from "@ronin/contracts/ronin/profile/Profile.sol"; +import { Profile_Testnet } from "@ronin/contracts/ronin/profile/Profile_Testnet.sol"; +import { Profile_Mainnet } from "@ronin/contracts/ronin/profile/Profile_Mainnet.sol"; +import { IBaseStaking, Staking } from "@ronin/contracts/ronin/staking/Staking.sol"; +import { HasContracts } from "@ronin/contracts/extensions/collections/HasContracts.sol"; +import { CandidateManager } from "@ronin/contracts/ronin/validator/CandidateManager.sol"; +import { EmergencyExitBallot } from "@ronin/contracts/libraries/EmergencyExitBallot.sol"; +import { SlashIndicator } from "@ronin/contracts/ronin/slash-indicator/SlashIndicator.sol"; +import { ICandidateManagerCallback, ICandidateManager, RoninValidatorSet } from "@ronin/contracts/ronin/validator/RoninValidatorSet.sol"; +import { TransparentUpgradeableProxy, TransparentUpgradeableProxyV2 } from "@ronin/contracts/extensions/TransparentUpgradeableProxyV2.sol"; +import { IRoninGovernanceAdmin, RoninGovernanceAdmin } from "@ronin/contracts/ronin/RoninGovernanceAdmin.sol"; +import { IRoninTrustedOrganization, RoninTrustedOrganization } from "@ronin/contracts/multi-chains/RoninTrustedOrganization.sol"; +import { Proposal } from "@ronin/contracts/libraries/Proposal.sol"; +import { Ballot } from "@ronin/contracts/libraries/Ballot.sol"; + +contract ChangeConsensusAddressForkTest is Test { + string constant RONIN_TEST_RPC = "https://saigon-archive.roninchain.com/rpc"; + string constant RONIN_MAIN_RPC = "https://api-archived.roninchain.com/rpc"; + bytes32 constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + Profile internal _profile; + Staking internal _staking; + Maintenance internal _maintenance; + RoninValidatorSet internal _validator; + RoninGovernanceAdmin internal _roninGA; + SlashIndicator internal _slashIndicator; + RoninTrustedOrganization internal _roninTO; + + modifier upgrade() { + _upgradeContracts(); + _; + } + + function _upgradeContracts() internal { + _upgradeProfile(); + _upgradeStaking(); + _upgradeValidator(); + _upgradeMaintenance(); + _upgradeSlashIndicator(); + _upgradeRoninTO(); + } + + function setUp() external { + MockPrecompile mockPrecompile = new MockPrecompile(); + vm.etch(address(0x68), address(mockPrecompile).code); + vm.makePersistent(address(0x68)); + + vm.createSelectFork(RONIN_TEST_RPC, 21901973); + // vm.createSelectFork(RONIN_MAIN_RPC, 29225255); + + if (block.chainid == 2021) { + _profile = Profile(0x3b67c8D22a91572a6AB18acC9F70787Af04A4043); + _maintenance = Maintenance(0x4016C80D97DDCbe4286140446759a3f0c1d20584); + _staking = Staking(payable(0x9C245671791834daf3885533D24dce516B763B28)); + _roninGA = RoninGovernanceAdmin(0x53Ea388CB72081A3a397114a43741e7987815896); + _slashIndicator = SlashIndicator(0xF7837778b6E180Df6696C8Fa986d62f8b6186752); + _roninTO = RoninTrustedOrganization(0x7507dc433a98E1fE105d69f19f3B40E4315A4F32); + _validator = RoninValidatorSet(payable(0x54B3AC74a90E64E8dDE60671b6fE8F8DDf18eC9d)); + } + if (block.chainid == 2020) { + // Mainnet + _profile = Profile(0x840EBf1CA767CB690029E91856A357a43B85d035); + _maintenance = Maintenance(0x6F45C1f8d84849D497C6C0Ac4c3842DC82f49894); + _staking = Staking(payable(0x545edb750eB8769C868429BE9586F5857A768758)); + _roninGA = RoninGovernanceAdmin(0x946397deDFd2f79b75a72B322944a21C3240c9c3); + _slashIndicator = SlashIndicator(0xEBFFF2b32fA0dF9C5C8C5d5AAa7e8b51d5207bA3); + _roninTO = RoninTrustedOrganization(0x98D0230884448B3E2f09a177433D60fb1E19C090); + _validator = RoninValidatorSet(payable(0x617c5d73662282EA7FfD231E020eCa6D2B0D552f)); + } + + vm.label(address(_profile), "Profile"); + vm.label(address(_staking), "Staking"); + vm.label(address(_validator), "Validator"); + vm.label(address(_maintenance), "Maintenance"); + vm.label(address(_roninGA), "GovernanceAdmin"); + vm.label(address(_roninTO), "TrustedOrganizations"); + vm.label(address(_slashIndicator), "SlashIndicator"); + } + + function testFork_AfterUpgraded_AddNewTrustedOrg_CanVoteProposal() external upgrade { + _cheatSetRoninGACode(); + // add trusted org + address consensus = makeAddr("consensus"); + address governor = makeAddr("governor"); + IRoninTrustedOrganization.TrustedOrganization memory newTrustedOrg = IRoninTrustedOrganization.TrustedOrganization( + TConsensus.wrap(consensus), + governor, + address(0x0), + 1000, + 0 + ); + _addTrustedOrg(newTrustedOrg); + + address newLogic = address(new RoninValidatorSet()); + address[] memory targets = new address[](1); + targets[0] = address(_validator); + uint256[] memory values = new uint256[](1); + bytes[] memory calldatas = new bytes[](1); + calldatas[0] = abi.encodeCall(TransparentUpgradeableProxy.upgradeTo, newLogic); + uint256[] memory gasAmounts = new uint256[](1); + gasAmounts[0] = 1_000_000; + Ballot.VoteType support = Ballot.VoteType.For; + + vm.startPrank(governor); + _roninGA.proposeProposalForCurrentNetwork( + block.timestamp + 5 minutes, + targets, + values, + calldatas, + gasAmounts, + support + ); + vm.stopPrank(); + } + + function testFork_RevertWhen_AfterUpgraded_ApplyValidatorCandidateC1_AddNewTrustedOrgC1_ChangeC1ToC2_RenounceC2() + external + upgrade + { + // apply validator candidate + _applyValidatorCandidate("candidate-admin", "c1"); + + // add trusted org + address consensus = makeAddr("c1"); + address governor = makeAddr("governor"); + IRoninTrustedOrganization.TrustedOrganization memory newTrustedOrg = IRoninTrustedOrganization.TrustedOrganization( + TConsensus.wrap(consensus), + governor, + address(0x0), + 1000, + 0 + ); + _addTrustedOrg(newTrustedOrg); + + address newConsensus = makeAddr("c2"); + address admin = makeAddr("candidate-admin"); + vm.startPrank(admin); + _profile.requestChangeConsensusAddr(consensus, TConsensus.wrap(newConsensus)); + vm.expectRevert(ICandidateManagerCallback.ErrTrustedOrgCannotRenounce.selector); + _staking.requestRenounce(TConsensus.wrap(newConsensus)); + vm.stopPrank(); + } + + /** + * R4-P-09 + */ + function testFork_AfterUpgraded_AsTrustedOrg_AfterRenouncedAndRemovedFromTO_ReAddAsTrustedOrg() external upgrade { + // address[] memory validatorCids = _validator.getValidatorCandidates(); + // TConsensus standardConsensus; + // address standardId; + // for (uint i; i < validatorCids.length; i++) { + // if (_roninTO.getConsensusWeightById(validatorCids[i]) == 0) { + // standardId = validatorCids[i]; + // standardConsensus = _profile.getId2Profile(standardId).consensus; + // break; + // } + // } + + (, TConsensus standardConsensus) = _pickOneStandardCandidate(); + + (address admin, , ) = _staking.getPoolDetail(standardConsensus); + vm.prank(admin); + _staking.requestRenounce(standardConsensus); + + vm.warp(block.timestamp + 7 days); + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + assertFalse(_validator.isValidatorCandidate(standardConsensus)); + + IRoninTrustedOrganization.TrustedOrganization memory newTrustedOrg = IRoninTrustedOrganization.TrustedOrganization( + standardConsensus, + makeAddr("governor"), + address(0x0), + 1000, + 0 + ); + _addTrustedOrg(newTrustedOrg); + } + + function testFork_AfterUpgraded_AddNewTrustedOrgBefore_ApplyValidatorCandidateAfter() external upgrade { + uint256 newWeight = 1000; + + // add trusted org + address consensus = makeAddr("consensus"); + address governor = makeAddr("governor"); + IRoninTrustedOrganization.TrustedOrganization memory newTrustedOrg = IRoninTrustedOrganization.TrustedOrganization( + TConsensus.wrap(consensus), + governor, + address(0x0), + newWeight, + 0 + ); + IRoninTrustedOrganization.TrustedOrganization[] memory trustedOrgs = _addTrustedOrg(newTrustedOrg); + + // apply validator candidate + _applyValidatorCandidate("candidate-admin", "consensus"); + + address newAdmin = makeAddr("new-admin"); + address admin = makeAddr("candidate-admin"); + address newTreasury = makeAddr("new-treasury"); + address newConsensus = makeAddr("new-consensus"); + vm.startPrank(admin); + _profile.requestChangeConsensusAddr(consensus, TConsensus.wrap(newConsensus)); + _profile.requestChangeTreasuryAddr(consensus, payable(newTreasury)); + _profile.requestChangeAdminAddress(consensus, newAdmin); + vm.stopPrank(); + + // change new governor + address newGovernor = makeAddr("new-governor"); + trustedOrgs[0].governor = newGovernor; + trustedOrgs[0].consensusAddr = TConsensus.wrap(newConsensus); + vm.prank(_getProxyAdmin(address(_roninTO))); + TransparentUpgradeableProxyV2(payable(address(_roninTO))).functionDelegateCall( + abi.encodeCall(RoninTrustedOrganization.updateTrustedOrganizations, trustedOrgs) + ); + + IProfile.CandidateProfile memory profile = _profile.getId2Profile(consensus); + IRoninTrustedOrganization.TrustedOrganization memory trustedOrg = _roninTO.getTrustedOrganization( + TConsensus.wrap(newConsensus) + ); + + // assert eq to updated address + // 1. + assertEq(trustedOrg.governor, newGovernor); + assertEq(TConsensus.unwrap(trustedOrg.consensusAddr), newConsensus); + assertEq(profile.id, consensus); + assertEq(profile.treasury, payable(newTreasury)); + assertEq(profile.__reservedGovernor, address(0x0)); + assertEq(TConsensus.unwrap(profile.consensus), newConsensus); + + // 2. + __assertWeight(TConsensus.wrap(newConsensus), consensus, newWeight); + __assertWeight(TConsensus.wrap(consensus), consensus, 0); + } + + function testFork_AfterUpgraded_ApplyValidatorCandidateBefore_AddNewTrustedOrgAfter() external upgrade { + uint256 newWeight = 1000; + + // apply validator candidate + _applyValidatorCandidate("candidate-admin", "consensus"); + + // add trusted org + address consensus = makeAddr("consensus"); + address governor = makeAddr("governor"); + IRoninTrustedOrganization.TrustedOrganization memory newTrustedOrg = IRoninTrustedOrganization.TrustedOrganization( + TConsensus.wrap(consensus), + governor, + address(0x0), + newWeight, + 0 + ); + IRoninTrustedOrganization.TrustedOrganization[] memory trustedOrgs = _addTrustedOrg(newTrustedOrg); + + address newAdmin = makeAddr("new-admin"); + address admin = makeAddr("candidate-admin"); + address newTreasury = makeAddr("new-treasury"); + address newConsensus = makeAddr("new-consensus"); + vm.startPrank(admin); + _profile.requestChangeConsensusAddr(consensus, TConsensus.wrap(newConsensus)); + _profile.requestChangeTreasuryAddr(consensus, payable(newTreasury)); + _profile.requestChangeAdminAddress(consensus, newAdmin); + vm.stopPrank(); + + // change new governor + address newGovernor = makeAddr("new-governor"); + trustedOrgs[0].governor = newGovernor; + trustedOrgs[0].consensusAddr = TConsensus.wrap(newConsensus); + vm.prank(_getProxyAdmin(address(_roninTO))); + TransparentUpgradeableProxyV2(payable(address(_roninTO))).functionDelegateCall( + abi.encodeCall(RoninTrustedOrganization.updateTrustedOrganizations, trustedOrgs) + ); + + IProfile.CandidateProfile memory profile = _profile.getId2Profile(consensus); + IRoninTrustedOrganization.TrustedOrganization memory trustedOrg = _roninTO.getTrustedOrganization( + TConsensus.wrap(newConsensus) + ); + + // assert eq to updated address + assertEq(trustedOrg.governor, newGovernor); + assertEq(TConsensus.unwrap(trustedOrg.consensusAddr), newConsensus); + assertEq(profile.id, consensus); + assertEq(profile.treasury, payable(newTreasury)); + assertEq(profile.__reservedGovernor, address(0x0)); + assertEq(TConsensus.unwrap(profile.consensus), newConsensus); + + // 2. + __assertWeight(TConsensus.wrap(newConsensus), consensus, newWeight); + __assertWeight(TConsensus.wrap(consensus), consensus, 0); + } + + function __assertWeight(TConsensus consensus, address id, uint256 weight) private { + TConsensus[] memory consensuses = new TConsensus[](1); + address[] memory ids = new address[](1); + + consensuses[0] = consensus; + ids[0] = id; + + if (weight == 0) { + assertEq(_roninTO.getConsensusWeight(consensuses[0]), weight); + assertEq(_roninTO.getConsensusWeight(consensuses[0]), _roninTO.getConsensusWeight(consensuses[0])); + } else { + assertEq(_roninTO.getConsensusWeight(consensuses[0]), weight); + assertEq(_roninTO.getConsensusWeight(consensuses[0]), _roninTO.getConsensusWeights(consensuses)[0]); + assertEq(_roninTO.getConsensusWeights(consensuses)[0], _roninTO.getConsensusWeightById(ids[0])); + assertEq(_roninTO.getConsensusWeightById(ids[0]), _roninTO.getConsensusWeightsById(ids)[0]); + assertEq(_roninTO.getConsensusWeightsById(ids)[0], _roninTO.getConsensusWeight(consensuses[0])); + } + } + + function testFork_AfterUpgraded_WithdrawableFund_execEmergencyExit() external upgrade { + // TODO(bao): @TuDo1403 please enhance this test + _cheatSetRoninGACode(); + IRoninTrustedOrganization.TrustedOrganization[] memory trustedOrgs = _roninTO.getAllTrustedOrganizations(); + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address validatorCandidate = validatorCandidates[2]; + ICandidateManager.ValidatorCandidate memory oldCandidate = _validator.getCandidateInfo( + TConsensus.wrap(validatorCandidate) + ); + + (address admin, , ) = _staking.getPoolDetail(TConsensus.wrap(validatorCandidate)); + console2.log("admin", admin); + + address newAdmin = makeAddr("new-admin"); + address payable newTreasury = payable(makeAddr("new-treasury")); + TConsensus newConsensusAddr = TConsensus.wrap(makeAddr("new-consensus")); + + uint256 proposalRequestAt = block.timestamp; + uint256 proposalExpiredAt = proposalRequestAt + _validator.emergencyExpiryDuration(); + bytes32 voteHash = EmergencyExitBallot.hash( + TConsensus.unwrap(oldCandidate.__shadowedConsensus), + oldCandidate.__shadowedTreasury, + proposalRequestAt, + proposalExpiredAt + ); + + vm.startPrank(admin); + vm.expectEmit(address(_roninGA)); + emit IRoninGovernanceAdmin.EmergencyExitPollCreated( + voteHash, + TConsensus.unwrap(oldCandidate.__shadowedConsensus), + oldCandidate.__shadowedTreasury, + proposalRequestAt, + proposalExpiredAt + ); + _staking.requestEmergencyExit(TConsensus.wrap(validatorCandidate)); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensusAddr); + _profile.requestChangeTreasuryAddr(validatorCandidate, newTreasury); + _profile.requestChangeAdminAddress(validatorCandidate, newAdmin); + vm.stopPrank(); + + // NOTE: locked fund refunded to the old treasury + console2.log("recipient", oldCandidate.__shadowedTreasury); + uint256 balanceBefore = oldCandidate.__shadowedTreasury.balance; + console2.log("balanceBefore", balanceBefore); + + for (uint256 i; i < trustedOrgs.length; ++i) { + if (trustedOrgs[i].governor != validatorCandidate) { + vm.prank(trustedOrgs[i].governor); + _roninGA.voteEmergencyExit( + voteHash, + TConsensus.unwrap(oldCandidate.__shadowedConsensus), + oldCandidate.__shadowedTreasury, + proposalRequestAt, + proposalExpiredAt + ); + } + } + + uint256 balanceAfter = oldCandidate.__shadowedTreasury.balance; + console2.log("balanceAfter", balanceAfter); + uint256 fundReceived = balanceAfter - balanceBefore; + console2.log("fundReceived", fundReceived); + + assertTrue(fundReceived != 0); + } + + function testFork_AsTrustedOrg_AfterUpgraded_AfterChangeConsensus_requestRenounce() external upgrade { + TConsensus trustedOrg = _roninTO.getAllTrustedOrganizations()[0].consensusAddr; + console2.log("trustedOrgConsensus", TConsensus.unwrap(trustedOrg)); + address admin = _validator.getCandidateInfo(trustedOrg).__shadowedAdmin; + + TConsensus newConsensus = TConsensus.wrap(makeAddr("new-consensus")); + vm.prank(admin); + _profile.requestChangeConsensusAddr(TConsensus.unwrap(trustedOrg), newConsensus); + + (address poolAdmin, , ) = _staking.getPoolDetail(newConsensus); + console2.log("poolAdmin", poolAdmin); + + vm.expectRevert(); + vm.prank(poolAdmin); + _staking.requestRenounce(newConsensus); + } + + function testFork_AsTrustedOrg_AfterUpgraded_AfterChangeConsensus_execEmergencyExit() external upgrade { + TConsensus trustedOrg = _roninTO.getAllTrustedOrganizations()[0].consensusAddr; + console2.log("trustedOrgConsensus", TConsensus.unwrap(trustedOrg)); + address admin = _validator.getCandidateInfo(trustedOrg).__shadowedAdmin; + + TConsensus newConsensus = TConsensus.wrap(makeAddr("new-consensus")); + vm.prank(admin); + _profile.requestChangeConsensusAddr(TConsensus.unwrap(trustedOrg), newConsensus); + + (address poolAdmin, , ) = _staking.getPoolDetail(newConsensus); + console2.log("poolAdmin", poolAdmin); + + vm.prank(poolAdmin); + _staking.requestEmergencyExit(newConsensus); + } + + function testFork_NotReceiveReward_BeforeAndAfterUpgraded_execEmergencyExit() external { + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address validatorCandidate = validatorCandidates[2]; + address recipient = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedTreasury; + + uint256 snapshotId = vm.snapshot(); + + (address admin, , ) = _staking.getPoolDetail(TConsensus.wrap(validatorCandidate)); + console2.log("before-upgrade-admin", admin); + vm.prank(admin); + _staking.requestEmergencyExit(TConsensus.wrap(validatorCandidate)); + + uint256 adminBalanceBefore = admin.balance; + console2.log("before-upgrade:adminBalanceBefore", adminBalanceBefore); + + vm.warp(block.timestamp + 7 days); + _bulkWrapUpEpoch(1); + + uint256 adminBalanceAfter = admin.balance; + console2.log("before-upgrade:adminBalanceAfter", adminBalanceAfter); + + assertFalse(_validator.isValidatorCandidate(TConsensus.wrap(validatorCandidate))); + console2.log("before-upgrade:recipient", recipient); + uint256 balanceBefore = recipient.balance; + console2.log("before-upgrade:balanceBefore", balanceBefore); + + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + uint256 balanceAfter = recipient.balance; + console2.log("before-upgrade:balanceAfter", balanceAfter); + uint256 rewardBeforeUpgrade = balanceAfter - balanceBefore; + uint256 beforeUpgradeAdminStakingAmount = adminBalanceAfter - adminBalanceBefore; + console2.log("before-upgrade:adminStakingAmount", beforeUpgradeAdminStakingAmount); + console2.log("before-upgrade:reward", rewardBeforeUpgrade); + + assertEq(rewardBeforeUpgrade, 0); + + vm.revertTo(snapshotId); + _upgradeContracts(); + + (admin, , ) = _staking.getPoolDetail(TConsensus.wrap(validatorCandidate)); + console2.log("after-upgrade-admin", admin); + vm.prank(admin); + _staking.requestEmergencyExit(TConsensus.wrap(validatorCandidate)); + + adminBalanceBefore = admin.balance; + console2.log("after-upgrade:adminBalanceBefore", adminBalanceBefore); + + vm.warp(block.timestamp + 7 days); + _bulkWrapUpEpoch(1); + + adminBalanceAfter = admin.balance; + console2.log("after-upgrade:adminBalanceAfter", adminBalanceAfter); + + uint256 afterUpgradeAdminStakingAmount = adminBalanceAfter - adminBalanceBefore; + console2.log("after-upgrade:adminStakingAmount", afterUpgradeAdminStakingAmount); + assertFalse(_validator.isValidatorCandidate(TConsensus.wrap(validatorCandidate))); + console2.log("after-upgrade:recipient", recipient); + balanceBefore = recipient.balance; + console2.log("after-upgrade:balanceBefore", balanceBefore); + + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + balanceAfter = recipient.balance; + console2.log("after-upgrade:balanceAfter", balanceAfter); + uint256 rewardAfterUpgrade = balanceAfter - balanceBefore; + console2.log("after-upgrade:reward", rewardAfterUpgrade); + + assertEq(rewardAfterUpgrade, 0); + assertEq(beforeUpgradeAdminStakingAmount, afterUpgradeAdminStakingAmount); + } + + function testFork_AfterUpgraded_RevertWhen_ReapplySameAddress_Renounce() external upgrade { + (, TConsensus standardConsensus) = _pickOneStandardCandidate(); + address recipient = _validator.getCandidateInfo(standardConsensus).__shadowedTreasury; + + (address admin, , ) = _staking.getPoolDetail(standardConsensus); + vm.prank(admin); + _staking.requestRenounce(standardConsensus); + + vm.warp(block.timestamp + 7 days); + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + assertFalse(_validator.isValidatorCandidate(standardConsensus)); + + // re-apply same admin + uint256 amount = _staking.minValidatorStakingAmount(); + vm.deal(admin, amount); + vm.expectRevert(); + vm.prank(admin); + _staking.applyValidatorCandidate{ value: amount }( + admin, + TConsensus.wrap(makeAddr("new-consensus")), + payable(admin), + 2500, + "new-consensus" + ); + // re-apply same consensus + address newAdmin = makeAddr("new-admin"); + vm.deal(newAdmin, amount); + vm.expectRevert(); + vm.prank(newAdmin); + _staking.applyValidatorCandidate{ value: amount }( + newAdmin, + standardConsensus, + payable(newAdmin), + 2500, + "new-admin" + ); + + console2.log("recipient", recipient); + uint256 balanceBefore = recipient.balance; + console2.log("balanceBefore", balanceBefore); + + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + uint256 balanceAfter = recipient.balance; + console2.log("balanceAfter", balanceAfter); + uint256 reward = balanceAfter - balanceBefore; + console2.log("reward", reward); + + assertEq(reward, 0); + } + + function testFork_AfterUpgraded_ChangeConsensusAddress() external upgrade { + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address validatorCandidate = validatorCandidates[0]; + address candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + TConsensus newConsensus = TConsensus.wrap(makeAddr("new-consensus-0")); + + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + _bulkWrapUpEpoch(1); + + validatorCandidate = validatorCandidates[1]; + candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + newConsensus = TConsensus.wrap(makeAddr("new-consensus-1")); + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + _bulkWrapUpEpoch(1); + } + + function testFork_AfterUpgraded_WrapUpEpochAndNonWrapUpEpoch_ChangeAdmin_ChangeConsensus_ChangeTreasury() + external + upgrade + { + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address cid = validatorCandidates[0]; + address candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(cid)).__shadowedAdmin; + + // change validator admin + address newAdmin = makeAddr("new-admin"); + address newConsensus = makeAddr("new-consensus"); + address payable newTreasury = payable(makeAddr("new-treasury")); + + vm.startPrank(candidateAdmin); + _profile.requestChangeConsensusAddr(cid, TConsensus.wrap(newConsensus)); + _profile.requestChangeTreasuryAddr(cid, newTreasury); + _profile.requestChangeAdminAddress(cid, newAdmin); + vm.stopPrank(); + + // store snapshot state + uint256 snapshotId = vm.snapshot(); + + // wrap up epoch + _bulkWrapUpEpoch(1); + + ICandidateManager.ValidatorCandidate memory wrapUpInfo = _validator.getCandidateInfo(TConsensus.wrap(newConsensus)); + ICandidateManager.ValidatorCandidate[] memory wrapUpInfos = _validator.getCandidateInfos(); + + // revert to state before wrap up + vm.revertTo(snapshotId); + ICandidateManager.ValidatorCandidate memory nonWrapUpInfo = _validator.getCandidateInfo( + TConsensus.wrap(newConsensus) + ); + ICandidateManager.ValidatorCandidate[] memory nonWrapUpInfos = _validator.getCandidateInfos(); + + assertEq(wrapUpInfo.__shadowedAdmin, nonWrapUpInfo.__shadowedAdmin); + assertEq(wrapUpInfo.__shadowedAdmin, newAdmin); + assertEq(TConsensus.unwrap(wrapUpInfo.__shadowedConsensus), TConsensus.unwrap(nonWrapUpInfo.__shadowedConsensus)); + assertEq(TConsensus.unwrap(wrapUpInfo.__shadowedConsensus), newConsensus); + assertEq(wrapUpInfo.__shadowedTreasury, nonWrapUpInfo.__shadowedTreasury); + assertEq(wrapUpInfo.__shadowedTreasury, newTreasury); + assertEq(wrapUpInfo.commissionRate, nonWrapUpInfo.commissionRate); + assertEq(wrapUpInfo.revokingTimestamp, nonWrapUpInfo.revokingTimestamp); + assertEq(wrapUpInfo.topupDeadline, nonWrapUpInfo.topupDeadline); + + IProfile.CandidateProfile memory mProfile = _profile.getId2Profile(cid); + assertEq(mProfile.id, cid); + assertEq(TConsensus.unwrap(mProfile.consensus), newConsensus); + assertEq(mProfile.admin, newAdmin); + assertEq(mProfile.treasury, newTreasury); + + assertEq(wrapUpInfos.length, nonWrapUpInfos.length); + for (uint256 i; i < wrapUpInfos.length; ++i) { + assertEq(keccak256(abi.encode(wrapUpInfos[i])), keccak256(abi.encode(nonWrapUpInfos[i]))); + } + } + + function testFork_SlashIndicator_BeforeAndAfterUpgrade() external { + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address validatorCandidate = validatorCandidates[0]; + address candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + + uint256 snapshotId = vm.snapshot(); + + address recipient = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedTreasury; + console2.log("before-upgrade:recipient", recipient); + uint256 balanceBefore = recipient.balance; + console2.log("before-upgrade:balanceBefore", balanceBefore); + + _bulkSubmitBlockReward(1); + _bulkSlashIndicator(validatorCandidate, 150); + + _bulkWrapUpEpoch(1); + + uint256 balanceAfter = recipient.balance; + console2.log("before-upgrade:balanceAfter", balanceAfter); + uint256 beforeUpgradeReward = balanceAfter - balanceBefore; + console2.log("before-upgrade:reward", beforeUpgradeReward); + assertFalse(_validator.isBlockProducer(TConsensus.wrap(validatorCandidate))); + + vm.revertTo(snapshotId); + _upgradeContracts(); + TConsensus newConsensus = TConsensus.wrap(makeAddr("consensus")); + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + _bulkSubmitBlockReward(1); + _bulkSlashIndicator(TConsensus.unwrap(newConsensus), 150); + + console2.log("new-consensus", TConsensus.unwrap(newConsensus)); + + recipient = _validator.getCandidateInfo(newConsensus).__shadowedTreasury; + console2.log("after-upgrade:recipient", recipient); + + balanceBefore = recipient.balance; + console2.log("after-upgrade:balanceBefore", balanceBefore); + + _bulkWrapUpEpoch(1); + + balanceAfter = recipient.balance; + console2.log("after-upgrade:balanceAfter", balanceBefore); + uint256 afterUpgradedReward = balanceAfter - balanceBefore; + console2.log("after-upgrade:reward", afterUpgradedReward); + + assertFalse(_validator.isBlockProducer(newConsensus)); + assertEq(afterUpgradedReward, beforeUpgradeReward, "afterUpgradedReward != beforeUpgradeReward"); + } + + function testFork_Maintenance_BeforeAndAfterUpgrade() external { + IRoninTrustedOrganization.TrustedOrganization memory trustedOrg = _roninTO.getTrustedOrganizationAt(0); + address validatorCandidate = TConsensus.unwrap(trustedOrg.consensusAddr); + address candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + + // check balance before wrapup epoch + address recipient = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedTreasury; + console2.log("before-upgrade:recipient", recipient); + uint256 balanceBefore = recipient.balance; + console2.log("before-upgrade:balanceBefore", balanceBefore); + uint256 minOffsetToStartSchedule = _maintenance.minOffsetToStartSchedule(); + + // save snapshot state before wrapup + uint256 snapshotId = vm.snapshot(); + + _bulkSubmitBlockReward(1); + uint256 latestEpoch = _validator.getLastUpdatedBlock() + 200; + uint256 startMaintenanceBlock = latestEpoch + 1 + minOffsetToStartSchedule; + uint256 endMaintenanceBlock = latestEpoch + minOffsetToStartSchedule + _maintenance.minMaintenanceDurationInBlock(); + this.schedule(candidateAdmin, validatorCandidate, startMaintenanceBlock, endMaintenanceBlock); + vm.roll(latestEpoch + minOffsetToStartSchedule + 200); + + _bulkSlashIndicator(validatorCandidate, 150); + _bulkWrapUpEpoch(1); + + // assertFalse(_maintenance.checkMaintained(TConsensus.wrap(validatorCandidate), block.number + 1)); + assertFalse(_validator.isBlockProducer(TConsensus.wrap(validatorCandidate))); + uint256 balanceAfter = recipient.balance; + console2.log("before-upgrade:balanceAfter", balanceAfter); + uint256 beforeUpgradeReward = balanceAfter - balanceBefore; + console2.log("before-upgrade:reward", beforeUpgradeReward); + + // revert to previous state + console2.log( + StdStyle.blue("==============================================================================================") + ); + vm.revertTo(snapshotId); + _upgradeContracts(); + // change consensus address + TConsensus newConsensus = TConsensus.wrap(makeAddr("consensus")); + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + recipient = _validator.getCandidateInfo(newConsensus).__shadowedTreasury; + console2.log("after-upgrade:recipient", recipient); + balanceBefore = recipient.balance; + console2.log("after-upgrade:balanceBefore", balanceBefore); + + _bulkSubmitBlockReward(1); + latestEpoch = _validator.getLastUpdatedBlock() + 200; + startMaintenanceBlock = latestEpoch + 1 + minOffsetToStartSchedule; + endMaintenanceBlock = latestEpoch + minOffsetToStartSchedule + _maintenance.minMaintenanceDurationInBlock(); + + this.schedule(candidateAdmin, TConsensus.unwrap(newConsensus), startMaintenanceBlock, endMaintenanceBlock); + vm.roll(latestEpoch + minOffsetToStartSchedule + 200); + + _bulkSlashIndicator(TConsensus.unwrap(newConsensus), 150); + _bulkWrapUpEpoch(1); + + assertFalse(_maintenance.checkMaintained(TConsensus.wrap(validatorCandidate), block.number + 1)); + assertFalse(_validator.isBlockProducer(newConsensus)); + balanceAfter = recipient.balance; + console2.log("after-upgrade:balanceAfter", balanceBefore); + uint256 afterUpgradedReward = balanceAfter - balanceBefore; + console2.log("after-upgrade:reward", afterUpgradedReward); + assertEq(afterUpgradedReward, beforeUpgradeReward, "afterUpgradedReward != beforeUpgradeReward"); + } + + function testFork_ShareSameSameReward_BeforeAndAfterUpgrade() external { + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address validatorCandidate = validatorCandidates[0]; + address candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + //address recipient = candidateAdmin; + address recipient = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedTreasury; + console2.log("before-upgrade:recipient", recipient); + uint256 balanceBefore = recipient.balance; + console2.log("before-upgrade:balanceBefore", balanceBefore); + uint256 snapshotId = vm.snapshot(); + + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + uint256 balanceAfter = recipient.balance; + console2.log("before-upgrade:balanceAfter", balanceAfter); + uint256 beforeUpgradeReward = balanceAfter - balanceBefore; + console2.log("before-upgrade:reward", beforeUpgradeReward); + + vm.revertTo(snapshotId); + _upgradeContracts(); + TConsensus newConsensus = TConsensus.wrap(makeAddr("consensus")); + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + console2.log("new-consensus", TConsensus.unwrap(newConsensus)); + + recipient = _validator.getCandidateInfo(newConsensus).__shadowedTreasury; + console2.log("after-upgrade:recipient", recipient); + + balanceBefore = recipient.balance; + console2.log("after-upgrade:balanceBefore", balanceBefore); + + _bulkSubmitBlockReward(1); + _bulkWrapUpEpoch(1); + + balanceAfter = recipient.balance; + console2.log("after-upgrade:balanceAfter", balanceBefore); + uint256 afterUpgradedReward = balanceAfter - balanceBefore; + console2.log("after-upgrade:reward", afterUpgradedReward); + + assertEq(afterUpgradedReward, beforeUpgradeReward, "afterUpgradedReward != beforeUpgradeReward"); + } + + function testFailFork_RevertWhen_AfterUpgraded_DifferentAdmins_ShareSameConsensusAddr() external upgrade { + address[] memory validatorCandidates = _validator.getValidatorCandidates(); + address validatorCandidate = validatorCandidates[0]; + address candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + TConsensus newConsensus = TConsensus.wrap(makeAddr("same-consensus")); + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + _bulkWrapUpEpoch(1); + + validatorCandidate = validatorCandidates[1]; + candidateAdmin = _validator.getCandidateInfo(TConsensus.wrap(validatorCandidate)).__shadowedAdmin; + newConsensus = TConsensus.wrap(makeAddr("same-consensus")); + vm.prank(candidateAdmin); + _profile.requestChangeConsensusAddr(validatorCandidate, newConsensus); + + _bulkWrapUpEpoch(1); + } + + function testFork_AfterUpgraded_applyValidatorCandidate() external upgrade { + _applyValidatorCandidate("candidate-admin-0", "consensus-0"); + _applyValidatorCandidate("candidate-admin-1", "consensus-1"); + _bulkWrapUpEpoch(1); + } + + function testFork_AfterUpgraded_applyValidatorCandidateByPeriod() external upgrade { + _applyValidatorCandidate("candidate-admin-0", "consensus-0"); + _bulkWrapUpEpoch(1); + _applyValidatorCandidate("candidate-admin-1", "consensus-1"); + } + + function testFailFork_RevertWhen_AfterUpgraded_ReapplyValidatorCandidateByPeriod() external upgrade { + _applyValidatorCandidate("candidate-admin", "consensus"); + _bulkWrapUpEpoch(1); + _applyValidatorCandidate("candidate-admin", "consensus"); + } + + function testFailFork_RevertWhen_AfterUpgraded_ReapplyValidatorCandidate() external upgrade { + _applyValidatorCandidate("candidate-admin", "consensus"); + _applyValidatorCandidate("candidate-admin", "consensus"); + } + + function schedule(address admin, address consensus, uint256 startAtBlock, uint256 endedAtBlock) external { + vm.prank(admin); + _maintenance.schedule(TConsensus.wrap(consensus), startAtBlock, endedAtBlock); + } + + function _bulkWrapUpEpoch(uint256 times) internal { + for (uint256 i; i < times; ++i) { + _fastForwardToNextDay(); + _wrapUpEpoch(); + } + } + + function _bulkSlashIndicator(address consensus, uint256 times) internal { + vm.startPrank(block.coinbase); + for (uint256 i; i < times; ++i) { + _slashIndicator.slashUnavailability(TConsensus.wrap(consensus)); + vm.roll(block.number + 1); + } + vm.stopPrank(); + } + + function _bulkSubmitBlockReward(uint256 times) internal { + for (uint256 i; i < times; ++i) { + vm.roll(block.number + 1); + vm.deal(block.coinbase, 1000 ether); + vm.prank(block.coinbase); + _validator.submitBlockReward{ value: 1000 ether }(); + } + } + + function _upgradeProfile() internal { + Profile logic; + + if (block.chainid == 2020) { + logic = new Profile_Mainnet(); + } + if (block.chainid == 2021) { + logic = new Profile_Testnet(); + } + + uint gl1 = gasleft(); + console2.log("gasleft 1", gl1); + + vm.prank(_getProxyAdmin(address(_profile))); + TransparentUpgradeableProxyV2(payable(address(_profile))).upgradeToAndCall( + address(logic), + abi.encodeCall(Profile.initializeV2, (address(_staking), address(_roninTO))) + ); + + uint gl2 = gasleft(); + console2.log("gasleft 2", gl2); + console2.log("consume", gl1 - gl2); + } + + function _cheatSetRoninGACode() internal { + RoninGovernanceAdmin logic = new RoninGovernanceAdmin( + block.chainid, + address(_roninTO), + address(_validator), + type(uint256).max + ); + vm.etch(address(_roninGA), address(logic).code); + + vm.startPrank(address(_roninGA)); + _roninGA.setContract(ContractType.VALIDATOR, address(_validator)); + _roninGA.setContract(ContractType.RONIN_TRUSTED_ORGANIZATION, address(_roninTO)); + vm.stopPrank(); + } + + function _upgradeMaintenance() internal { + Maintenance logic = new Maintenance(); + vm.prank(_getProxyAdmin(address(_maintenance))); + TransparentUpgradeableProxyV2(payable(address(_maintenance))).upgradeToAndCall( + address(logic), + abi.encodeCall(Maintenance.initializeV3, (address(_profile))) + ); + } + + function _upgradeRoninTO() internal { + RoninTrustedOrganization logic = new RoninTrustedOrganization(); + vm.prank(_getProxyAdmin(address(_roninTO))); + TransparentUpgradeableProxyV2(payable(address(_roninTO))).upgradeToAndCall( + address(logic), + abi.encodeCall(RoninTrustedOrganization.initializeV2, (address(_profile))) + ); + } + + function _upgradeSlashIndicator() internal { + SlashIndicator logic = new SlashIndicator(); + vm.prank(_getProxyAdmin(address(_slashIndicator))); + TransparentUpgradeableProxyV2(payable(address(_slashIndicator))).upgradeTo(address(logic)); + } + + function _upgradeStaking() internal { + Staking logic = new Staking(); + vm.prank(_getProxyAdmin(address(_staking))); + TransparentUpgradeableProxyV2(payable(_staking)).upgradeToAndCall( + address(logic), + abi.encodeCall(Staking.initializeV3, (address(_profile))) + ); + } + + function _upgradeValidator() internal { + RoninValidatorSet logic = new RoninValidatorSet(); + vm.prank(_getProxyAdmin(address(_validator))); + TransparentUpgradeableProxyV2(payable(_validator)).upgradeToAndCall( + address(logic), + abi.encodeCall(RoninValidatorSet.initializeV4, (address(_profile))) + ); + } + + function _getProxyAdmin(address proxy) internal view returns (address payable proxyAdmin) { + return payable(address(uint160(uint256(vm.load(address(proxy), ADMIN_SLOT))))); + } + + function _wrapUpEpoch() internal { + vm.prank(block.coinbase); + _validator.wrapUpEpoch(); + } + + function _fastForwardToNextDay() internal { + vm.warp(block.timestamp + 3 seconds); + vm.roll(block.number + 1); + + uint256 numberOfBlocksInEpoch = _validator.numberOfBlocksInEpoch(); + + uint256 epochEndingBlockNumber = block.number + + (numberOfBlocksInEpoch - 1) - + (block.number % numberOfBlocksInEpoch); + uint256 nextDayTimestamp = block.timestamp + 1 days; + + // fast forward to next day + vm.warp(nextDayTimestamp); + vm.roll(epochEndingBlockNumber); + } + + function _addTrustedOrg( + IRoninTrustedOrganization.TrustedOrganization memory trustedOrg + ) internal returns (IRoninTrustedOrganization.TrustedOrganization[] memory trustedOrgs) { + trustedOrgs = new IRoninTrustedOrganization.TrustedOrganization[](1); + trustedOrgs[0] = trustedOrg; + vm.prank(_getProxyAdmin(address(_roninTO))); + TransparentUpgradeableProxyV2(payable(address(_roninTO))).functionDelegateCall( + abi.encodeCall(RoninTrustedOrganization.addTrustedOrganizations, trustedOrgs) + ); + } + + function _applyValidatorCandidate(string memory candidateAdminLabel, string memory consensusLabel) internal { + address candidateAdmin = makeAddr(candidateAdminLabel); + TConsensus consensusAddr = TConsensus.wrap(makeAddr(consensusLabel)); + bytes memory pubKey = bytes(candidateAdminLabel); + + uint256 amount = _staking.minValidatorStakingAmount(); + vm.deal(candidateAdmin, amount); + vm.prank(candidateAdmin, candidateAdmin); + _staking.applyValidatorCandidate{ value: amount }( + candidateAdmin, + consensusAddr, + payable(candidateAdmin), + 15_00, + pubKey + ); + } + + function _pickOneStandardCandidate() internal view returns (address standardId, TConsensus standardConsensus) { + address[] memory validatorCids = _validator.getValidatorCandidates(); + for (uint i; i < validatorCids.length; i++) { + if (_roninTO.getConsensusWeightById(validatorCids[i]) == 0) { + standardId = validatorCids[i]; + standardConsensus = _profile.getId2Profile(standardId).consensus; + break; + } + } + } +} diff --git a/test/hardhat_test/bridge/BridgeManager.test.ts b/test/hardhat_test/bridge/BridgeManager.test.ts index cde626e7d..6f72e7e7e 100644 --- a/test/hardhat_test/bridge/BridgeManager.test.ts +++ b/test/hardhat_test/bridge/BridgeManager.test.ts @@ -35,7 +35,7 @@ import { createManyTrustedOrganizationAddressSets, TrustedOrganizationAddressSet, } from '../helpers/address-set-types/trusted-org-set-type'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { getLastBlockTimestamp, compareAddrs, ContractType, mineDummyBlock } from '../helpers/utils'; import { BridgeManagerInterface } from '../../../src/script/bridge-admin-interface'; import { OperatorTuple, createManyOperatorTuples } from '../helpers/address-set-types/operator-tuple-type'; @@ -99,7 +99,7 @@ describe('Bridge Manager test', async () => { mainchainBridgeManagerAddress, bridgeSlashAddress, bridgeRewardAddress, - } = await initTest('BridgeManager')({ + } = await deployTestSuite('BridgeManager')({ bridgeContract: bridgeContract.address, bridgeManagerArguments: { numerator: bridgeAdminNumerator, diff --git a/test/hardhat_test/bridge/BridgeTracking.test.ts b/test/hardhat_test/bridge/BridgeTracking.test.ts index b6836387c..3c5f728e1 100644 --- a/test/hardhat_test/bridge/BridgeTracking.test.ts +++ b/test/hardhat_test/bridge/BridgeTracking.test.ts @@ -5,17 +5,18 @@ import { ethers, network } from 'hardhat'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { - BridgeManager__factory, BridgeTracking, BridgeTracking__factory, MockGatewayForTracking, MockGatewayForTracking__factory, MockRoninValidatorSetExtended, MockRoninValidatorSetExtended__factory, + Profile__factory, RoninBridgeManager, RoninBridgeManager__factory, RoninGovernanceAdmin, RoninGovernanceAdmin__factory, + RoninTrustedOrganization__factory, Staking, Staking__factory, } from '../../../src/types'; @@ -28,15 +29,16 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { EpochController } from '../helpers/ronin-validator-set'; -import { ContractType, mineBatchTxs } from '../helpers/utils'; +import { ContractType, generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; import { OperatorTuple, createManyOperatorTuples, createOperatorTuple, } from '../helpers/address-set-types/operator-tuple-type'; import { BridgeManagerInterface } from '../../../src/script/bridge-admin-interface'; +import { keccak256 } from 'ethers/lib/utils'; let deployer: SignerWithAddress; let coinbase: SignerWithAddress; @@ -89,13 +91,15 @@ describe('Bridge Tracking test', () => { roninBridgeManagerAddress, bridgeSlashAddress, bridgeRewardAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('BridgeTracking')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('BridgeTracking')({ roninTrustedOrganizationArguments: { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -155,8 +159,27 @@ describe('Bridge Tracking test', () => { const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(roninValidatorSet.address, mockValidatorLogic.address); + await governanceAdminInterface.functionDelegateCalls( + [ + stakingContract.address, + roninValidatorSet.address, + roninValidatorSet.address, + profileAddress, + roninTrustedOrganizationAddress, + ], + [ + stakingContract.interface.encodeFunctionData('initializeV3', [profileAddress]), + roninValidatorSet.interface.encodeFunctionData('initializeV3', [fastFinalityTrackingAddress]), + roninValidatorSet.interface.encodeFunctionData('initializeV4', [profileAddress]), + new Profile__factory().interface.encodeFunctionData('initializeV2', [ + stakingContractAddress, + roninTrustedOrganizationAddress, + ]), + new RoninTrustedOrganization__factory().interface.encodeFunctionData('initializeV2', [profileAddress]), + ] + ); + await roninValidatorSet.initEpoch(); - await roninValidatorSet.initializeV3(fastFinalityTrackingAddress); // Applies candidates and double check the bridge operators for (let i = 0; i < candidates.length; i++) { @@ -167,6 +190,7 @@ describe('Bridge Tracking test', () => { candidates[i].consensusAddr.address, candidates[i].treasuryAddr.address, 1, + generateSamplePubkey(candidates[i].consensusAddr.address, candidates[i].candidateAdmin.address), { value: minValidatorStakingAmount + candidates.length - i } ); } diff --git a/test/hardhat_test/bridge/GatewayPauseEnforcer.test.ts b/test/hardhat_test/bridge/GatewayPauseEnforcer.test.ts index 1263a9062..b6cfc9a7a 100644 --- a/test/hardhat_test/bridge/GatewayPauseEnforcer.test.ts +++ b/test/hardhat_test/bridge/GatewayPauseEnforcer.test.ts @@ -34,7 +34,7 @@ import { ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; import { createManyOperatorTuples, OperatorTuple } from '../helpers/address-set-types/operator-tuple-type'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { ContractType, mineBatchTxs } from '../helpers/utils'; let deployer: SignerWithAddress; @@ -135,14 +135,15 @@ describe('Gateway Pause Enforcer test', () => { roninTrustedOrganizationAddress, validatorContractAddress, roninBridgeManagerAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('RoninGatewayV3-PauseEnforcer')({ + } = await deployTestSuite('RoninGatewayV3-PauseEnforcer')({ bridgeContract: bridgeContract.address, roninTrustedOrganizationArguments: { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -180,8 +181,15 @@ describe('Gateway Pause Enforcer test', () => { const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(roninValidatorSet.address, mockValidatorLogic.address); + await governanceAdminInterface.functionDelegateCalls( + [stakingContract.address, roninValidatorSet.address, roninValidatorSet.address], + [ + stakingContract.interface.encodeFunctionData('initializeV3', [profileAddress]), + roninValidatorSet.interface.encodeFunctionData('initializeV3', [fastFinalityTrackingAddress]), + roninValidatorSet.interface.encodeFunctionData('initializeV4', [profileAddress]), + ] + ); await roninValidatorSet.initEpoch(); - await roninValidatorSet.initializeV3(fastFinalityTrackingAddress); await TransparentUpgradeableProxyV2__factory.connect(proxy.address, deployer).changeAdmin(governanceAdmin.address); await governanceAdminInterface.functionDelegateCalls( @@ -364,4 +372,4 @@ describe('Gateway Pause Enforcer test', () => { expect(await pauseEnforcer.hasRole(DEFAULT_ADMIN_ROLE, enforcerAdmin.address)).eq(false); }); }); -}); +}); \ No newline at end of file diff --git a/test/hardhat_test/bridge/RoninGatewayV3.test.ts b/test/hardhat_test/bridge/RoninGatewayV3.test.ts index 3b4c02378..44a8ff35c 100644 --- a/test/hardhat_test/bridge/RoninGatewayV3.test.ts +++ b/test/hardhat_test/bridge/RoninGatewayV3.test.ts @@ -24,7 +24,7 @@ import { import { ERC20PresetMinterPauser } from '../../../src/types/ERC20PresetMinterPauser'; import { ReceiptStruct } from '../../../src/types/IRoninGatewayV3'; import { DEFAULT_ADDRESS } from '../../../src/utils'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { ContractType, mineBatchTxs } from '../helpers/utils'; import { OperatorTuple, createManyOperatorTuples } from '../helpers/address-set-types/operator-tuple-type'; import { BridgeManagerInterface } from '../../../src/script/bridge-admin-interface'; @@ -98,7 +98,8 @@ describe('Ronin Gateway V2 test', () => { bridgeTrackingAddress, roninBridgeManagerAddress, roninTrustedOrganizationAddress, - } = await initTest('RoninGatewayV3')({ + profileAddress, + } = await deployTestSuite('RoninGatewayV3')({ bridgeContract: bridgeContract.address, stakingArguments: { minValidatorStakingAmount, @@ -219,4 +220,4 @@ describe('Ronin Gateway V2 test', () => { } }); }); -}); +}); \ No newline at end of file diff --git a/test/hardhat_test/governance-admin/GovernanceAdmin.test.ts b/test/hardhat_test/governance-admin/GovernanceAdmin.test.ts index 0fa3d77d5..97fd51006 100644 --- a/test/hardhat_test/governance-admin/GovernanceAdmin.test.ts +++ b/test/hardhat_test/governance-admin/GovernanceAdmin.test.ts @@ -26,7 +26,7 @@ import { createManyTrustedOrganizationAddressSets, TrustedOrganizationAddressSet, } from '../helpers/address-set-types/trusted-org-set-type'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { getLastBlockTimestamp, compareAddrs, mineDummyBlock } from '../helpers/utils'; let deployer: SignerWithAddress; @@ -61,13 +61,13 @@ describe('Governance Admin test', () => { ); bridgeContract = MockBridge__factory.connect(proxy.address, deployer); - const { roninGovernanceAdminAddress, stakingContractAddress } = await initTest('RoninGovernanceAdminTest')({ + const { roninGovernanceAdminAddress, stakingContractAddress } = await deployTestSuite('RoninGovernanceAdminTest')({ bridgeContract: bridgeContract.address, roninTrustedOrganizationArguments: { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), diff --git a/test/hardhat_test/helpers/address-set-types/trusted-org-set-type.ts b/test/hardhat_test/helpers/address-set-types/trusted-org-set-type.ts index 3e85dd08c..b90c487c1 100644 --- a/test/hardhat_test/helpers/address-set-types/trusted-org-set-type.ts +++ b/test/hardhat_test/helpers/address-set-types/trusted-org-set-type.ts @@ -5,7 +5,7 @@ import { checkArraysHaveSameSize } from '../utils'; export type TrustedOrganizationAddressSet = { consensusAddr: SignerWithAddress; governor: SignerWithAddress; - bridgeVoter: SignerWithAddress; + __deprecatedBridgeVoter: SignerWithAddress; }; export function createTrustedOrganizationAddressSet( @@ -15,11 +15,13 @@ export function createTrustedOrganizationAddressSet( return; } - return { + let ret: TrustedOrganizationAddressSet = { consensusAddr: addrs[0], governor: addrs[1], - bridgeVoter: addrs[2], + __deprecatedBridgeVoter: addrs[2], }; + + return ret; } export function createManyTrustedOrganizationAddressSets(signers: SignerWithAddress[]): TrustedOrganizationAddressSet[]; @@ -59,6 +61,6 @@ export function createManyTrustedOrganizationAddressSets( return consensusAddrs.map((v, i) => ({ consensusAddr: v, governor: governors![i], - bridgeVoter: bridgeVoters![i], + __deprecatedBridgeVoter: bridgeVoters![i], })); } diff --git a/test/hardhat_test/helpers/fixture.ts b/test/hardhat_test/helpers/fixture.ts index c2e002f21..0325dc240 100644 --- a/test/hardhat_test/helpers/fixture.ts +++ b/test/hardhat_test/helpers/fixture.ts @@ -31,7 +31,7 @@ import { bridgeRewardConf, } from '../../../src/configs/bridge-manager'; -export interface InitTestOutput { +export interface DeployTestSuiteOutput { roninGovernanceAdminAddress: Address; maintenanceContractAddress: Address; roninTrustedOrganizationAddress: Address; @@ -41,13 +41,14 @@ export interface InitTestOutput { stakingVestingContractAddress: Address; validatorContractAddress: Address; bridgeTrackingAddress: Address; + profileAddress: Address; bridgeSlashAddress: Address; bridgeRewardAddress: Address; roninBridgeManagerAddress: Address; mainchainBridgeManagerAddress: Address; } -export interface InitTestInput { +export interface DeployTestSuiteInput { roninChainId?: BigNumberish; bridgeContract?: Address; startedAtBlock?: BigNumberish; @@ -62,7 +63,7 @@ export interface InitTestInput { bridgeRewardArguments?: BridgeRewardArguments; } -export const defaultTestConfig: InitTestInput = { +export const defaultTestConfig: DeployTestSuiteInput = { bridgeContract: ethers.constants.AddressZero, startedAtBlock: 0, @@ -152,8 +153,8 @@ export const defaultTestConfig: InitTestInput = { }, }; -export const initTest = (id: string) => - deployments.createFixture(async ({ deployments }, options) => { +export const deployTestSuite = (id: string) => + deployments.createFixture(async ({ deployments }, options) => { if (network.name == Network.Hardhat) { generalRoninConf[network.name] = { ...generalRoninConf[network.name], @@ -232,6 +233,7 @@ export const initTest = (id: string) => 'StakingProxy', 'MaintenanceProxy', 'StakingVestingProxy', + 'ProfileProxy', id, ]); @@ -243,6 +245,7 @@ export const initTest = (id: string) => const stakingContractDeployment = await deployments.get('StakingProxy'); const stakingVestingContractDeployment = await deployments.get('StakingVestingProxy'); const validatorContractDeployment = await deployments.get('RoninValidatorSetProxy'); + const profileDeployment = await deployments.get('ProfileProxy'); await deployments.fixture([ '_HelperBridgeCalculate', @@ -269,6 +272,7 @@ export const initTest = (id: string) => stakingVestingContractAddress: stakingVestingContractDeployment.address, validatorContractAddress: validatorContractDeployment.address, bridgeTrackingAddress: bridgeTrackingDeployment.address, + profileAddress: profileDeployment.address, bridgeSlashAddress: bridgeSlashDeployment.address, bridgeRewardAddress: bridgeRewardDeployment.address, roninBridgeManagerAddress: roninBridgeManagerDeployment.address, diff --git a/test/hardhat_test/helpers/initializer.ts b/test/hardhat_test/helpers/initializer.ts new file mode 100644 index 000000000..e588bb298 --- /dev/null +++ b/test/hardhat_test/helpers/initializer.ts @@ -0,0 +1,155 @@ +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { Address } from 'hardhat-deploy/dist/types'; +import { + Maintenance, + Maintenance__factory, + RoninValidatorSet, + RoninValidatorSet__factory, + SlashIndicator, + SlashIndicator__factory, + Staking, + StakingVesting, + StakingVesting__factory, + Staking__factory, + Profile, + Profile__factory, + RoninTrustedOrganization, + RoninTrustedOrganization__factory, +} from '../../../src/types'; +import { StakingVestingArguments } from '../../../src/utils'; +import { defaultTestConfig } from './fixture'; + +let maintenanceContract: Maintenance | undefined; +let stakingContract: Staking | undefined; +let validatorContract: RoninValidatorSet | undefined; +let slashContract: SlashIndicator | undefined; +let stakingVestingContract: StakingVesting | undefined; +let profileContract: Profile | undefined; +let roninTrustedOrgContract: RoninTrustedOrganization | undefined; + +export interface InitializeTestSuiteInput { + deployer: SignerWithAddress; + fastFinalityTrackingAddress: Address; + stakingVestingArgs?: StakingVestingArguments; + profileAddress: Address; + maintenanceContractAddress?: Address; + slashContractAddress?: Address; + stakingContractAddress?: Address; + validatorContractAddress?: Address; + stakingVestingAddress?: Address; + roninTrustedOrganizationAddress?: Address; +} + +interface InitREP2Input { + fastFinalityTrackingAddress: Address; + profileAddress: Address; + validatorContract?: RoninValidatorSet; + slashContract?: SlashIndicator; + stakingVestingContract?: StakingVesting; + stakingVestingArgs?: StakingVestingArguments; +} + +interface InitREP3Input { + profileAddress: Address; + maintenanceContract?: Maintenance; + stakingContract?: Staking; + validatorContract?: RoninValidatorSet; +} + +interface InitREP4Input { + profileContract?: Profile; + stakingContract?: Staking; + roninTrustedOrgContract?: RoninTrustedOrganization; +} + +export const initializeTestSuite = async (input: InitializeTestSuiteInput) => { + // Cheat the instance of `input`, since it propagates among tests, and does not get cleared. + maintenanceContract = input.maintenanceContractAddress + ? Maintenance__factory.connect(input.maintenanceContractAddress!, input.deployer) + : undefined; + + stakingContract = input.stakingContractAddress + ? Staking__factory.connect(input.stakingContractAddress!, input.deployer) + : undefined; + + validatorContract = input.validatorContractAddress + ? RoninValidatorSet__factory.connect(input.validatorContractAddress!, input.deployer) + : undefined; + + slashContract = input.slashContractAddress + ? SlashIndicator__factory.connect(input.slashContractAddress!, input.deployer) + : undefined; + + stakingVestingContract = input.stakingVestingAddress + ? StakingVesting__factory.connect(input.stakingVestingAddress!, input.deployer) + : undefined; + + profileContract = input.profileAddress ? Profile__factory.connect(input.profileAddress!, input.deployer) : undefined; + + roninTrustedOrgContract = input.roninTrustedOrganizationAddress + ? RoninTrustedOrganization__factory.connect(input.roninTrustedOrganizationAddress!, input.deployer) + : undefined; + + await upgradeRep2({ + fastFinalityTrackingAddress: input.fastFinalityTrackingAddress, + profileAddress: input.profileAddress, + validatorContract, + slashContract, + stakingVestingArgs: input.stakingVestingArgs, + stakingVestingContract, + }); + + await upgradeRep3({ + profileAddress: input.profileAddress, + maintenanceContract, + stakingContract, + validatorContract, + }); + + await upgradeRep4({ + profileContract, + stakingContract, + roninTrustedOrgContract, + }); +}; + +const upgradeRep2 = async (input: InitREP2Input) => { + if (input.validatorContract) { + await input.validatorContract.initializeV3(input.fastFinalityTrackingAddress); + } + + if (input.stakingVestingContract) { + await input.stakingVestingContract.initializeV3( + input.stakingVestingArgs!.fastFinalityRewardPercent ?? + defaultTestConfig.stakingVestingArguments?.fastFinalityRewardPercent! + ); + } + + if (input.slashContract) { + await input.slashContract.initializeV3(input.profileAddress); + } +}; + +const upgradeRep3 = async (input: InitREP3Input) => { + if (input.maintenanceContract) { + await input.maintenanceContract.initializeV3(input.profileAddress); + } + + if (input.stakingContract) { + await input.stakingContract.initializeV3(input.profileAddress); + } + + if (input.validatorContract) { + await input.validatorContract.initializeV4(input.profileAddress); + } +}; + +const upgradeRep4 = async (input: InitREP4Input) => { + if (input.profileContract) { + await input.profileContract.initializeV2(input.stakingContract?.address!, input.roninTrustedOrgContract?.address!); + } + + if (input.roninTrustedOrgContract) { + await input.roninTrustedOrgContract.initializeV2(input.profileContract?.address!); + } +}; diff --git a/test/hardhat_test/helpers/utils.ts b/test/hardhat_test/helpers/utils.ts index 63c4077d9..7b0a06a41 100644 --- a/test/hardhat_test/helpers/utils.ts +++ b/test/hardhat_test/helpers/utils.ts @@ -3,6 +3,7 @@ import { BigNumber, ContractTransaction } from 'ethers'; import { Interface, LogDescription } from 'ethers/lib/utils'; import { ethers, network } from 'hardhat'; import { Address } from 'hardhat-deploy/dist/types'; +import { randomAddress } from '../../../src/utils'; export const expectEvent = async ( contractInterface: Interface, @@ -101,3 +102,9 @@ export const checkArraysHaveSameSize = (arrays: Array[]) => { let uniqueLengths = [...new Set(lengths)]; return uniqueLengths.length == 1 && uniqueLengths[0] != 0; }; + +export const generateSamplePubkey = (consensusAddr?: Address, candidateAdminAddr?: Address): Uint8Array => { + consensusAddr ??= randomAddress(); + candidateAdminAddr ??= randomAddress(); + return ethers.utils.toUtf8Bytes(consensusAddr + '-' + candidateAdminAddr); +}; \ No newline at end of file diff --git a/test/hardhat_test/integration/ActionBridgeTracking.test.ts b/test/hardhat_test/integration/ActionBridgeTracking.test.ts index a76bb8c3c..68f2c51ff 100644 --- a/test/hardhat_test/integration/ActionBridgeTracking.test.ts +++ b/test/hardhat_test/integration/ActionBridgeTracking.test.ts @@ -31,12 +31,13 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { EpochController } from '../helpers/ronin-validator-set'; -import { ContractType, mineBatchTxs } from '../helpers/utils'; +import { ContractType, generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; import { BridgeManagerInterface } from '../../../src/script/bridge-admin-interface'; import { TargetOption } from '../../../src/script/proposal'; import { OperatorTuple, createManyOperatorTuples } from '../helpers/address-set-types/operator-tuple-type'; +import { initializeTestSuite } from '../helpers/initializer'; let deployer: SignerWithAddress; let coinbase: SignerWithAddress; @@ -114,14 +115,16 @@ describe('[Integration] Bridge Tracking test', () => { roninBridgeManagerAddress, bridgeSlashAddress, bridgeRewardAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('ActionBridgeTracking')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('ActionBridgeTracking')({ bridgeContract: bridgeProxy.address, roninTrustedOrganizationArguments: { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -171,11 +174,19 @@ describe('[Integration] Bridge Tracking test', () => { ...trustedOrgs.map((_) => _.governor) ); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + }); + const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(roninValidatorSet.address, mockValidatorLogic.address); await roninValidatorSet.initEpoch(); - await roninValidatorSet.initializeV3(fastFinalityTrackingAddress); await TransparentUpgradeableProxyV2__factory.connect(bridgeContract.address, deployer).changeAdmin( bridgeManager.address @@ -213,6 +224,7 @@ describe('[Integration] Bridge Tracking test', () => { candidates[i].consensusAddr.address, candidates[i].treasuryAddr.address, 1, + generateSamplePubkey(), { value: minValidatorStakingAmount + candidates.length - i } ); } diff --git a/test/hardhat_test/integration/ActionSlashValidators.test.ts b/test/hardhat_test/integration/ActionSlashValidators.test.ts index f38502ffb..76369bd81 100644 --- a/test/hardhat_test/integration/ActionSlashValidators.test.ts +++ b/test/hardhat_test/integration/ActionSlashValidators.test.ts @@ -13,13 +13,15 @@ import { MockRoninValidatorSetExtended, RoninGovernanceAdmin, RoninGovernanceAdmin__factory, + Profile__factory, + Profile, } from '../../../src/types'; import { EpochController, expects as RoninValidatorSetExpects } from '../helpers/ronin-validator-set'; import { expects as CandidateManagerExpects } from '../helpers/candidate-manager'; -import { mineBatchTxs } from '../helpers/utils'; +import { generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; import { SlashType } from '../../../src/script/slash-indicator'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { createManyTrustedOrganizationAddressSets, @@ -30,10 +32,12 @@ import { ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; import { DEFAULT_ADDRESS } from '../../../src/utils'; +import { initializeTestSuite } from '../helpers/initializer'; let slashContract: SlashIndicator; let stakingContract: Staking; let validatorContract: MockRoninValidatorSetExtended; +let profileContract: Profile; let governanceAdmin: RoninGovernanceAdmin; let governanceAdminInterface: GovernanceAdminInterface; @@ -60,42 +64,50 @@ describe('[Integration] Slash validators', () => { await network.provider.send('hardhat_setCoinbase', [coinbase.address]); - const { slashContractAddress, stakingContractAddress, validatorContractAddress, roninGovernanceAdminAddress, fastFinalityTrackingAddress } = - await initTest('ActionSlashValidators')({ - slashIndicatorArguments: { - unavailabilitySlashing: { - unavailabilityTier1Threshold, - unavailabilityTier2Threshold, - slashAmountForUnavailabilityTier2Threshold, - jailDurationForUnavailabilityTier2Threshold, - }, - doubleSignSlashing: { - slashDoubleSignAmount, - }, + const { + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninGovernanceAdminAddress, + profileAddress, + fastFinalityTrackingAddress, + roninTrustedOrganizationAddress, + } = await deployTestSuite('ActionSlashValidators')({ + slashIndicatorArguments: { + unavailabilitySlashing: { + unavailabilityTier1Threshold, + unavailabilityTier2Threshold, + slashAmountForUnavailabilityTier2Threshold, + jailDurationForUnavailabilityTier2Threshold, }, - roninValidatorSetArguments: { - maxValidatorNumber, + doubleSignSlashing: { + slashDoubleSignAmount, }, - stakingArguments: { - minValidatorStakingAmount, - waitingSecsToRevoke, - }, - roninTrustedOrganizationArguments: { - trustedOrganizations: [ - { - consensusAddr: trustedOrgs[0].consensusAddr.address, - governor: trustedOrgs[0].governor.address, - bridgeVoter: trustedOrgs[0].bridgeVoter.address, - weight: 100, - addedBlock: 0, - }, - ], - }, - }); + }, + roninValidatorSetArguments: { + maxValidatorNumber, + }, + stakingArguments: { + minValidatorStakingAmount, + waitingSecsToRevoke, + }, + roninTrustedOrganizationArguments: { + trustedOrganizations: [ + { + consensusAddr: trustedOrgs[0].consensusAddr.address, + governor: trustedOrgs[0].governor.address, + __deprecatedBridgeVoter: trustedOrgs[0].__deprecatedBridgeVoter.address, + weight: 100, + addedBlock: 0, + }, + ], + }, + }); slashContract = SlashIndicator__factory.connect(slashContractAddress, deployer); stakingContract = Staking__factory.connect(stakingContractAddress, deployer); validatorContract = MockRoninValidatorSetExtended__factory.connect(validatorContractAddress, deployer); + profileContract = Profile__factory.connect(profileAddress, deployer); governanceAdmin = RoninGovernanceAdmin__factory.connect(roninGovernanceAdminAddress, deployer); governanceAdminInterface = new GovernanceAdminInterface( governanceAdmin, @@ -104,11 +116,20 @@ describe('[Integration] Slash validators', () => { trustedOrgs[0].governor ); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + }); + const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); await validatorContract.initEpoch(); - await validatorContract.initializeV3(fastFinalityTrackingAddress); await EpochController.setTimestampToPeriodEnding(); await network.provider.send('hardhat_setCoinbase', [coinbase.address]); @@ -122,13 +143,44 @@ describe('[Integration] Slash validators', () => { let expectingValidatorSet: Address[] = []; let expectingBlockProducerSet: Address[] = []; let period: BigNumberish; + let slasheeIdx: number; + let slashee: ValidatorCandidateAddressSet; + let slasheeInitStakingAmount: BigNumber; + let wrapUpEpochTx: ContractTransaction; before(async () => { period = await validatorContract.currentPeriod(); - await validatorContract.addValidators([1, 2, 3].map((i) => validatorCandidates[i].consensusAddr.address)); + slasheeIdx = 1; + slashee = validatorCandidates[slasheeIdx]; + slasheeInitStakingAmount = minValidatorStakingAmount + .add(slashAmountForUnavailabilityTier2Threshold.mul(10)) + .add(100); + await stakingContract + .connect(slashee.poolAdmin) + .applyValidatorCandidate( + slashee.candidateAdmin.address, + slashee.consensusAddr.address, + slashee.treasuryAddr.address, + 2_00, + generateSamplePubkey(), + { + value: slasheeInitStakingAmount, + } + ); + + await EpochController.setTimestampToPeriodEnding(); + await mineBatchTxs(async () => { + await validatorContract.connect(coinbase).endEpoch(); + wrapUpEpochTx = await validatorContract.connect(coinbase).wrapUpEpoch(); + }); + + period = await validatorContract.currentPeriod(); + expectingValidatorSet.push(slashee.consensusAddr.address); + expectingBlockProducerSet.push(slashee.consensusAddr.address); + await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(wrapUpEpochTx!, period, expectingValidatorSet); }); - describe('Slash misdemeanor validator', async () => { + describe('Slash tier-1 validator', async () => { it('Should the ValidatorSet contract emit event', async () => { let slasheeIdx = 1; let slashee = validatorCandidates[slasheeIdx].consensusAddr; @@ -165,6 +217,7 @@ describe('[Integration] Slash validators', () => { slashee.consensusAddr.address, slashee.treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: slasheeInitStakingAmount, } @@ -220,6 +273,7 @@ describe('[Integration] Slash validators', () => { // ]); expect(await validatorContract.getJailUntils(expectingValidatorSet)).deep.equal([ + BigNumber.from(0), BigNumber.from(blockNumber).add(jailDurationForUnavailabilityTier2Threshold), ]); }); @@ -312,6 +366,7 @@ describe('[Integration] Slash validators', () => { slashees[i].consensusAddr.address, slashees[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: slasheeInitStakingAmount.add(slashees.length - i), } @@ -536,30 +591,26 @@ describe('[Integration] Slash validators', () => { }); await expect(topUpTx) .revertedWithCustomError(stakingContract, 'ErrInactivePool') - .withArgs(slashee.consensusAddr.address); + .withArgs(slashee.consensusAddr.address, slashee.consensusAddr.address); } }); - it('Should the kicked validator be able to re-join as a candidate', async () => { + it('Should the kicked validator cannot be able to re-join as a candidate', async () => { for (let slashee of slashees) { - let applyCandidateTx = await stakingContract + let reApplyTx = stakingContract .connect(slashee.poolAdmin) .applyValidatorCandidate( slashee.candidateAdmin.address, slashee.consensusAddr.address, slashee.treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: slasheeInitStakingAmount, } ); - await CandidateManagerExpects.emitCandidateGrantedEvent( - applyCandidateTx!, - slashee.consensusAddr.address, - slashee.treasuryAddr.address, - slashee.candidateAdmin.address - ); + await expect(reApplyTx).revertedWithCustomError(profileContract, 'ErrExistentProfile'); } }); }); diff --git a/test/hardhat_test/integration/ActionSubmitReward.test.ts b/test/hardhat_test/integration/ActionSubmitReward.test.ts index 3c34d0cc8..27f7f95eb 100644 --- a/test/hardhat_test/integration/ActionSubmitReward.test.ts +++ b/test/hardhat_test/integration/ActionSubmitReward.test.ts @@ -13,8 +13,8 @@ import { RoninGovernanceAdmin, RoninGovernanceAdmin__factory, } from '../../../src/types'; -import { ContractType, mineBatchTxs } from '../helpers/utils'; -import { initTest } from '../helpers/fixture'; +import { ContractType, generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { EpochController } from '../helpers/ronin-validator-set'; import { BlockRewardDeprecatedType } from '../../../src/script/ronin-validator-set'; @@ -26,6 +26,7 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; +import { initializeTestSuite } from '../helpers/initializer'; let slashContract: SlashIndicator; let stakingContract: Staking; @@ -61,8 +62,10 @@ describe('[Integration] Submit Block Reward', () => { stakingContractAddress, validatorContractAddress, roninGovernanceAdminAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('ActionSubmitReward')({ + roninTrustedOrganizationAddress + } = await deployTestSuite('ActionSubmitReward')({ slashIndicatorArguments: { unavailabilitySlashing: { unavailabilityTier2Threshold, @@ -82,13 +85,23 @@ describe('[Integration] Submit Block Reward', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), }, }); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress + }); + slashContract = SlashIndicator__factory.connect(slashContractAddress, deployer); stakingContract = Staking__factory.connect(stakingContractAddress, deployer); validatorContract = MockRoninValidatorSetExtended__factory.connect(validatorContractAddress, deployer); @@ -104,7 +117,6 @@ describe('[Integration] Submit Block Reward', () => { await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); await validatorContract.initEpoch(); - await validatorContract.initializeV3(fastFinalityTrackingAddress); }); describe('Configuration check', async () => { @@ -142,6 +154,7 @@ describe('[Integration] Submit Block Reward', () => { validator.consensusAddr.address, validator.treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: initStakingAmount, } @@ -193,6 +206,7 @@ describe('[Integration] Submit Block Reward', () => { validator.consensusAddr.address, validator.treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: initStakingAmount, } diff --git a/test/hardhat_test/integration/ActionWrapUpEpoch.test.ts b/test/hardhat_test/integration/ActionWrapUpEpoch.test.ts index 82f1db359..dab20e172 100644 --- a/test/hardhat_test/integration/ActionWrapUpEpoch.test.ts +++ b/test/hardhat_test/integration/ActionWrapUpEpoch.test.ts @@ -15,8 +15,8 @@ import { } from '../../../src/types'; import { expects as StakingExpects } from '../helpers/staking'; import { EpochController, expects as ValidatorSetExpects } from '../helpers/ronin-validator-set'; -import { ContractType, mineBatchTxs } from '../helpers/utils'; -import { initTest } from '../helpers/fixture'; +import { ContractType, generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { Address } from 'hardhat-deploy/dist/types'; import { @@ -27,6 +27,7 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; +import { initializeTestSuite } from '../helpers/initializer'; let slashContract: SlashIndicator; let stakingContract: Staking; @@ -61,8 +62,10 @@ describe('[Integration] Wrap up epoch', () => { stakingContractAddress, validatorContractAddress, roninGovernanceAdminAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('ActionWrapUpEpoch')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('ActionWrapUpEpoch')({ slashIndicatorArguments: { unavailabilitySlashing: { unavailabilityTier2Threshold, @@ -79,7 +82,7 @@ describe('[Integration] Wrap up epoch', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -99,11 +102,20 @@ describe('[Integration] Wrap up epoch', () => { ...trustedOrgs.map((_) => _.governor) ); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + }); + const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); await validatorContract.initEpoch(); - await validatorContract.initializeV3(fastFinalityTrackingAddress); }); after(async () => { @@ -153,6 +165,7 @@ describe('[Integration] Wrap up epoch', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.mul(2).add(i), } @@ -261,6 +274,7 @@ describe('[Integration] Wrap up epoch', () => { validators[i].consensusAddr.address, validators[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.mul(3).add(i), } diff --git a/test/hardhat_test/integration/Configuration.test.ts b/test/hardhat_test/integration/Configuration.test.ts index c6e9bb576..9a21f194f 100644 --- a/test/hardhat_test/integration/Configuration.test.ts +++ b/test/hardhat_test/integration/Configuration.test.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import { ethers, network } from 'hardhat'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { BigNumber } from 'ethers'; @@ -20,6 +20,8 @@ import { RoninGovernanceAdmin, BridgeTracking__factory, BridgeTracking, + Profile, + Profile__factory, RoninBridgeManager, RoninBridgeManager__factory, BridgeReward, @@ -27,13 +29,15 @@ import { BridgeSlash, BridgeSlash__factory, } from '../../../src/types'; -import { initTest, InitTestInput } from '../helpers/fixture'; -import { MAX_UINT255, randomAddress } from '../../../src/utils'; +import { deployTestSuite, DeployTestSuiteInput } from '../helpers/fixture'; +import { DEFAULT_ADDRESS, MAX_UINT255, randomAddress } from '../../../src/utils'; import { createManyTrustedOrganizationAddressSets, TrustedOrganizationAddressSet, } from '../helpers/address-set-types/trusted-org-set-type'; import { ContractType, compareBigNumbers } from '../helpers/utils'; +import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; +import { initializeTestSuite } from '../helpers/initializer'; let stakingVestingContract: StakingVesting; let maintenanceContract: Maintenance; @@ -41,18 +45,20 @@ let slashContract: SlashIndicator; let stakingContract: Staking; let validatorContract: RoninValidatorSet; let roninTrustedOrganizationContract: RoninTrustedOrganization; -let roninGovernanceAdminContract: RoninGovernanceAdmin; let bridgeTrackingContract: BridgeTracking; +let profileContract: Profile; +let roninGovernanceAdminContract: RoninGovernanceAdmin; let bridgeManagerContract: RoninBridgeManager; let bridgeRewardContract: BridgeReward; let bridgeSlashContract: BridgeSlash; +let governanceAdminInterface: GovernanceAdminInterface; let coinbase: SignerWithAddress; let deployer: SignerWithAddress; let signers: SignerWithAddress[]; let trustedOrgs: TrustedOrganizationAddressSet[]; -const config: InitTestInput = { +const config: DeployTestSuiteInput = { bridgeContract: randomAddress(), startedAtBlock: Math.floor(Math.random() * 1_000_000), @@ -135,7 +141,7 @@ describe('[Integration] Configuration check', () => { config.roninTrustedOrganizationArguments!.trustedOrganizations = trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })); @@ -148,10 +154,12 @@ describe('[Integration] Configuration check', () => { roninTrustedOrganizationAddress, roninGovernanceAdminAddress, bridgeTrackingAddress, + profileAddress, bridgeRewardAddress, bridgeSlashAddress, roninBridgeManagerAddress, - } = await initTest('Configuration')(config); + fastFinalityTrackingAddress, + } = await deployTestSuite('Configuration')(config); roninGovernanceAdminContract = RoninGovernanceAdmin__factory.connect(roninGovernanceAdminAddress, deployer); maintenanceContract = Maintenance__factory.connect(maintenanceContractAddress, deployer); @@ -164,9 +172,28 @@ describe('[Integration] Configuration check', () => { stakingVestingContract = StakingVesting__factory.connect(stakingVestingContractAddress, deployer); validatorContract = RoninValidatorSet__factory.connect(validatorContractAddress, deployer); bridgeTrackingContract = BridgeTracking__factory.connect(bridgeTrackingAddress, deployer); + profileContract = Profile__factory.connect(profileAddress, deployer); bridgeRewardContract = BridgeReward__factory.connect(bridgeRewardAddress, deployer); bridgeSlashContract = BridgeSlash__factory.connect(bridgeSlashAddress, deployer); bridgeManagerContract = RoninBridgeManager__factory.connect(roninBridgeManagerAddress, deployer); + + governanceAdminInterface = new GovernanceAdminInterface( + roninGovernanceAdminContract, + network.config.chainId!, + undefined, + ...trustedOrgs.map((_) => _.governor) + ); + + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + maintenanceContractAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + }); }); it('Should the RoninGovernanceAdmin contract set configs correctly', async () => { @@ -203,10 +230,10 @@ describe('[Integration] Configuration check', () => { it('Should the RoninTrustedOrganization contract set configs correctly', async () => { expect( (await roninTrustedOrganizationContract.getAllTrustedOrganizations()).map( - ({ consensusAddr, governor, bridgeVoter, weight }) => ({ + ({ consensusAddr, governor, __deprecatedBridgeVoter, weight }) => ({ consensusAddr, governor, - bridgeVoter, + __deprecatedBridgeVoter, weight, addedBlock: undefined, }) @@ -215,7 +242,7 @@ describe('[Integration] Configuration check', () => { trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: DEFAULT_ADDRESS, weight: BigNumber.from(100), addedBlock: undefined, })) @@ -225,31 +252,17 @@ describe('[Integration] Configuration check', () => { BigNumber.from ) ); + expect(await roninTrustedOrganizationContract.getContract(ContractType.PROFILE)).to.eq(profileContract.address); }); it('Should the SlashIndicatorContract contract set configs correctly', async () => { expect(await slashContract.getContract(ContractType.VALIDATOR)).to.eq(validatorContract.address); expect(await slashContract.getContract(ContractType.MAINTENANCE)).to.eq(maintenanceContract.address); + expect(await slashContract.getContract(ContractType.PROFILE)).to.eq(profileContract.address); expect(await slashContract.getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).to.eq( roninTrustedOrganizationContract.address ); expect(await slashContract.getContract(ContractType.GOVERNANCE_ADMIN)).to.eq(roninGovernanceAdminContract.address); - await compareBigNumbers( - await slashContract.getBridgeOperatorSlashingConfigs(), - [ - config.slashIndicatorArguments?.bridgeOperatorSlashing?.missingVotesRatioTier1, - config.slashIndicatorArguments?.bridgeOperatorSlashing?.missingVotesRatioTier2, - config.slashIndicatorArguments?.bridgeOperatorSlashing?.jailDurationForMissingVotesRatioTier2, - config.slashIndicatorArguments?.bridgeOperatorSlashing?.skipBridgeOperatorSlashingThreshold, - ].map(BigNumber.from) - ); - await compareBigNumbers( - await slashContract.getBridgeVotingSlashingConfigs(), - [ - config.slashIndicatorArguments?.bridgeVotingSlashing?.bridgeVotingThreshold, - config.slashIndicatorArguments?.bridgeVotingSlashing?.bridgeVotingSlashAmount, - ].map(BigNumber.from) - ); await compareBigNumbers( await slashContract.getDoubleSignSlashingConfigs(), [ @@ -280,6 +293,7 @@ describe('[Integration] Configuration check', () => { it('Should the StakingContract contract set configs correctly', async () => { expect(await stakingContract.getContract(ContractType.VALIDATOR)).to.eq(validatorContract.address); + expect(await stakingContract.getContract(ContractType.PROFILE)).to.eq(profileContract.address); expect(await stakingContract.minValidatorStakingAmount()).to.eq(config.stakingArguments?.minValidatorStakingAmount); expect(await stakingContract.cooldownSecsToUndelegate()).to.eq(config.stakingArguments?.cooldownSecsToUndelegate); expect(await stakingContract.waitingSecsToRevoke()).to.eq(config.stakingArguments?.waitingSecsToRevoke); @@ -309,6 +323,7 @@ describe('[Integration] Configuration check', () => { expect(await validatorContract.getContract(ContractType.RONIN_TRUSTED_ORGANIZATION)).to.eq( roninTrustedOrganizationContract.address ); + expect(await validatorContract.getContract(ContractType.PROFILE)).to.eq(profileContract.address); expect(await validatorContract.maxValidatorNumber()).to.eq(config.roninValidatorSetArguments?.maxValidatorNumber); expect(await validatorContract.maxValidatorCandidate()).to.eq( config.roninValidatorSetArguments?.maxValidatorCandidate @@ -340,4 +355,8 @@ describe('[Integration] Configuration check', () => { expect(await bridgeSlashContract.getContract(ContractType.BRIDGE_MANAGER)).to.eq(bridgeManagerContract.address); expect(await bridgeSlashContract.getContract(ContractType.BRIDGE_TRACKING)).to.eq(bridgeTrackingContract.address); }); + + it('Should the Profile contract set configs correctly', async () => { + expect(await profileContract.getContract(ContractType.STAKING)).to.eq(stakingContract.address); + }); }); diff --git a/test/hardhat_test/maintainance/Maintenance.test.ts b/test/hardhat_test/maintainance/Maintenance.test.ts index cd5f328fb..1d104125d 100644 --- a/test/hardhat_test/maintainance/Maintenance.test.ts +++ b/test/hardhat_test/maintainance/Maintenance.test.ts @@ -15,7 +15,7 @@ import { RoninGovernanceAdmin, RoninGovernanceAdmin__factory, } from '../../../src/types'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { EpochController, expects as ValidatorSetExpects } from '../helpers/ronin-validator-set'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { @@ -26,6 +26,8 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; +import { initializeTestSuite } from '../helpers/initializer'; +import { generateSamplePubkey } from '../helpers/utils'; let coinbase: SignerWithAddress; let deployer: SignerWithAddress; @@ -71,8 +73,10 @@ describe('Maintenance test', () => { stakingContractAddress, validatorContractAddress, roninGovernanceAdminAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('Maintenance')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('Maintenance')({ slashIndicatorArguments: { unavailabilitySlashing: { unavailabilityTier1Threshold, @@ -97,7 +101,7 @@ describe('Maintenance test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -115,6 +119,17 @@ describe('Maintenance test', () => { ...trustedOrgs.map((_) => _.governor) ); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + maintenanceContractAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + }); + const mockValidatorLogic = await new MockRoninValidatorSetOverridePrecompile__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); @@ -128,10 +143,10 @@ describe('Maintenance test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 1, + generateSamplePubkey(), { value: minValidatorStakingAmount.add(maxValidatorNumber).sub(i) } ); } - await validatorContract.initializeV3(fastFinalityTrackingAddress); await network.provider.send('hardhat_setCoinbase', [coinbase.address]); diff --git a/test/hardhat_test/slash/CreditScore.test.ts b/test/hardhat_test/slash/CreditScore.test.ts index 2f39f91ad..da8ba3d37 100644 --- a/test/hardhat_test/slash/CreditScore.test.ts +++ b/test/hardhat_test/slash/CreditScore.test.ts @@ -16,7 +16,7 @@ import { Staking, Staking__factory, } from '../../../src/types'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { EpochController, expects as RoninValidatorSetExpects } from '../helpers/ronin-validator-set'; import { expects as CandidateManagerExpects } from '../helpers/candidate-manager'; import { IndicatorController, ScoreController } from '../helpers/slash'; @@ -31,6 +31,8 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; +import { initializeTestSuite } from '../helpers/initializer'; +import { generateSamplePubkey } from '../helpers/utils'; let maintenanceContract: Maintenance; let slashContract: MockSlashIndicatorExtended; @@ -158,8 +160,10 @@ describe('Credit score and bail out test', () => { validatorContractAddress, roninGovernanceAdminAddress, maintenanceContractAddress, - fastFinalityTrackingAddress - } = await initTest('CreditScore')({ + profileAddress, + fastFinalityTrackingAddress, + roninTrustedOrganizationAddress, + } = await deployTestSuite('CreditScore')({ slashIndicatorArguments: { unavailabilitySlashing: { unavailabilityTier1Threshold, @@ -191,7 +195,7 @@ describe('Credit score and bail out test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -213,12 +217,21 @@ describe('Credit score and bail out test', () => { const mockValidatorLogic = await new MockRoninValidatorSetOverridePrecompile__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); - await validatorContract.initializeV3(fastFinalityTrackingAddress); - mockSlashLogic = await new MockSlashIndicatorExtended__factory(deployer).deploy(); await mockSlashLogic.deployed(); await governanceAdminInterface.upgrade(slashContractAddress, mockSlashLogic.address); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + maintenanceContractAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + }); + for (let i = 0; i < maxValidatorNumber; i++) { await stakingContract .connect(validatorCandidates[i].poolAdmin) @@ -227,6 +240,7 @@ describe('Credit score and bail out test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 100_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.mul(2).sub(i) } ); } @@ -248,6 +262,14 @@ describe('Credit score and bail out test', () => { }); describe('Counting credit score after each period', async () => { + before(async () => { + snapshotId = await network.provider.send('evm_snapshot'); + }); + + after(async () => { + await network.provider.send('evm_revert', [snapshotId]); + }); + it('Should the score updated correctly, case: max score (N), in jail (N), unavailability (N)', async () => { await endPeriodAndWrapUpAndResetIndicators(); localScoreController.increaseAtWithUpperbound(0, maxCreditScore, gainCreditScore); @@ -294,18 +316,6 @@ describe('Credit score and bail out test', () => { localScoreController.resetAt(0); await validateScoreAt(0); - - await stakingContract - .connect(validatorCandidates[0].poolAdmin) - .applyValidatorCandidate( - validatorCandidates[0].candidateAdmin.address, - validatorCandidates[0].consensusAddr.address, - validatorCandidates[0].treasuryAddr.address, - 100_00, - { value: minValidatorStakingAmount.mul(2) } - ); - - await endPeriodAndWrapUpAndResetIndicators(); }); }); diff --git a/test/hardhat_test/slash/SlashIndicator.test.ts b/test/hardhat_test/slash/SlashIndicator.test.ts index 01b027878..279be7e53 100644 --- a/test/hardhat_test/slash/SlashIndicator.test.ts +++ b/test/hardhat_test/slash/SlashIndicator.test.ts @@ -14,7 +14,7 @@ import { Staking__factory, } from '../../../src/types'; import { SlashType } from '../../../src/script/slash-indicator'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { EpochController } from '../helpers/ronin-validator-set'; import { IndicatorController } from '../helpers/slash'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; @@ -26,11 +26,12 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; -import { getLastBlockTimestamp } from '../helpers/utils'; +import { generateSamplePubkey, getLastBlockTimestamp } from '../helpers/utils'; import { ProposalDetailStruct } from '../../../src/types/GovernanceAdmin'; import { getProposalHash, VoteType } from '../../../src/script/proposal'; import { expects as GovernanceAdminExpects } from '../helpers/governance-admin'; import { Encoder } from '../helpers/encoder'; +import { initializeTestSuite } from '../helpers/initializer'; let slashContract: MockSlashIndicatorExtended; let mockSlashLogic: MockSlashIndicatorExtended; @@ -87,8 +88,10 @@ describe('Slash indicator test', () => { stakingContractAddress, validatorContractAddress, roninGovernanceAdminAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('SlashIndicator')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('SlashIndicator')({ slashIndicatorArguments: { unavailabilitySlashing: { unavailabilityTier1Threshold, @@ -125,7 +128,7 @@ describe('Slash indicator test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -140,6 +143,17 @@ describe('Slash indicator test', () => { }, }); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + maintenanceContractAddress: undefined + }); + stakingContract = Staking__factory.connect(stakingContractAddress, deployer); validatorContract = MockRoninValidatorSetOverridePrecompile__factory.connect(validatorContractAddress, deployer); slashContract = MockSlashIndicatorExtended__factory.connect(slashContractAddress, deployer); @@ -154,7 +168,6 @@ describe('Slash indicator test', () => { const mockValidatorLogic = await new MockRoninValidatorSetOverridePrecompile__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); - await validatorContract.initializeV3(fastFinalityTrackingAddress); mockSlashLogic = await new MockSlashIndicatorExtended__factory(deployer).deploy(); await mockSlashLogic.deployed(); @@ -169,6 +182,7 @@ describe('Slash indicator test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 1, + generateSamplePubkey(), { value: minValidatorStakingAmount.mul(2).add(maxValidatorNumber).sub(i) } ); } @@ -212,26 +226,6 @@ describe('Slash indicator test', () => { let configs = await slashContract.getDoubleSignSlashingConfigs(); expect(configs.slashDoubleSignAmount_).eq(slashDoubleSignAmount, 'wrong double sign config'); }); - - it('Should configs of bridge operator slash are set correctly', async () => { - let configs = await slashContract.getBridgeOperatorSlashingConfigs(); - expect(configs.missingVotesRatioTier1_).eq(missingVotesRatioTier1, 'wrong missing votes ratio tier 1 config'); - expect(configs.missingVotesRatioTier2_).eq(missingVotesRatioTier2, 'wrong missing votes ratio tier 2 config'); - expect(configs.jailDurationForMissingVotesRatioTier2_).eq( - jailDurationForMissingVotesRatioTier2, - 'wrong jail duration for vote tier 2 config' - ); - expect(configs.skipBridgeOperatorSlashingThreshold_).eq( - skipBridgeOperatorSlashingThreshold, - 'wrong skip slashing config' - ); - }); - - it('Should configs of bridge voting slash are set correctly', async () => { - let configs = await slashContract.getBridgeVotingSlashingConfigs(); - expect(configs.bridgeVotingSlashAmount_).eq(bridgeVotingSlashAmount, 'wrong bridge voting slash amount config'); - expect(configs.bridgeVotingThreshold_).eq(bridgeVotingThreshold, 'wrong bridge voting threshold config'); - }); }); describe('Single flow test', async () => { diff --git a/test/hardhat_test/staking/RewardCalculation.test.ts b/test/hardhat_test/staking/RewardCalculation.test.ts index 3afd0ca1f..d58093357 100644 --- a/test/hardhat_test/staking/RewardCalculation.test.ts +++ b/test/hardhat_test/staking/RewardCalculation.test.ts @@ -67,9 +67,7 @@ describe('Reward Calculation test', () => { await stakingContract.decreaseReward(500); aRps = MASK.mul(500 / 50); tx = await stakingContract.endPeriod(); // period = 1 - await expect(tx) - .emit(stakingContract, 'PoolsUpdated') - .withArgs(period++, [poolAddr], [aRps], [100]); + await expect(tx).emit(stakingContract, 'PoolsUpdated').withArgs(period++, [poolAddr], [aRps], [100]); expect(await stakingContract.getReward(poolAddr, userA.address)).eq(500); }); }); @@ -163,9 +161,7 @@ describe('Reward Calculation test', () => { aRps = aRps.add(MASK.mul(1000 / 500)); await stakingContract.increaseReward(1000); tx = await stakingContract.endPeriod(); // period 4 - await expect(tx) - .emit(stakingContract, 'PoolsUpdated') - .withArgs(period++, [poolAddr], [aRps], [500]); + await expect(tx).emit(stakingContract, 'PoolsUpdated').withArgs(period++, [poolAddr], [aRps], [500]); expect(await stakingContract.getReward(poolAddr, userA.address)).eq(1600); // 3/5 of 1000 + 1000 from the last period expect(await stakingContract.getReward(poolAddr, userB.address)).eq(400); // 2/5 of 1000 @@ -217,26 +213,18 @@ describe('Reward Calculation test', () => { aRps = aRps.add(0); await stakingContract.increaseReward(1000); tx = await stakingContract.endPeriod(); // period 7 - await expect(tx) - .emit(stakingContract, 'PoolsUpdated') - .withArgs(period++, [poolAddr], [aRps], [0]); + await expect(tx).emit(stakingContract, 'PoolsUpdated').withArgs(period++, [poolAddr], [aRps], [0]); expect(await stakingContract.getReward(poolAddr, userA.address)).eq(3100); expect(await stakingContract.getReward(poolAddr, userB.address)).eq(900); }); it('The rewards should be still when the pool has no reward for multi periods', async () => { tx = await stakingContract.endPeriod(); // period 8 - await expect(tx) - .emit(stakingContract, 'PoolsUpdated') - .withArgs(period++, [poolAddr], [aRps], [0]); + await expect(tx).emit(stakingContract, 'PoolsUpdated').withArgs(period++, [poolAddr], [aRps], [0]); tx = await stakingContract.endPeriod(); // period 9 - await expect(tx) - .emit(stakingContract, 'PoolsUpdated') - .withArgs(period++, [poolAddr], [aRps], [0]); + await expect(tx).emit(stakingContract, 'PoolsUpdated').withArgs(period++, [poolAddr], [aRps], [0]); tx = await stakingContract.endPeriod(); // period 10 - await expect(tx) - .emit(stakingContract, 'PoolsUpdated') - .withArgs(period++, [poolAddr], [aRps], [0]); + await expect(tx).emit(stakingContract, 'PoolsUpdated').withArgs(period++, [poolAddr], [aRps], [0]); expect(await stakingContract.getReward(poolAddr, userA.address)).eq(3100); expect(await stakingContract.getReward(poolAddr, userB.address)).eq(900); }); diff --git a/test/hardhat_test/staking/Staking.test.ts b/test/hardhat_test/staking/Staking.test.ts index 162fc214d..f275a6147 100644 --- a/test/hardhat_test/staking/Staking.test.ts +++ b/test/hardhat_test/staking/Staking.test.ts @@ -4,6 +4,8 @@ import { BigNumber, ContractTransaction } from 'ethers'; import { ethers, network } from 'hardhat'; import { + Profile, + Profile__factory, Staking, Staking__factory, TransparentUpgradeableProxyV2, @@ -16,7 +18,8 @@ import { createManyValidatorCandidateAddressSets, ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; -import { getLastBlockTimestamp } from '../helpers/utils'; +import { generateSamplePubkey, getLastBlockTimestamp } from '../helpers/utils'; +import { DEFAULT_ADDRESS } from '../../../src/utils'; let coinbase: SignerWithAddress; let deployer: SignerWithAddress; @@ -29,12 +32,16 @@ let otherPoolAddrSet: ValidatorCandidateAddressSet; let anotherActivePoolSet: ValidatorCandidateAddressSet; let sparePoolAddrSet: ValidatorCandidateAddressSet; -let proxyContract: TransparentUpgradeableProxyV2; +let stakingProxyContract: TransparentUpgradeableProxyV2; let validatorContract: MockValidatorSet; let stakingContract: Staking; +let profileContract: Profile; let signers: SignerWithAddress[]; let validatorCandidates: ValidatorCandidateAddressSet[]; +let snapshotId: string; +let snapshotId2: string; + const ONE_DAY = 60 * 60 * 24; const minValidatorStakingAmount = BigNumber.from(2_000_000); @@ -55,19 +62,31 @@ describe('Staking test', () => { const stakingVestingContract = await new StakingVesting__factory(deployer).deploy(); const nonce = await deployer.getTransactionCount(); - const stakingContractAddr = ethers.utils.getContractAddress({ from: deployer.address, nonce: nonce + 2 }); + const validatorContractAddr = ethers.utils.getContractAddress({ from: deployer.address, nonce: nonce + 2 }); + const stakingContractAddr = ethers.utils.getContractAddress({ from: deployer.address, nonce: nonce + 4 }); + + const profileLogicContract = await new Profile__factory(deployer).deploy(); + const profileContractProxy = await new TransparentUpgradeableProxyV2__factory(deployer).deploy( + profileLogicContract.address, + proxyAdmin.address, + profileLogicContract.interface.encodeFunctionData('initialize', [validatorContractAddr]) + ); + profileContract = Profile__factory.connect(profileContractProxy.address, deployer); + validatorContract = await new MockValidatorSet__factory(deployer).deploy( stakingContractAddr, ethers.constants.AddressZero, stakingVestingContract.address, + profileContract.address, maxValidatorCandidate, numberOfBlocksInEpoch, minEffectiveDaysOnwards ); await validatorContract.deployed(); + const logicContract = await new Staking__factory(deployer).deploy(); await logicContract.deployed(); - proxyContract = await new TransparentUpgradeableProxyV2__factory(deployer).deploy( + stakingProxyContract = await new TransparentUpgradeableProxyV2__factory(deployer).deploy( logicContract.address, proxyAdmin.address, logicContract.interface.encodeFunctionData('initialize', [ @@ -78,15 +97,35 @@ describe('Staking test', () => { waitingSecsToRevoke, ]) ); - await proxyContract.deployed(); - stakingContract = Staking__factory.connect(proxyContract.address, deployer); - expect(stakingContractAddr.toLowerCase()).eq(stakingContract.address.toLowerCase()); + await stakingProxyContract.deployed(); + + await stakingProxyContract + .connect(proxyAdmin) + .functionDelegateCall(logicContract.interface.encodeFunctionData('initializeV3', [profileContract.address])); + + await profileContract.initializeV2(stakingContractAddr, DEFAULT_ADDRESS); + + stakingContract = Staking__factory.connect(stakingProxyContract.address, deployer); + expect(validatorContractAddr.toLowerCase()).eq( + validatorContract.address.toLowerCase(), + 'wrong validator contract address' + ); + expect(stakingContractAddr.toLowerCase()).eq( + stakingContract.address.toLowerCase(), + 'wrong staking contract address' + ); }); describe('Validator candidate test', () => { it('Should not be able to propose validator with insufficient amount', async () => { await expect( - stakingContract.applyValidatorCandidate(userA.address, userA.address, userA.address, 1) + stakingContract.applyValidatorCandidate( + userA.address, + userA.address, + userA.address, + 1, + generateSamplePubkey(userA.address, userA.address) + ) ).revertedWithCustomError(stakingContract, 'ErrInsufficientStakingAmount'); }); @@ -99,8 +138,9 @@ describe('Staking test', () => { candidate.candidateAdmin.address, candidate.consensusAddr.address, candidate.consensusAddr.address, - 1, - /* 0.01% */ { value: minValidatorStakingAmount.mul(2) } + 1 /* 0.01% */, + generateSamplePubkey(), + { value: minValidatorStakingAmount.mul(2) } ); await expect(tx).revertedWithCustomError(stakingContract, 'ErrThreeInteractionAddrsNotEqual'); }); @@ -114,8 +154,9 @@ describe('Staking test', () => { candidate.candidateAdmin.address, candidate.consensusAddr.address, candidate.treasuryAddr.address, - 1, - /* 0.01% */ { value: minValidatorStakingAmount.mul(2) } + 1 /* 0.01% */, + generateSamplePubkey(), + { value: minValidatorStakingAmount.mul(2) } ); await expect(tx) .emit(stakingContract, 'PoolApproved') @@ -137,6 +178,7 @@ describe('Staking test', () => { poolAddrSet.consensusAddr.address, sparePoolAddrSet.treasuryAddr.address, 0, + generateSamplePubkey(), { value: minValidatorStakingAmount, } @@ -248,7 +290,7 @@ describe('Staking test', () => { minCommissionRate, maxCommissionRate, ]); - await proxyContract.connect(proxyAdmin).functionDelegateCall(data); + await stakingProxyContract.connect(proxyAdmin).functionDelegateCall(data); await expect( stakingContract @@ -263,7 +305,7 @@ describe('Staking test', () => { defaultMinCommissionRate, maxCommissionRate, ]); - await proxyContract.connect(proxyAdmin).functionDelegateCall(data); + await stakingProxyContract.connect(proxyAdmin).functionDelegateCall(data); }); it('Should the pool admin not be able to request updating the commission rate exceeding max rate', async () => { @@ -312,6 +354,7 @@ describe('Staking test', () => { }); it('Should be able to request renounce using pool admin', async () => { + snapshotId = await network.provider.send('evm_snapshot'); await stakingContract.connect(poolAddrSet.poolAdmin).requestRenounce(poolAddrSet.consensusAddr.address); }); @@ -332,32 +375,26 @@ describe('Staking test', () => { await expect(() => validatorContract.wrapUpEpoch()).changeEtherBalance(poolAddrSet.poolAdmin, stakingAmount); let _poolDetail = await stakingContract.getPoolDetail(poolAddrSet.consensusAddr.address); - expect(_poolDetail._stakingAmount).eq(0); + expect(_poolDetail.stakingAmount).eq(0); }); - it('Should the exited pool admin and consensus address rejoin as a candidate', async () => { - const tx = await stakingContract + it('Should the exited pool admin and consensus address cannot rejoin as a candidate', async () => { + const reApplyTx = stakingContract .connect(poolAddrSet.poolAdmin) .applyValidatorCandidate( poolAddrSet.candidateAdmin.address, poolAddrSet.consensusAddr.address, poolAddrSet.treasuryAddr.address, - 1, - /* 0.01% */ { value: minValidatorStakingAmount.mul(2) } + 1 /* 0.01% */, + generateSamplePubkey(), + { value: minValidatorStakingAmount.mul(2) } ); - await expect(tx) - .emit(stakingContract, 'PoolApproved') - .withArgs(poolAddrSet.consensusAddr.address, poolAddrSet.poolAdmin.address); - expect( - await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, poolAddrSet.candidateAdmin.address) - ).eq(minValidatorStakingAmount.mul(2)); - - expect(await stakingContract.getStakingTotal(poolAddrSet.consensusAddr.address)).gte( - minValidatorStakingAmount.mul(2) - ); // previous delegated amount still exist + await expect(reApplyTx).revertedWithCustomError(profileContract, 'ErrExistentProfile'); }); it('Should the a pool admin who is active cannot propose a new pool / cannot propose validator', async () => { + await network.provider.send('evm_revert', [snapshotId]); + await expect( stakingContract .connect(poolAddrSet.poolAdmin) @@ -365,13 +402,15 @@ describe('Staking test', () => { poolAddrSet.candidateAdmin.address, poolAddrSet.consensusAddr.address, poolAddrSet.treasuryAddr.address, - 1, - /* 0.01% */ { value: minValidatorStakingAmount.mul(2) } + 1 /* 0.01% */, + generateSamplePubkey(), + { value: minValidatorStakingAmount.mul(2) } ) ) .revertedWithCustomError(stakingContract, 'ErrAdminOfAnyActivePoolForbidden') .withArgs(poolAddrSet.poolAdmin.address); + snapshotId2 = await network.provider.send('evm_snapshot'); await stakingContract.connect(poolAddrSet.poolAdmin).requestRenounce(poolAddrSet.consensusAddr.address); await network.provider.send('evm_increaseTime', [waitingSecsToRevoke]); await validatorContract.wrapUpEpoch(); @@ -393,7 +432,7 @@ describe('Staking test', () => { it('Should not be able to delegate to a deprecated pool', async () => { await expect(stakingContract.delegate(poolAddrSet.consensusAddr.address, { value: 1 })) .revertedWithCustomError(stakingContract, 'ErrInactivePool') - .withArgs(poolAddrSet.consensusAddr.address); + .withArgs(poolAddrSet.consensusAddr.address, poolAddrSet.consensusAddr.address); }); it('Should not be able to delegate with empty value', async () => { @@ -483,27 +522,11 @@ describe('Staking test', () => { ); }); - it('[Validator Candidate] Should an ex-candidate to rejoin Staking contract', async () => { - await stakingContract - .connect(poolAddrSet.poolAdmin) - .applyValidatorCandidate( - poolAddrSet.candidateAdmin.address, - poolAddrSet.consensusAddr.address, - poolAddrSet.treasuryAddr.address, - 2, - /* 0.02% */ { value: minValidatorStakingAmount } - ); - expect(await stakingContract.getPoolDetail(poolAddrSet.consensusAddr.address)).deep.equal([ - poolAddrSet.poolAdmin.address, - minValidatorStakingAmount, - minValidatorStakingAmount.add(8), - ]); - expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, deployer.address)).eq(8); - }); - it('Should be able to delegate/undelegate for the rejoined candidate', async () => { + await network.provider.send('evm_revert', [snapshotId2]); + await stakingContract.delegate(poolAddrSet.consensusAddr.address, { value: 2 }); - expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, deployer.address)).eq(10); + expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, deployer.address)).eq(11); await stakingContract.connect(userA).delegate(poolAddrSet.consensusAddr.address, { value: 2 }); await stakingContract.connect(userB).delegate(poolAddrSet.consensusAddr.address, { value: 2 }); diff --git a/test/hardhat_test/validator/ArrangeValidators.test.ts b/test/hardhat_test/validator/ArrangeValidators.test.ts index 3cbac5ce7..af805bf00 100644 --- a/test/hardhat_test/validator/ArrangeValidators.test.ts +++ b/test/hardhat_test/validator/ArrangeValidators.test.ts @@ -14,12 +14,13 @@ import { RoninGovernanceAdmin, RoninGovernanceAdmin__factory, } from '../../../src/types'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { createManyTrustedOrganizationAddressSets, TrustedOrganizationAddressSet, } from '../helpers/address-set-types/trusted-org-set-type'; +import { initializeTestSuite } from '../helpers/initializer'; let validatorContract: MockRoninValidatorSetExtended; let slashIndicator: MockSlashIndicatorExtended; @@ -48,7 +49,7 @@ const setPriorityStatus = async (addrs: Address[], statuses: boolean[]): Promise addingTrustedOrgs.map(() => roninTrustedOrganization.address), addingTrustedOrgs.map((v) => roninTrustedOrganization.interface.encodeFunctionData('addTrustedOrganizations', [ - [{ consensusAddr: v, governor: v, bridgeVoter: v, weight: 100, addedBlock: 0 }], + [{ consensusAddr: v, governor: v, __deprecatedBridgeVoter: v, weight: 100, addedBlock: 0 }], ]) ) ); @@ -102,7 +103,10 @@ describe('Arrange validators', () => { validatorContractAddress, roninTrustedOrganizationAddress, roninGovernanceAdminAddress, - } = await initTest('ArrangeValidators')({ + fastFinalityTrackingAddress, + profileAddress, + stakingContractAddress, + } = await deployTestSuite('ArrangeValidators')({ slashIndicatorArguments: { unavailabilitySlashing: { slashAmountForUnavailabilityTier2Threshold, @@ -117,7 +121,7 @@ describe('Arrange validators', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -134,6 +138,17 @@ describe('Arrange validators', () => { ...trustedOrgs.map((_) => _.governor) ); + await initializeTestSuite({ + deployer, + profileAddress, + fastFinalityTrackingAddress, + slashContractAddress, + validatorContractAddress, + stakingContractAddress, + roninTrustedOrganizationAddress, + maintenanceContractAddress: undefined, + }); + const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); diff --git a/test/hardhat_test/validator/EmergencyExit.test.ts b/test/hardhat_test/validator/EmergencyExit.test.ts index 190ed1bb6..983a37130 100644 --- a/test/hardhat_test/validator/EmergencyExit.test.ts +++ b/test/hardhat_test/validator/EmergencyExit.test.ts @@ -16,8 +16,8 @@ import { StakingVesting, } from '../../../src/types'; import * as RoninValidatorSet from '../helpers/ronin-validator-set'; -import { mineBatchTxs } from '../helpers/utils'; -import { initTest } from '../helpers/fixture'; +import { generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { Address } from 'hardhat-deploy/dist/types'; import { @@ -29,6 +29,7 @@ import { ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; import { getEmergencyExitBallotHash } from '../../../src/script/proposal'; +import { initializeTestSuite } from '../helpers/initializer'; let roninValidatorSet: MockRoninValidatorSetExtended; let stakingVesting: StakingVesting; @@ -82,8 +83,10 @@ describe('Emergency Exit test', () => { stakingContractAddress, roninGovernanceAdminAddress, stakingVestingContractAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('EmergencyExit')({ + roninTrustedOrganizationAddress + } = await deployTestSuite('EmergencyExit')({ slashIndicatorArguments: { doubleSignSlashing: { slashDoubleSignAmount, @@ -106,13 +109,24 @@ describe('Emergency Exit test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), }, }); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + maintenanceContractAddress: undefined, + }); + roninValidatorSet = MockRoninValidatorSetExtended__factory.connect(validatorContractAddress, deployer); stakingVesting = StakingVesting__factory.connect(stakingVestingContractAddress, deployer); slashIndicator = MockSlashIndicatorExtended__factory.connect(slashContractAddress, deployer); @@ -129,7 +143,6 @@ describe('Emergency Exit test', () => { await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(roninValidatorSet.address, mockValidatorLogic.address); await roninValidatorSet.initEpoch(); - await roninValidatorSet.initializeV3(fastFinalityTrackingAddress); const mockSlashIndicator = await new MockSlashIndicatorExtended__factory(deployer).deploy(); await mockSlashIndicator.deployed(); @@ -146,6 +159,7 @@ describe('Emergency Exit test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: stakedAmount[i], } diff --git a/test/hardhat_test/validator/RoninValidatorSet-Candidate.test.ts b/test/hardhat_test/validator/RoninValidatorSet-Candidate.test.ts index dfefd5db1..09df2da93 100644 --- a/test/hardhat_test/validator/RoninValidatorSet-Candidate.test.ts +++ b/test/hardhat_test/validator/RoninValidatorSet-Candidate.test.ts @@ -17,8 +17,8 @@ import { TransparentUpgradeableProxyV2__factory, } from '../../../src/types'; import * as RoninValidatorSet from '../helpers/ronin-validator-set'; -import { getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; -import { defaultTestConfig, initTest } from '../helpers/fixture'; +import { generateSamplePubkey, getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; +import { defaultTestConfig, deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { Address } from 'hardhat-deploy/dist/types'; import { @@ -35,6 +35,7 @@ import { WhitelistedCandidateAddressSet, mergeToManyWhitelistedCandidateAddressSets, } from '../helpers/address-set-types/whitelisted-candidate-set-type'; +import { initializeTestSuite } from '../helpers/initializer'; let roninValidatorSet: MockRoninValidatorSetExtended; let stakingVesting: StakingVesting; @@ -94,8 +95,10 @@ describe('Ronin Validator Set: candidate test', () => { stakingContractAddress, roninGovernanceAdminAddress, stakingVestingContractAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('RoninValidatorSet-Candidate')({ + roninTrustedOrganizationAddress + } = await deployTestSuite('RoninValidatorSet-Candidate')({ slashIndicatorArguments: { doubleSignSlashing: { slashDoubleSignAmount, @@ -122,13 +125,24 @@ describe('Ronin Validator Set: candidate test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), }, }); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + maintenanceContractAddress: undefined, + }); + roninValidatorSet = MockRoninValidatorSetExtended__factory.connect(validatorContractAddress, deployer); stakingVesting = StakingVesting__factory.connect(stakingVestingContractAddress, deployer); slashIndicator = MockSlashIndicatorExtended__factory.connect(slashContractAddress, deployer); @@ -145,7 +159,6 @@ describe('Ronin Validator Set: candidate test', () => { await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(roninValidatorSet.address, mockValidatorLogic.address); await roninValidatorSet.initEpoch(); - await roninValidatorSet.initializeV3(fastFinalityTrackingAddress); const mockSlashIndicator = await new MockSlashIndicatorExtended__factory(deployer).deploy(); await mockSlashIndicator.deployed(); @@ -167,6 +180,7 @@ describe('Ronin Validator Set: candidate test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.add(i), } @@ -203,6 +217,7 @@ describe('Ronin Validator Set: candidate test', () => { whitelistedCandidates[i].consensusAddr.address, whitelistedCandidates[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.add(i), } @@ -241,6 +256,7 @@ describe('Ronin Validator Set: candidate test', () => { validatorCandidates[4].consensusAddr.address, validatorCandidates[4].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount, } @@ -259,6 +275,7 @@ describe('Ronin Validator Set: candidate test', () => { validatorCandidates[5].consensusAddr.address, validatorCandidates[5].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount, } @@ -275,6 +292,7 @@ describe('Ronin Validator Set: candidate test', () => { validatorCandidates[5].consensusAddr.address, validatorCandidates[0].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount, } @@ -291,6 +309,7 @@ describe('Ronin Validator Set: candidate test', () => { validatorCandidates[5].consensusAddr.address, validatorCandidates[5].treasuryAddr.address, maxCommissionRate + 1, + generateSamplePubkey(), { value: minValidatorStakingAmount, } @@ -325,6 +344,7 @@ describe('Ronin Validator Set: candidate test', () => { validatorCandidates[5].consensusAddr.address, validatorCandidates[5].treasuryAddr.address, minCommissionRate - 1, + generateSamplePubkey(), { value: minValidatorStakingAmount, } diff --git a/test/hardhat_test/validator/RoninValidatorSet-CoinbaseExecution.test.ts b/test/hardhat_test/validator/RoninValidatorSet-CoinbaseExecution.test.ts index 521d422ad..6475f59d2 100644 --- a/test/hardhat_test/validator/RoninValidatorSet-CoinbaseExecution.test.ts +++ b/test/hardhat_test/validator/RoninValidatorSet-CoinbaseExecution.test.ts @@ -14,13 +14,15 @@ import { RoninGovernanceAdmin, StakingVesting__factory, StakingVesting, + Profile, + Profile__factory, } from '../../../src/types'; import { EpochController } from '../helpers/ronin-validator-set'; import { expects as RoninValidatorSetExpects } from '../helpers/ronin-validator-set'; import { expects as CandidateManagerExpects } from '../helpers/candidate-manager'; import { expects as StakingVestingExpects } from '../helpers/staking-vesting'; -import { getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; -import { initTest } from '../helpers/fixture'; +import { ContractType, generateSamplePubkey, getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { BlockRewardDeprecatedType } from '../../../src/script/ronin-validator-set'; import { Address } from 'hardhat-deploy/dist/types'; @@ -35,11 +37,13 @@ import { import { SlashType } from '../../../src/script/slash-indicator'; import { ProposalDetailStruct } from '../../../src/types/GovernanceAdmin'; import { VoteType } from '../../../src/script/proposal'; +import { initializeTestSuite } from '../helpers/initializer'; let roninValidatorSet: MockRoninValidatorSetExtended; let stakingVesting: StakingVesting; let stakingContract: Staking; let slashIndicator: MockSlashIndicatorExtended; +let profileContract: Profile; let governanceAdmin: RoninGovernanceAdmin; let governanceAdminInterface: GovernanceAdminInterface; @@ -93,8 +97,10 @@ describe('Ronin Validator Set: Coinbase execution test', () => { stakingContractAddress, roninGovernanceAdminAddress, stakingVestingContractAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('RoninValidatorSet-Coinbase')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('RoninValidatorSet-Coinbase')({ slashIndicatorArguments: { doubleSignSlashing: { slashDoubleSignAmount, @@ -120,7 +126,7 @@ describe('Ronin Validator Set: Coinbase execution test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -130,10 +136,22 @@ describe('Ronin Validator Set: Coinbase execution test', () => { }, }); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + roninTrustedOrganizationAddress, + maintenanceContractAddress: undefined, + }); + roninValidatorSet = MockRoninValidatorSetExtended__factory.connect(validatorContractAddress, deployer); stakingVesting = StakingVesting__factory.connect(stakingVestingContractAddress, deployer); slashIndicator = MockSlashIndicatorExtended__factory.connect(slashContractAddress, deployer); stakingContract = Staking__factory.connect(stakingContractAddress, deployer); + profileContract = Profile__factory.connect(profileAddress, deployer); governanceAdmin = RoninGovernanceAdmin__factory.connect(roninGovernanceAdminAddress, deployer); governanceAdminInterface = new GovernanceAdminInterface( governanceAdmin, @@ -146,7 +164,6 @@ describe('Ronin Validator Set: Coinbase execution test', () => { await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(roninValidatorSet.address, mockValidatorLogic.address); await roninValidatorSet.initEpoch(); - await roninValidatorSet.initializeV3(fastFinalityTrackingAddress); const mockSlashIndicator = await new MockSlashIndicatorExtended__factory(deployer).deploy(); await mockSlashIndicator.deployed(); @@ -157,6 +174,24 @@ describe('Ronin Validator Set: Coinbase execution test', () => { await network.provider.send('hardhat_setCoinbase', [ethers.constants.AddressZero]); }); + describe('Configuration checks', async () => { + it('Should the StakingContract contract set configs correctly', async () => { + expect(await stakingContract.getContract(ContractType.VALIDATOR)).to.eq(roninValidatorSet.address); + expect(await stakingContract.getContract(ContractType.PROFILE)).to.eq(profileContract.address); + }); + + it('Should the ValidatorSetContract contract set configs correctly', async () => { + expect(await roninValidatorSet.getContract(ContractType.SLASH_INDICATOR)).to.eq(slashIndicator.address); + expect(await roninValidatorSet.getContract(ContractType.STAKING)).to.eq(stakingContract.address); + expect(await roninValidatorSet.getContract(ContractType.PROFILE)).to.eq(profileContract.address); + }); + + it('Should the SlashIndicatorContract contract set configs correctly', async () => { + expect(await slashIndicator.getContract(ContractType.VALIDATOR)).to.eq(roninValidatorSet.address); + expect(await slashIndicator.getContract(ContractType.PROFILE)).to.eq(profileContract.address); + }); + }); + describe('Wrapping up epoch sanity check', async () => { it('Should not be able to wrap up epoch using unauthorized account', async () => { await expect(roninValidatorSet.connect(deployer).wrapUpEpoch()).revertedWithCustomError( @@ -198,6 +233,7 @@ describe('Ronin Validator Set: Coinbase execution test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.add(i * dummyStakingMultiplier), } @@ -257,9 +293,16 @@ describe('Ronin Validator Set: Coinbase execution test', () => { it('Should be able to wrap up epoch at the end of period and pick top `maxValidatorNumber` to be validators', async () => { await stakingContract .connect(poolAdmin) - .applyValidatorCandidate(candidateAdmin.address, consensusAddr.address, treasury.address, 1_00 /* 1% */, { - value: minValidatorStakingAmount.mul(100), - }); + .applyValidatorCandidate( + candidateAdmin.address, + consensusAddr.address, + treasury.address, + 1_00 /* 1% */, + generateSamplePubkey(), + { + value: minValidatorStakingAmount.mul(100), + } + ); for (let i = 4; i < localValidatorCandidatesLength; i++) { await stakingContract .connect(validatorCandidates[i].poolAdmin) @@ -268,6 +311,7 @@ describe('Ronin Validator Set: Coinbase execution test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 2_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.add(i * dummyStakingMultiplier), } @@ -626,6 +670,10 @@ describe('Ronin Validator Set: Coinbase execution test', () => { let tx: ContractTransaction; const balance = await treasury.getBalance(); await slashIndicator.slashMisdemeanor(consensusAddr.address); + // for (let i = 0; i < 50; i++) { + // await slashIndicator.connect(validatorCandidates[2].consensusAddr).slashUnavailability(consensusAddr.address); + // } + tx = await roninValidatorSet.connect(consensusAddr).submitBlockReward({ value: 100 }); await expect(tx) .to.emit(roninValidatorSet, 'BlockRewardDeprecated') @@ -694,6 +742,7 @@ describe('Ronin Validator Set: Coinbase execution test', () => { /// --- let slashTx; + await expect( async () => (slashTx = await governanceAdmin diff --git a/test/hardhat_test/validator/RoninValidatorSet-FastFinality.test.ts b/test/hardhat_test/validator/RoninValidatorSet-FastFinality.test.ts index 625b992a7..c11e36afe 100644 --- a/test/hardhat_test/validator/RoninValidatorSet-FastFinality.test.ts +++ b/test/hardhat_test/validator/RoninValidatorSet-FastFinality.test.ts @@ -18,7 +18,7 @@ import { FastFinalityTracking, } from '../../../src/types'; import { EpochController } from '../helpers/ronin-validator-set'; -import { initTest } from '../helpers/fixture'; +import { deployTestSuite } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../../src/script/governance-admin-interface'; import { createManyTrustedOrganizationAddressSets, @@ -29,7 +29,8 @@ import { ValidatorCandidateAddressSet, } from '../helpers/address-set-types/validator-candidate-set-type'; import { anyValue } from '@nomicfoundation/hardhat-chai-matchers/withArgs'; -import { mineBatchTxs } from '../helpers/utils'; +import { generateSamplePubkey, mineBatchTxs } from '../helpers/utils'; +import { initializeTestSuite } from '../helpers/initializer'; let validatorContract: MockRoninValidatorSetExtended; let stakingVesting: StakingVesting; @@ -76,8 +77,10 @@ describe('Ronin Validator Set: Fast Finality test', () => { stakingContractAddress, roninGovernanceAdminAddress, stakingVestingContractAddress, + profileAddress, fastFinalityTrackingAddress, - } = await initTest('RoninValidatorSet-FastFinality')({ + roninTrustedOrganizationAddress, + } = await deployTestSuite('RoninValidatorSet-FastFinality')({ slashIndicatorArguments: { doubleSignSlashing: { slashDoubleSignAmount, @@ -105,7 +108,7 @@ describe('Ronin Validator Set: Fast Finality test', () => { trustedOrganizations: trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, - bridgeVoter: v.bridgeVoter.address, + __deprecatedBridgeVoter: v.__deprecatedBridgeVoter.address, weight: 100, addedBlock: 0, })), @@ -131,6 +134,21 @@ describe('Ronin Validator Set: Fast Finality test', () => { ...trustedOrgs.map((_) => _.governor) ); + await initializeTestSuite({ + deployer, + fastFinalityTrackingAddress, + profileAddress, + slashContractAddress, + stakingContractAddress, + validatorContractAddress, + maintenanceContractAddress: undefined, + stakingVestingAddress: stakingVestingContractAddress, + stakingVestingArgs: { + fastFinalityRewardPercent, + }, + roninTrustedOrganizationAddress, + }); + const mockValidatorLogic = await new MockRoninValidatorSetExtended__factory(deployer).deploy(); await mockValidatorLogic.deployed(); await governanceAdminInterface.upgrade(validatorContract.address, mockValidatorLogic.address); @@ -140,9 +158,6 @@ describe('Ronin Validator Set: Fast Finality test', () => { await mockSlashIndicator.deployed(); await governanceAdminInterface.upgrade(slashIndicator.address, mockSlashIndicator.address); - await validatorContract.initializeV3(fastFinalityTrackingAddress); - await stakingVesting.initializeV3(fastFinalityRewardPercent); - validatorCandidates = validatorCandidates.slice(0, maxValidatorNumber); for (let i = 0; i < maxValidatorNumber; i++) { await stakingContract @@ -152,6 +167,7 @@ describe('Ronin Validator Set: Fast Finality test', () => { validatorCandidates[i].consensusAddr.address, validatorCandidates[i].treasuryAddr.address, 100_00, + generateSamplePubkey(), { value: minValidatorStakingAmount.mul(2).add(maxValidatorNumber).sub(i) } ); } diff --git a/upload-sig.sh b/upload-sig.sh new file mode 100755 index 000000000..3d0894d26 --- /dev/null +++ b/upload-sig.sh @@ -0,0 +1,71 @@ +# Default network value +networkName="ronin-testnet" +# Function to print usage and exit +usage() { + echo "Usage: $0 -c " + echo " -c: Specify the network (ronin-testnet or ronin-mainnet)" + exit 1 +} +# Parse command-line options +while getopts "c:" opt; do + case $opt in + c) + case "$OPTARG" in + ronin-testnet) + child_folder="ronin-testnet" + networkName="ronin-testnet" + ;; + ronin-mainnet) + child_folder="ronin-mainnet" + networkName="ronin-mainnet" + ;; + *) + echo "Unknown network specified: $OPTARG" + usage + ;; + esac + ;; + *) + usage + ;; + esac +done +# Shift the processed options out of the argument list +shift $((OPTIND - 1)) +# Define the deployments folder by concatenating it with the child folder +folder="deployments/$child_folder" +# Check if the specified folder exists +if [ ! -d "$folder" ]; then + echo "Error: The specified folder does not exist for the selected network." + exit 1 +fi +for file in "$folder"/*.json; do + # Check if the file exists and is a regular file + if [ -f "$file" ] && [ "$(basename "$file")" != ".chainId" ]; then + # Extract contractName and address from the JSON file + contractName=$(jq -r '.contractName' "$file") + # Check if contractName and address are not empty + if [ -n "$contractName" ]; then + # Initialize arrays to store events and errors keys + events_keys=() + errors_keys=() + # Get events and errors JSON data + events=$(forge inspect $contractName events) + errors=$(forge inspect $contractName errors) + # Extract keys and populate the arrays + while read -r key; do + events_keys+=("\"event $key\"") + done <<<"$(echo "$events" | jq -r 'keys[]')" + while read -r key; do + errors_keys+=("\"$key\"") + done <<<"$(echo "$errors" | jq -r 'keys[]')" + # Combine keys from events and errors + all_keys=("${events_keys[@]}" "${errors_keys[@]}") + # Call cast upload-signature + cast upload-signature "${all_keys[@]}" + else + echo "Error: Missing contractName or address in $file" + fi + fi +done +forge selectors upload --all