Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 25 from a total of 1,226 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Submit Report | 2144831 | 113 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2144829 | 113 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2144482 | 113 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2144478 | 113 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2144143 | 113 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2144140 | 113 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2143785 | 113 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2143785 | 113 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2143435 | 113 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2143433 | 113 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2143106 | 114 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2143099 | 114 days ago | IN | 0 ETH | 0.00007521 | ||||
Submit Report | 2142767 | 114 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2142757 | 114 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2142426 | 114 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2142425 | 114 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2142091 | 114 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2142091 | 114 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2141749 | 114 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2141748 | 114 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2141411 | 114 days ago | IN | 0 ETH | 0.00000489 | ||||
Submit Report | 2141411 | 114 days ago | IN | 0 ETH | 0.00000376 | ||||
Submit Report | 2141069 | 114 days ago | IN | 0 ETH | 0.00009794 | ||||
Submit Report | 2141069 | 114 days ago | IN | 0 ETH | 0.00007521 | ||||
Submit Report | 2140756 | 114 days ago | IN | 0 ETH | 0.00000489 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x78677908...d8DC78c53 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
HashConsensus
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; import { SafeCast } from "@openzeppelin/contracts-v4.4/utils/math/SafeCast.sol"; import { Math } from "../lib/Math.sol"; import { AccessControlEnumerable } from "../utils/access/AccessControlEnumerable.sol"; /// @notice A contract that gets consensus reports (i.e. hashes) pushed to and processes them /// asynchronously. /// /// HashConsensus doesn't expect any specific behavior from a report processor, and guarantees /// the following: /// /// 1. HashConsensus won't submit reports via `IReportAsyncProcessor.submitConsensusReport` or ask /// to discard reports via `IReportAsyncProcessor.discardConsensusReport` for any slot up to (and /// including) the slot returned from `IReportAsyncProcessor.getLastProcessingRefSlot`. /// /// 2. HashConsensus won't accept member reports (and thus won't include such reports in calculating /// the consensus) that have `consensusVersion` argument of the `HashConsensus.submitReport` call /// holding a diff. value than the one returned from `IReportAsyncProcessor.getConsensusVersion()` /// at the moment of the `HashConsensus.submitReport` call. /// interface IReportAsyncProcessor { /// @notice Submits a consensus report for processing. /// /// Note that submitting the report doesn't require the processor to start processing it right /// away, this can happen later (see `getLastProcessingRefSlot`). Until processing is started, /// HashConsensus is free to reach consensus on another report for the same reporting frame an /// submit it using this same function, or to lose the consensus on the submitted report, /// notifying the processor via `discardConsensusReport`. /// function submitConsensusReport(bytes32 report, uint256 refSlot, uint256 deadline) external; /// @notice Notifies that the report for the given ref. slot is not a conensus report anymore /// and should be discarded. This can happen when a member changes their report, is removed /// from the set, or when the quorum value gets increased. /// /// Only called when, for the given reference slot: /// /// 1. there previously was a consensus report; AND /// 1. processing of the consensus report hasn't started yet; AND /// 2. report processing deadline is not expired yet; AND /// 3. there's no consensus report now (otherwise, `submitConsensusReport` is called instead). /// /// Can be called even when there's no submitted non-discarded consensus report for the current /// reference slot, i.e. can be called multiple times in succession. /// function discardConsensusReport(uint256 refSlot) external; /// @notice Returns the last reference slot for which processing of the report was started. /// /// HashConsensus won't submit reports for any slot less than or equal to this slot. /// function getLastProcessingRefSlot() external view returns (uint256); /// @notice Returns the current consensus version. /// /// Consensus version must change every time consensus rules change, meaning that /// an oracle looking at the same reference slot would calculate a different hash. /// /// HashConsensus won't accept member reports any consensus version different form the /// one returned from this function. /// function getConsensusVersion() external view returns (uint256); } /// @notice A contract managing oracle members committee and allowing the members to reach /// consensus on a hash for each reporting frame. /// /// Time is divided in frames of equal length, each having reference slot and processing /// deadline. Report data must be gathered by looking at the world state at the moment of /// the frame's reference slot (including any state changes made in that slot), and must /// be processed before the frame's processing deadline. /// /// Frame length is defined in Ethereum consensus layer epochs. Reference slot for each /// frame is set to the last slot of the epoch preceding the frame's first epoch. The /// processing deadline is set to the last slot of the last epoch of the frame. /// /// This means that all state changes a report processing could entail are guaranteed to be /// observed while gathering data for the next frame's report. This is an important property /// given that oracle reports sometimes have to contain diffs instead of the full state which /// might be impractical or even impossible to transmit and process. /// contract HashConsensus is AccessControlEnumerable { using SafeCast for uint256; error InvalidChainConfig(); error NumericOverflow(); error AdminCannotBeZero(); error ReportProcessorCannotBeZero(); error DuplicateMember(); error AddressCannotBeZero(); error InitialEpochIsYetToArrive(); error InitialEpochAlreadyArrived(); error InitialEpochRefSlotCannotBeEarlierThanProcessingSlot(); error EpochsPerFrameCannotBeZero(); error NonMember(); error UnexpectedConsensusVersion(uint256 expected, uint256 received); error QuorumTooSmall(uint256 minQuorum, uint256 receivedQuorum); error InvalidSlot(); error DuplicateReport(); error EmptyReport(); error StaleReport(); error NonFastLaneMemberCannotReportWithinFastLaneInterval(); error NewProcessorCannotBeTheSame(); error ConsensusReportAlreadyProcessing(); error FastLanePeriodCannotBeLongerThanFrame(); event FrameConfigSet(uint256 newInitialEpoch, uint256 newEpochsPerFrame); event FastLaneConfigSet(uint256 fastLaneLengthSlots); event MemberAdded(address indexed addr, uint256 newTotalMembers, uint256 newQuorum); event MemberRemoved(address indexed addr, uint256 newTotalMembers, uint256 newQuorum); event QuorumSet(uint256 newQuorum, uint256 totalMembers, uint256 prevQuorum); event ReportReceived(uint256 indexed refSlot, address indexed member, bytes32 report); event ConsensusReached(uint256 indexed refSlot, bytes32 report, uint256 support); event ConsensusLost(uint256 indexed refSlot); event ReportProcessorSet(address indexed processor, address indexed prevProcessor); struct FrameConfig { uint64 initialEpoch; uint64 epochsPerFrame; uint64 fastLaneLengthSlots; } /// @dev Oracle reporting is divided into frames, each lasting the same number of slots. /// /// The start slot of the next frame is always the next slot after the end slot of the previous /// frame. /// /// Each frame also has a reference slot: if the oracle report contains any data derived from /// onchain data, the onchain data should be sampled at the reference slot. /// struct ConsensusFrame { // frame index; increments by 1 with each frame but resets to zero on frame size change uint256 index; // the slot at which to read the state around which consensus is being reached; // if the slot contains a block, the state should include all changes from that block uint256 refSlot; // the last slot at which a report can be reported and processed uint256 reportProcessingDeadlineSlot; } struct ReportingState { // the last reference slot any report was received for uint64 lastReportRefSlot; // the last reference slot a consensus was reached for uint64 lastConsensusRefSlot; // the last consensus variant index uint64 lastConsensusVariantIndex; } struct MemberState { // the last reference slot a report from this member was received for uint64 lastReportRefSlot; // the variant index of the last report from this member uint64 lastReportVariantIndex; } struct ReportVariant { // the reported hash bytes32 hash; // how many unique members from the current set reported this hash in the current frame uint64 support; } /// @notice An ACL role granting the permission to modify members list members and /// change the quorum by calling addMember, removeMember, and setQuorum functions. bytes32 public constant MANAGE_MEMBERS_AND_QUORUM_ROLE = keccak256("MANAGE_MEMBERS_AND_QUORUM_ROLE"); /// @notice An ACL role granting the permission to disable the consensus by calling /// the disableConsensus function. Enabling the consensus back requires the possession /// of the MANAGE_QUORUM_ROLE. bytes32 public constant DISABLE_CONSENSUS_ROLE = keccak256("DISABLE_CONSENSUS_ROLE"); /// @notice An ACL role granting the permission to change reporting interval duration /// and fast lane reporting interval length by calling setFrameConfig. bytes32 public constant MANAGE_FRAME_CONFIG_ROLE = keccak256("MANAGE_FRAME_CONFIG_ROLE"); /// @notice An ACL role granting the permission to change fast lane reporting interval /// length by calling setFastLaneLengthSlots. bytes32 public constant MANAGE_FAST_LANE_CONFIG_ROLE = keccak256("MANAGE_FAST_LANE_CONFIG_ROLE"); /// @notice An ACL role granting the permission to change еру report processor /// contract by calling setReportProcessor. bytes32 public constant MANAGE_REPORT_PROCESSOR_ROLE = keccak256("MANAGE_REPORT_PROCESSOR_ROLE"); /// Chain specification uint64 internal immutable SLOTS_PER_EPOCH; uint64 internal immutable SECONDS_PER_SLOT; uint64 internal immutable GENESIS_TIME; /// @dev A quorum value that effectively disables the oracle. uint256 internal constant UNREACHABLE_QUORUM = type(uint256).max; bytes32 internal constant ZERO_HASH = bytes32(0); /// @dev An offset from the processing deadline slot of the previous frame (i.e. the last slot /// at which a report for the prev. frame can be submitted and its processing started) to the /// reference slot of the next frame (equal to the last slot of the previous frame). /// frame[i].reportProcessingDeadlineSlot := frame[i + 1].refSlot - DEADLINE_SLOT_OFFSET uint256 internal constant DEADLINE_SLOT_OFFSET = 0; /// @dev Reporting frame configuration FrameConfig internal _frameConfig; /// @dev Oracle committee members states array MemberState[] internal _memberStates; /// @dev Oracle committee members' addresses array address[] internal _memberAddresses; /// @dev Mapping from an oracle committee member address to the 1-based index in the /// members array mapping(address => uint256) internal _memberIndices1b; /// @dev A structure containing the last reference slot any report was received for, the last /// reference slot consensus report was achieved for, and the last consensus variant index ReportingState internal _reportingState; /// @dev Oracle committee members quorum value, must be larger than totalMembers // 2 uint256 internal _quorum; /// @dev Mapping from a report variant index to the ReportVariant structure mapping(uint256 => ReportVariant) internal _reportVariants; /// @dev The number of report variants uint256 internal _reportVariantsLength; /// @dev The address of the report processor contract address internal _reportProcessor; /// /// Initialization /// constructor( uint256 slotsPerEpoch, uint256 secondsPerSlot, uint256 genesisTime, uint256 epochsPerFrame, uint256 fastLaneLengthSlots, address admin, address reportProcessor ) { if (slotsPerEpoch == 0) revert InvalidChainConfig(); if (secondsPerSlot == 0) revert InvalidChainConfig(); SLOTS_PER_EPOCH = slotsPerEpoch.toUint64(); SECONDS_PER_SLOT = secondsPerSlot.toUint64(); GENESIS_TIME = genesisTime.toUint64(); if (admin == address(0)) revert AdminCannotBeZero(); if (reportProcessor == address(0)) revert ReportProcessorCannotBeZero(); _setupRole(DEFAULT_ADMIN_ROLE, admin); uint256 farFutureEpoch = _computeEpochAtTimestamp(type(uint64).max); _setFrameConfig(farFutureEpoch, epochsPerFrame, fastLaneLengthSlots, FrameConfig(0, 0, 0)); _reportProcessor = reportProcessor; } /// /// Time /// /// @notice Returns the immutable chain parameters required to calculate epoch and slot /// given a timestamp. /// function getChainConfig() external view returns ( uint256 slotsPerEpoch, uint256 secondsPerSlot, uint256 genesisTime ) { return (SLOTS_PER_EPOCH, SECONDS_PER_SLOT, GENESIS_TIME); } /// @notice Returns the time-related configuration. /// /// @return initialEpoch Epoch of the frame with zero index. /// @return epochsPerFrame Length of a frame in epochs. /// @return fastLaneLengthSlots Length of the fast lane interval in slots; see `getIsFastLaneMember`. /// function getFrameConfig() external view returns ( uint256 initialEpoch, uint256 epochsPerFrame, uint256 fastLaneLengthSlots ) { FrameConfig memory config = _frameConfig; return (config.initialEpoch, config.epochsPerFrame, config.fastLaneLengthSlots); } /// @notice Returns the current reporting frame. /// /// @return refSlot The frame's reference slot: if the data the consensus is being reached upon /// includes or depends on any onchain state, this state should be queried at the /// reference slot. If the slot contains a block, the state should include all changes /// from that block. /// /// @return reportProcessingDeadlineSlot The last slot at which the report can be processed by /// the report processor contract. /// function getCurrentFrame() external view returns ( uint256 refSlot, uint256 reportProcessingDeadlineSlot ) { ConsensusFrame memory frame = _getCurrentFrame(); return (frame.refSlot, frame.reportProcessingDeadlineSlot); } /// @notice Returns the earliest possible reference slot, i.e. the reference slot of the /// reporting frame with zero index. /// function getInitialRefSlot() external view returns (uint256) { return _getInitialFrame().refSlot; } /// @notice Sets a new initial epoch given that the current initial epoch is in the future. /// /// @param initialEpoch The new initial epoch. /// function updateInitialEpoch(uint256 initialEpoch) external onlyRole(DEFAULT_ADMIN_ROLE) { FrameConfig memory prevConfig = _frameConfig; if (_computeEpochAtTimestamp(_getTime()) >= prevConfig.initialEpoch) { revert InitialEpochAlreadyArrived(); } _setFrameConfig( initialEpoch, prevConfig.epochsPerFrame, prevConfig.fastLaneLengthSlots, prevConfig ); if (_getInitialFrame().refSlot < _getLastProcessingRefSlot()) { revert InitialEpochRefSlotCannotBeEarlierThanProcessingSlot(); } } /// @notice Updates the time-related configuration. /// /// @param epochsPerFrame Length of a frame in epochs. /// @param fastLaneLengthSlots Length of the fast lane interval in slots; see `getIsFastLaneMember`. /// function setFrameConfig(uint256 epochsPerFrame, uint256 fastLaneLengthSlots) external onlyRole(MANAGE_FRAME_CONFIG_ROLE) { // Updates epochsPerFrame in a way that either keeps the current reference slot the same // or increases it by at least the minimum of old and new frame sizes. uint256 timestamp = _getTime(); uint256 currentFrameStartEpoch = _computeFrameStartEpoch(timestamp, _frameConfig); _setFrameConfig(currentFrameStartEpoch, epochsPerFrame, fastLaneLengthSlots, _frameConfig); } /// /// Members /// /// @notice Returns whether the given address is currently a member of the consensus. /// function getIsMember(address addr) external view returns (bool) { return _isMember(addr); } /// @notice Returns whether the given address is a fast lane member for the current reporting /// frame. /// /// Fast lane members is a subset of all members that changes each reporting frame. These /// members can, and are expected to, submit a report during the first part of the frame called /// the "fast lane interval" and defined via `setFrameConfig` or `setFastLaneLengthSlots`. Under /// regular circumstances, all other members are only allowed to submit a report after the fast /// lane interval passes. /// /// The fast lane subset consists of `quorum` members; selection is implemented as a sliding /// window of the `quorum` width over member indices (mod total members). The window advances /// by one index each reporting frame. /// /// This is done to encourage each member from the full set to participate in reporting on a /// regular basis, and identify any malfunctioning members. /// /// With the fast lane mechanism active, it's sufficient for the monitoring to check that /// consensus is consistently reached during the fast lane part of each frame to conclude that /// all members are active and share the same consensus rules. /// /// However, there is no guarantee that, at any given time, it holds true that only the current /// fast lane members can or were able to report during the currently-configured fast lane /// interval of the current frame. In particular, this assumption can be violated in any frame /// during which the members set, initial epoch, or the quorum number was changed, or the fast /// lane interval length was increased. Thus, the fast lane mechanism should not be used for any /// purpose other than monitoring of the members liveness, and monitoring tools should take into /// consideration the potential irregularities within frames with any configuration changes. /// function getIsFastLaneMember(address addr) external view returns (bool) { uint256 index1b = _memberIndices1b[addr]; unchecked { return index1b > 0 && _isFastLaneMember(index1b - 1, _getCurrentFrame().index); } } /// @notice Returns all current members, together with the last reference slot each member /// submitted a report for. /// function getMembers() external view returns ( address[] memory addresses, uint256[] memory lastReportedRefSlots ) { return _getMembers(false); } /// @notice Returns the subset of the oracle committee members (consisting of `quorum` items) /// that changes each frame. /// /// See `getIsFastLaneMember`. /// function getFastLaneMembers() external view returns ( address[] memory addresses, uint256[] memory lastReportedRefSlots ) { return _getMembers(true); } /// @notice Sets the duration of the fast lane interval of the reporting frame. /// /// See `getIsFastLaneMember`. /// /// @param fastLaneLengthSlots The length of the fast lane reporting interval in slots. Setting /// it to zero disables the fast lane subset, allowing any oracle to report starting from /// the first slot of a frame and until the frame's reporting deadline. /// function setFastLaneLengthSlots(uint256 fastLaneLengthSlots) external onlyRole(MANAGE_FAST_LANE_CONFIG_ROLE) { _setFastLaneLengthSlots(fastLaneLengthSlots); } function addMember(address addr, uint256 quorum) external onlyRole(MANAGE_MEMBERS_AND_QUORUM_ROLE) { _addMember(addr, quorum); } function removeMember(address addr, uint256 quorum) external onlyRole(MANAGE_MEMBERS_AND_QUORUM_ROLE) { _removeMember(addr, quorum); } function getQuorum() external view returns (uint256) { return _quorum; } function setQuorum(uint256 quorum) external { // access control is performed inside the next call _setQuorumAndCheckConsensus(quorum, _memberStates.length); } /// @notice Disables the oracle by setting the quorum to an unreachable value. /// function disableConsensus() external { // access control is performed inside the next call _setQuorumAndCheckConsensus(UNREACHABLE_QUORUM, _memberStates.length); } /// /// Report processor /// function getReportProcessor() external view returns (address) { return _reportProcessor; } function setReportProcessor(address newProcessor) external onlyRole(MANAGE_REPORT_PROCESSOR_ROLE) { _setReportProcessor(newProcessor); } /// /// Consensus /// /// @notice Returns info about the current frame and consensus state in that frame. /// /// @return refSlot Reference slot of the current reporting frame. /// /// @return consensusReport Consensus report for the current frame, if any. /// Zero bytes otherwise. /// /// @return isReportProcessing If consensus report for the current frame is already /// being processed. Consensus can be changed before the processing starts. /// function getConsensusState() external view returns ( uint256 refSlot, bytes32 consensusReport, bool isReportProcessing ) { refSlot = _getCurrentFrame().refSlot; (consensusReport,,) = _getConsensusReport(refSlot, _quorum); isReportProcessing = _getLastProcessingRefSlot() == refSlot; } /// @notice Returns report variants and their support for the current reference slot. /// function getReportVariants() external view returns ( bytes32[] memory variants, uint256[] memory support ) { if (_reportingState.lastReportRefSlot != _getCurrentFrame().refSlot) { return (variants, support); } uint256 variantsLength = _reportVariantsLength; variants = new bytes32[](variantsLength); support = new uint256[](variantsLength); for (uint256 i = 0; i < variantsLength; ++i) { ReportVariant memory variant = _reportVariants[i]; variants[i] = variant.hash; support[i] = variant.support; } } struct MemberConsensusState { /// @notice Current frame's reference slot. uint256 currentFrameRefSlot; /// @notice Consensus report for the current frame, if any. Zero bytes otherwise. bytes32 currentFrameConsensusReport; /// @notice Whether the provided address is a member of the oracle committee. bool isMember; /// @notice Whether the oracle committee member is in the fast lane members subset /// of the current reporting frame. See `getIsFastLaneMember`. bool isFastLane; /// @notice Whether the oracle committee member is allowed to submit a report at /// the moment of the call. bool canReport; /// @notice The last reference slot for which the member submitted a report. uint256 lastMemberReportRefSlot; /// @notice The hash reported by the member for the current frame, if any. /// Zero bytes otherwise. bytes32 currentFrameMemberReport; } /// @notice Returns the extended information related to an oracle committee member with the /// given address and the current consensus state. Provides all the information needed for /// an oracle daemon to decide if it needs to submit a report. /// /// @param addr The member address. /// @return result See the docs for `MemberConsensusState`. /// function getConsensusStateForMember(address addr) external view returns (MemberConsensusState memory result) { ConsensusFrame memory frame = _getCurrentFrame(); result.currentFrameRefSlot = frame.refSlot; (result.currentFrameConsensusReport,,) = _getConsensusReport(frame.refSlot, _quorum); uint256 index = _memberIndices1b[addr]; result.isMember = index != 0; if (index != 0) { unchecked { --index; } // convert to 0-based MemberState memory memberState = _memberStates[index]; result.lastMemberReportRefSlot = memberState.lastReportRefSlot; result.currentFrameMemberReport = result.lastMemberReportRefSlot == frame.refSlot ? _reportVariants[memberState.lastReportVariantIndex].hash : ZERO_HASH; uint256 slot = _computeSlotAtTimestamp(_getTime()); result.canReport = slot <= frame.reportProcessingDeadlineSlot && frame.refSlot > _getLastProcessingRefSlot(); result.isFastLane = _isFastLaneMember(index, frame.index); if (!result.isFastLane && result.canReport) { result.canReport = slot > frame.refSlot + _frameConfig.fastLaneLengthSlots; } } } /// @notice Used by oracle members to submit hash of the data calculated for the given /// reference slot. /// /// @param slot The reference slot the data was calculated for. Reverts if doesn't match /// the current reference slot. /// /// @param report Hash of the data calculated for the given reference slot. /// /// @param consensusVersion Version of the oracle consensus rules. Reverts if doesn't /// match the version returned by the currently set consensus report processor, /// or zero if no report processor is set. /// function submitReport(uint256 slot, bytes32 report, uint256 consensusVersion) external { _submitReport(slot, report, consensusVersion); } /// /// Implementation: time /// function _setFrameConfig( uint256 initialEpoch, uint256 epochsPerFrame, uint256 fastLaneLengthSlots, FrameConfig memory prevConfig ) internal { if (epochsPerFrame == 0) revert EpochsPerFrameCannotBeZero(); if (fastLaneLengthSlots > epochsPerFrame * SLOTS_PER_EPOCH) { revert FastLanePeriodCannotBeLongerThanFrame(); } _frameConfig = FrameConfig( initialEpoch.toUint64(), epochsPerFrame.toUint64(), fastLaneLengthSlots.toUint64() ); if (initialEpoch != prevConfig.initialEpoch || epochsPerFrame != prevConfig.epochsPerFrame) { emit FrameConfigSet(initialEpoch, epochsPerFrame); } if (fastLaneLengthSlots != prevConfig.fastLaneLengthSlots) { emit FastLaneConfigSet(fastLaneLengthSlots); } } function _getCurrentFrame() internal view returns (ConsensusFrame memory) { return _getFrameAtTimestamp(_getTime(), _frameConfig); } function _getInitialFrame() internal view returns (ConsensusFrame memory) { return _getFrameAtIndex(0, _frameConfig); } function _getFrameAtTimestamp(uint256 timestamp, FrameConfig memory config) internal view returns (ConsensusFrame memory) { return _getFrameAtIndex(_computeFrameIndex(timestamp, config), config); } function _getFrameAtIndex(uint256 frameIndex, FrameConfig memory config) internal view returns (ConsensusFrame memory) { uint256 frameStartEpoch = _computeStartEpochOfFrameWithIndex(frameIndex, config); uint256 frameStartSlot = _computeStartSlotAtEpoch(frameStartEpoch); uint256 nextFrameStartSlot = frameStartSlot + config.epochsPerFrame * SLOTS_PER_EPOCH; return ConsensusFrame({ index: frameIndex, refSlot: uint64(frameStartSlot - 1), reportProcessingDeadlineSlot: uint64(nextFrameStartSlot - 1 - DEADLINE_SLOT_OFFSET) }); } function _computeFrameStartEpoch(uint256 timestamp, FrameConfig memory config) internal view returns (uint256) { return _computeStartEpochOfFrameWithIndex(_computeFrameIndex(timestamp, config), config); } function _computeStartEpochOfFrameWithIndex(uint256 frameIndex, FrameConfig memory config) internal pure returns (uint256) { return config.initialEpoch + frameIndex * config.epochsPerFrame; } function _computeFrameIndex(uint256 timestamp, FrameConfig memory config) internal view returns (uint256) { uint256 epoch = _computeEpochAtTimestamp(timestamp); if (epoch < config.initialEpoch) { revert InitialEpochIsYetToArrive(); } return (epoch - config.initialEpoch) / config.epochsPerFrame; } function _computeTimestampAtSlot(uint256 slot) internal view returns (uint256) { // See: github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#compute_timestamp_at_slot return GENESIS_TIME + slot * SECONDS_PER_SLOT; } function _computeSlotAtTimestamp(uint256 timestamp) internal view returns (uint256) { return (timestamp - GENESIS_TIME) / SECONDS_PER_SLOT; } function _computeEpochAtSlot(uint256 slot) internal view returns (uint256) { // See: github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_epoch_at_slot return slot / SLOTS_PER_EPOCH; } function _computeEpochAtTimestamp(uint256 timestamp) internal view returns (uint256) { return _computeEpochAtSlot(_computeSlotAtTimestamp(timestamp)); } function _computeStartSlotAtEpoch(uint256 epoch) internal view returns (uint256) { // See: github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_start_slot_at_epoch return epoch * SLOTS_PER_EPOCH; } function _getTime() internal virtual view returns (uint256) { return block.timestamp; // solhint-disable-line not-rely-on-time } /// /// Implementation: members /// function _isMember(address addr) internal view returns (bool) { return _memberIndices1b[addr] != 0; } function _getMemberIndex(address addr) internal view returns (uint256) { uint256 index1b = _memberIndices1b[addr]; if (index1b == 0) { revert NonMember(); } unchecked { return uint256(index1b - 1); } } function _addMember(address addr, uint256 quorum) internal { if (_isMember(addr)) revert DuplicateMember(); if (addr == address(0)) revert AddressCannotBeZero(); _memberStates.push(MemberState(0, 0)); _memberAddresses.push(addr); uint256 newTotalMembers = _memberStates.length; _memberIndices1b[addr] = newTotalMembers; emit MemberAdded(addr, newTotalMembers, quorum); _setQuorumAndCheckConsensus(quorum, newTotalMembers); } function _removeMember(address addr, uint256 quorum) internal { uint256 index = _getMemberIndex(addr); uint256 newTotalMembers = _memberStates.length - 1; assert(index <= newTotalMembers); MemberState memory memberState = _memberStates[index]; if (index != newTotalMembers) { address addrToMove = _memberAddresses[newTotalMembers]; _memberAddresses[index] = addrToMove; _memberStates[index] = _memberStates[newTotalMembers]; _memberIndices1b[addrToMove] = index + 1; } _memberStates.pop(); _memberAddresses.pop(); _memberIndices1b[addr] = 0; emit MemberRemoved(addr, newTotalMembers, quorum); if (memberState.lastReportRefSlot > 0) { // member reported at least once ConsensusFrame memory frame = _getCurrentFrame(); if (memberState.lastReportRefSlot == frame.refSlot && _getLastProcessingRefSlot() < frame.refSlot ) { // member reported for the current ref. slot and the consensus report // is not processing yet => need to cancel the member's report --_reportVariants[memberState.lastReportVariantIndex].support; } } _setQuorumAndCheckConsensus(quorum, newTotalMembers); } function _setFastLaneLengthSlots(uint256 fastLaneLengthSlots) internal { FrameConfig memory frameConfig = _frameConfig; if (fastLaneLengthSlots > frameConfig.epochsPerFrame * SLOTS_PER_EPOCH) { revert FastLanePeriodCannotBeLongerThanFrame(); } if (fastLaneLengthSlots != frameConfig.fastLaneLengthSlots) { _frameConfig.fastLaneLengthSlots = fastLaneLengthSlots.toUint64(); emit FastLaneConfigSet(fastLaneLengthSlots); } } /// @dev Returns start and past-end incides (mod totalMembers) of the fast lane members subset. /// function _getFastLaneSubset(uint256 frameIndex, uint256 totalMembers) internal view returns (uint256 startIndex, uint256 pastEndIndex) { uint256 quorum = _quorum; if (quorum >= totalMembers) { startIndex = 0; pastEndIndex = totalMembers; } else { startIndex = frameIndex % totalMembers; pastEndIndex = startIndex + quorum; } } /// @dev Tests whether the member with the given `index` is in the fast lane subset for the /// given reporting `frameIndex`. /// function _isFastLaneMember(uint256 index, uint256 frameIndex) internal view returns (bool) { uint256 totalMembers = _memberStates.length; (uint256 flLeft, uint256 flPastRight) = _getFastLaneSubset(frameIndex, totalMembers); unchecked { return ( flPastRight != 0 && Math.pointInClosedIntervalModN(index, flLeft, flPastRight - 1, totalMembers) ); } } function _getMembers(bool fastLane) internal view returns ( address[] memory addresses, uint256[] memory lastReportedRefSlots ) { uint256 totalMembers = _memberStates.length; uint256 left; uint256 right; if (fastLane) { (left, right) = _getFastLaneSubset(_getCurrentFrame().index, totalMembers); } else { right = totalMembers; } addresses = new address[](right - left); lastReportedRefSlots = new uint256[](addresses.length); for (uint256 i = left; i < right; ++i) { uint256 iModTotal = i % totalMembers; MemberState memory memberState = _memberStates[iModTotal]; uint256 k = i - left; addresses[k] = _memberAddresses[iModTotal]; lastReportedRefSlots[k] = memberState.lastReportRefSlot; } } /// /// Implementation: consensus /// function _submitReport(uint256 slot, bytes32 report, uint256 consensusVersion) internal { if (slot == 0) revert InvalidSlot(); if (slot > type(uint64).max) revert NumericOverflow(); if (report == ZERO_HASH) revert EmptyReport(); uint256 memberIndex = _getMemberIndex(_msgSender()); MemberState memory memberState = _memberStates[memberIndex]; uint256 expectedConsensusVersion = _getConsensusVersion(); if (consensusVersion != expectedConsensusVersion) { revert UnexpectedConsensusVersion(expectedConsensusVersion, consensusVersion); } uint256 timestamp = _getTime(); uint256 currentSlot = _computeSlotAtTimestamp(timestamp); FrameConfig memory config = _frameConfig; ConsensusFrame memory frame = _getFrameAtTimestamp(timestamp, config); if (slot != frame.refSlot) revert InvalidSlot(); if (currentSlot > frame.reportProcessingDeadlineSlot) revert StaleReport(); if (currentSlot <= frame.refSlot + config.fastLaneLengthSlots && !_isFastLaneMember(memberIndex, frame.index) ) { revert NonFastLaneMemberCannotReportWithinFastLaneInterval(); } if (slot <= _getLastProcessingRefSlot()) { // consensus for the ref. slot was already reached and consensus report is processing if (slot == memberState.lastReportRefSlot) { // member sends a report for the same slot => let them know via a revert revert ConsensusReportAlreadyProcessing(); } else { // member hasn't sent a report for this slot => normal operation, do nothing return; } } uint256 variantsLength; if (_reportingState.lastReportRefSlot != slot) { // first report for a new slot => clear report variants _reportingState.lastReportRefSlot = uint64(slot); variantsLength = 0; } else { variantsLength = _reportVariantsLength; } uint64 varIndex = 0; bool prevConsensusLost = false; while (varIndex < variantsLength && _reportVariants[varIndex].hash != report) { ++varIndex; } if (slot == memberState.lastReportRefSlot) { uint64 prevVarIndex = memberState.lastReportVariantIndex; assert(prevVarIndex < variantsLength); if (varIndex == prevVarIndex) { revert DuplicateReport(); } else { uint256 support = --_reportVariants[prevVarIndex].support; if (support == _quorum - 1) { prevConsensusLost = true; } } } uint256 support; if (varIndex < variantsLength) { support = ++_reportVariants[varIndex].support; } else { support = 1; _reportVariants[varIndex] = ReportVariant({hash: report, support: 1}); _reportVariantsLength = ++variantsLength; } _memberStates[memberIndex] = MemberState({ lastReportRefSlot: uint64(slot), lastReportVariantIndex: varIndex }); emit ReportReceived(slot, _msgSender(), report); if (support >= _quorum) { _consensusReached(frame, report, varIndex, support); } else if (prevConsensusLost) { _consensusNotReached(frame); } } function _consensusReached( ConsensusFrame memory frame, bytes32 report, uint256 variantIndex, uint256 support ) internal { if (_reportingState.lastConsensusRefSlot != frame.refSlot || _reportingState.lastConsensusVariantIndex != variantIndex ) { _reportingState.lastConsensusRefSlot = uint64(frame.refSlot); _reportingState.lastConsensusVariantIndex = uint64(variantIndex); emit ConsensusReached(frame.refSlot, report, support); _submitReportForProcessing(frame, report); } } function _consensusNotReached(ConsensusFrame memory frame) internal { if (_reportingState.lastConsensusRefSlot == frame.refSlot) { _reportingState.lastConsensusRefSlot = 0; emit ConsensusLost(frame.refSlot); _cancelReportProcessing(frame); } } function _setQuorumAndCheckConsensus(uint256 quorum, uint256 totalMembers) internal { if (quorum <= totalMembers / 2) { revert QuorumTooSmall(totalMembers / 2 + 1, quorum); } // we're explicitly allowing quorum values greater than the number of members to // allow effectively disabling the oracle in case something unpredictable happens uint256 prevQuorum = _quorum; if (quorum != prevQuorum) { _checkRole( quorum == UNREACHABLE_QUORUM ? DISABLE_CONSENSUS_ROLE : MANAGE_MEMBERS_AND_QUORUM_ROLE, _msgSender() ); _quorum = quorum; emit QuorumSet(quorum, totalMembers, prevQuorum); } if (_computeEpochAtTimestamp(_getTime()) >= _frameConfig.initialEpoch) { _checkConsensus(quorum); } } function _checkConsensus(uint256 quorum) internal { uint256 timestamp = _getTime(); ConsensusFrame memory frame = _getFrameAtTimestamp(timestamp, _frameConfig); if (_computeSlotAtTimestamp(timestamp) > frame.reportProcessingDeadlineSlot) { // a report for the current ref. slot cannot be processed anymore return; } if (_getLastProcessingRefSlot() >= frame.refSlot) { // a consensus report for the current ref. slot is already being processed return; } (bytes32 consensusReport, int256 consensusVariantIndex, uint256 support) = _getConsensusReport(frame.refSlot, quorum); if (consensusVariantIndex >= 0) { _consensusReached(frame, consensusReport, uint256(consensusVariantIndex), support); } else { _consensusNotReached(frame); } } function _getConsensusReport(uint256 currentRefSlot, uint256 quorum) internal view returns (bytes32 report, int256 variantIndex, uint256 support) { if (_reportingState.lastReportRefSlot != currentRefSlot) { // there were no reports for the current ref. slot return (ZERO_HASH, -1, 0); } uint256 variantsLength = _reportVariantsLength; variantIndex = -1; report = ZERO_HASH; support = 0; for (uint256 i = 0; i < variantsLength; ++i) { uint256 iSupport = _reportVariants[i].support; if (iSupport >= quorum) { variantIndex = int256(i); report = _reportVariants[i].hash; support = iSupport; break; } } return (report, variantIndex, support); } /// /// Implementation: report processing /// function _setReportProcessor(address newProcessor) internal { address prevProcessor = _reportProcessor; if (newProcessor == address(0)) revert ReportProcessorCannotBeZero(); if (newProcessor == prevProcessor) revert NewProcessorCannotBeTheSame(); _reportProcessor = newProcessor; emit ReportProcessorSet(newProcessor, prevProcessor); ConsensusFrame memory frame = _getCurrentFrame(); uint256 lastConsensusRefSlot = _reportingState.lastConsensusRefSlot; uint256 processingRefSlotPrev = IReportAsyncProcessor(prevProcessor).getLastProcessingRefSlot(); uint256 processingRefSlotNext = IReportAsyncProcessor(newProcessor).getLastProcessingRefSlot(); if ( processingRefSlotPrev < frame.refSlot && processingRefSlotNext < frame.refSlot && lastConsensusRefSlot == frame.refSlot ) { bytes32 report = _reportVariants[_reportingState.lastConsensusVariantIndex].hash; _submitReportForProcessing(frame, report); } } function _getLastProcessingRefSlot() internal view returns (uint256) { return IReportAsyncProcessor(_reportProcessor).getLastProcessingRefSlot(); } function _submitReportForProcessing(ConsensusFrame memory frame, bytes32 report) internal { IReportAsyncProcessor(_reportProcessor).submitConsensusReport( report, frame.refSlot, _computeTimestampAtSlot(frame.reportProcessingDeadlineSlot) ); } function _cancelReportProcessing(ConsensusFrame memory frame) internal { IReportAsyncProcessor(_reportProcessor).discardConsensusReport(frame.refSlot); } function _getConsensusVersion() internal view returns (uint256) { return IReportAsyncProcessor(_reportProcessor).getConsensusVersion(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> // SPDX-License-Identifier: MIT // See contracts/COMPILERS.md pragma solidity 0.8.9; library Math { function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /// @notice Tests if x ∈ [a, b) (mod n) /// function pointInHalfOpenIntervalModN(uint256 x, uint256 a, uint256 b, uint256 n) internal pure returns (bool) { return (x + n - a) % n < (b - a) % n; } /// @notice Tests if x ∈ [a, b] (mod n) /// function pointInClosedIntervalModN(uint256 x, uint256 a, uint256 b, uint256 n) internal pure returns (bool) { return (x + n - a) % n <= (b - a) % n; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) // // A modified AccessControl contract using unstructured storage. Copied from tree: // https://github.com/OpenZeppelin/openzeppelin-contracts/tree/6bd6b76/contracts/access // /* See contracts/COMPILERS.md */ pragma solidity 0.8.9; import "@openzeppelin/contracts-v4.4/access/IAccessControl.sol"; import "@openzeppelin/contracts-v4.4/utils/Context.sol"; import "@openzeppelin/contracts-v4.4/utils/Strings.sol"; import "@openzeppelin/contracts-v4.4/utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } /// @dev Storage slot: mapping(bytes32 => RoleData) _roles bytes32 private constant ROLES_POSITION = keccak256("openzeppelin.AccessControl._roles"); function _storageRoles() private pure returns (mapping(bytes32 => RoleData) storage _roles) { bytes32 position = ROLES_POSITION; assembly { _roles.slot := position } } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _storageRoles()[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _storageRoles()[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _storageRoles()[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _storageRoles()[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _storageRoles()[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol) // // A modified AccessControlEnumerable contract using unstructured storage. Copied from tree: // https://github.com/OpenZeppelin/openzeppelin-contracts/tree/6bd6b76/contracts/access // /* See contracts/COMPILERS.md */ pragma solidity 0.8.9; import "@openzeppelin/contracts-v4.4/access/IAccessControlEnumerable.sol"; import "@openzeppelin/contracts-v4.4/utils/structs/EnumerableSet.sol"; import "./AccessControl.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; /// @dev Storage slot: mapping(bytes32 => EnumerableSet.AddressSet) _roleMembers bytes32 private constant ROLE_MEMBERS_POSITION = keccak256("openzeppelin.AccessControlEnumerable._roleMembers"); function _storageRoleMembers() private pure returns ( mapping(bytes32 => EnumerableSet.AddressSet) storage _roleMembers ) { bytes32 position = ROLE_MEMBERS_POSITION; assembly { _roleMembers.slot := position } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _storageRoleMembers()[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _storageRoleMembers()[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _storageRoleMembers()[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _storageRoleMembers()[role].remove(account); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"uint256","name":"slotsPerEpoch","type":"uint256"},{"internalType":"uint256","name":"secondsPerSlot","type":"uint256"},{"internalType":"uint256","name":"genesisTime","type":"uint256"},{"internalType":"uint256","name":"epochsPerFrame","type":"uint256"},{"internalType":"uint256","name":"fastLaneLengthSlots","type":"uint256"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"reportProcessor","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressCannotBeZero","type":"error"},{"inputs":[],"name":"AdminCannotBeZero","type":"error"},{"inputs":[],"name":"ConsensusReportAlreadyProcessing","type":"error"},{"inputs":[],"name":"DuplicateMember","type":"error"},{"inputs":[],"name":"DuplicateReport","type":"error"},{"inputs":[],"name":"EmptyReport","type":"error"},{"inputs":[],"name":"EpochsPerFrameCannotBeZero","type":"error"},{"inputs":[],"name":"FastLanePeriodCannotBeLongerThanFrame","type":"error"},{"inputs":[],"name":"InitialEpochAlreadyArrived","type":"error"},{"inputs":[],"name":"InitialEpochIsYetToArrive","type":"error"},{"inputs":[],"name":"InitialEpochRefSlotCannotBeEarlierThanProcessingSlot","type":"error"},{"inputs":[],"name":"InvalidChainConfig","type":"error"},{"inputs":[],"name":"InvalidSlot","type":"error"},{"inputs":[],"name":"NewProcessorCannotBeTheSame","type":"error"},{"inputs":[],"name":"NonFastLaneMemberCannotReportWithinFastLaneInterval","type":"error"},{"inputs":[],"name":"NonMember","type":"error"},{"inputs":[],"name":"NumericOverflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"minQuorum","type":"uint256"},{"internalType":"uint256","name":"receivedQuorum","type":"uint256"}],"name":"QuorumTooSmall","type":"error"},{"inputs":[],"name":"ReportProcessorCannotBeZero","type":"error"},{"inputs":[],"name":"StaleReport","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"name":"UnexpectedConsensusVersion","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"refSlot","type":"uint256"}],"name":"ConsensusLost","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"refSlot","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"report","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"support","type":"uint256"}],"name":"ConsensusReached","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fastLaneLengthSlots","type":"uint256"}],"name":"FastLaneConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newInitialEpoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newEpochsPerFrame","type":"uint256"}],"name":"FrameConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"newTotalMembers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"MemberAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"newTotalMembers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"MemberRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newQuorum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalMembers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prevQuorum","type":"uint256"}],"name":"QuorumSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"processor","type":"address"},{"indexed":true,"internalType":"address","name":"prevProcessor","type":"address"}],"name":"ReportProcessorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"refSlot","type":"uint256"},{"indexed":true,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"bytes32","name":"report","type":"bytes32"}],"name":"ReportReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISABLE_CONSENSUS_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGE_FAST_LANE_CONFIG_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGE_FRAME_CONFIG_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGE_MEMBERS_AND_QUORUM_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGE_REPORT_PROCESSOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"quorum","type":"uint256"}],"name":"addMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableConsensus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getChainConfig","outputs":[{"internalType":"uint256","name":"slotsPerEpoch","type":"uint256"},{"internalType":"uint256","name":"secondsPerSlot","type":"uint256"},{"internalType":"uint256","name":"genesisTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConsensusState","outputs":[{"internalType":"uint256","name":"refSlot","type":"uint256"},{"internalType":"bytes32","name":"consensusReport","type":"bytes32"},{"internalType":"bool","name":"isReportProcessing","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getConsensusStateForMember","outputs":[{"components":[{"internalType":"uint256","name":"currentFrameRefSlot","type":"uint256"},{"internalType":"bytes32","name":"currentFrameConsensusReport","type":"bytes32"},{"internalType":"bool","name":"isMember","type":"bool"},{"internalType":"bool","name":"isFastLane","type":"bool"},{"internalType":"bool","name":"canReport","type":"bool"},{"internalType":"uint256","name":"lastMemberReportRefSlot","type":"uint256"},{"internalType":"bytes32","name":"currentFrameMemberReport","type":"bytes32"}],"internalType":"struct HashConsensus.MemberConsensusState","name":"result","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentFrame","outputs":[{"internalType":"uint256","name":"refSlot","type":"uint256"},{"internalType":"uint256","name":"reportProcessingDeadlineSlot","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFastLaneMembers","outputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256[]","name":"lastReportedRefSlots","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFrameConfig","outputs":[{"internalType":"uint256","name":"initialEpoch","type":"uint256"},{"internalType":"uint256","name":"epochsPerFrame","type":"uint256"},{"internalType":"uint256","name":"fastLaneLengthSlots","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInitialRefSlot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getIsFastLaneMember","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getIsMember","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMembers","outputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256[]","name":"lastReportedRefSlots","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getQuorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReportProcessor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReportVariants","outputs":[{"internalType":"bytes32[]","name":"variants","type":"bytes32[]"},{"internalType":"uint256[]","name":"support","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"quorum","type":"uint256"}],"name":"removeMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fastLaneLengthSlots","type":"uint256"}],"name":"setFastLaneLengthSlots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epochsPerFrame","type":"uint256"},{"internalType":"uint256","name":"fastLaneLengthSlots","type":"uint256"}],"name":"setFrameConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quorum","type":"uint256"}],"name":"setQuorum","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newProcessor","type":"address"}],"name":"setReportProcessor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"slot","type":"uint256"},{"internalType":"bytes32","name":"report","type":"bytes32"},{"internalType":"uint256","name":"consensusVersion","type":"uint256"}],"name":"submitReport","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialEpoch","type":"uint256"}],"name":"updateInitialEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c80636fb1bf6611610125578063ad231cb2116100ad578063d547741f1161007c578063d547741f146105c8578063e33a8d39146105db578063e76cd4e0146105ee578063ea87627d14610601578063fb4209ac1461062657600080fd5b8063ad231cb214610592578063c1ba4e591461059a578063c26c12eb146105ad578063ca15c873146105b557600080fd5b806398041ea3116100f457806398041ea31461054757806399229f581461055a5780639eab52531461056d578063a1e07cac14610575578063a217fddf1461058a57600080fd5b80636fb1bf66146104c157806372f79b13146105045780639010d07c1461052157806391d148541461053457600080fd5b8063323a41f6116101a8578063606c0c9411610177578063606c0c941461036b5780636095012f146103fe57806360a50a5c1461040657806360e618011461042d5780636d0582681461049c57600080fd5b8063323a41f61461031c57806334aa67531461032f57806336568abe14610342578063433ab1f31461035557600080fd5b806320b4d751116101ef57806320b4d751146102a6578063239c327f146102b9578063248a9ca3146102e05780632f2ff15d146102f35780632fd2d7501461030657600080fd5b806301ffc9a714610221578063115a57c41461024957806316f6f03e1461027e5780631951c03714610293575b600080fd5b61023461022f366004612e89565b61064d565b60405190151581526020015b60405180910390f35b6102707f921f40f434e049d23969cbe68d9cf3ac1013fbe8945da07963af6f3142de6afe81565b604051908152602001610240565b61029161028c366004612ecf565b610678565b005b6102346102a1366004612ef9565b6106a0565b6102346102b4366004612ef9565b6106c0565b6102707f4af6faa30fabb2c4d8d567d06168f9be8adb583156c1ecb424b4832a7e4d671781565b6102706102ee366004612f14565b6106ff565b610291610301366004612f2d565b610721565b61030e61073e565b604051610240929190612f94565b61029161032a366004612f14565b61088f565b61029161033d366004612fe1565b610955565b610291610350366004612f2d565b610a18565b61035d610a9b565b604051610240929190613003565b6103e36001600160401b037f00000000000000000000000000000000000000000000000000000000000000208116917f000000000000000000000000000000000000000000000000000000000000000c8216917f0000000000000000000000000000000000000000000000000000000065156ac01690565b60408051938452602084019290925290820152606001610240565b610270610ab0565b6102707f10b016346186602d93fc7a27ace09ba944baf9453611b186d36acd3d3d667dc081565b61044061043b366004612ef9565b610ac3565b6040516102409190600060e082019050825182526020830151602083015260408301511515604083015260608301511515606083015260808301511515608083015260a083015160a083015260c083015160c083015292915050565b6008546001600160a01b03165b6040516001600160a01b039091168152602001610240565b604080516060810182526000546001600160401b03808216808452600160401b8304821660208501819052600160801b90930490911692909301829052906103e3565b61050c610c6c565b60408051928352602083019190915201610240565b6104a961052f366004612fe1565b610c8e565b610234610542366004612f2d565b610cb3565b610291610555366004612ecf565b610ceb565b610291610568366004612f14565b610d0e565b61035d610d42565b6102706000805160206132fa83398151915281565b610270600081565b610291610d4f565b6102916105a8366004612f14565b610d61565b600554610270565b6102706105c3366004612f14565b610d72565b6102916105d6366004612f2d565b610d96565b6102916105e9366004613045565b610db3565b6102916105fc366004612ef9565b610dbe565b610609610df2565b604080519384526020840192909252151590820152606001610240565b6102707fc5219a8d2d0107a57aad00b22081326d173df87bad251126f070df2659770c3e81565b60006001600160e01b03198216635a05180f60e01b1480610672575061067282610f1f565b92915050565b6000805160206132fa8339815191526106918133610f54565b61069b8383610fb8565b505050565b6001600160a01b0381166000908152600360205260408120541515610672565b6001600160a01b03811660009081526003602052604081205480158015906106f857506106f8600182036106f26112ba565b51611324565b9392505050565b600090815260008051602061333a833981519152602052604090206001015490565b61072a826106ff565b6107348133610f54565b61069b838361135f565b6060806107496112ba565b602001516004546001600160401b031614610762579091565b600754806001600160401b0381111561077d5761077d613071565b6040519080825280602002602001820160405280156107a6578160200160208202803683370190505b509250806001600160401b038111156107c1576107c1613071565b6040519080825280602002602001820160405280156107ea578160200160208202803683370190505b50915060005b8181101561088957600081815260066020908152604091829020825180840190935280548084526001909101546001600160401b031691830191909152855186908490811061084157610841613087565b60200260200101818152505080602001516001600160401b031684838151811061086d5761086d613087565b602090810291909101015250610882816130b3565b90506107f0565b50509091565b600061089b8133610f54565b604080516060810182526000546001600160401b03808216808452600160401b830482166020850152600160801b9092041692820192909252906108de4261138e565b106108fc576040516329d1e0ff60e01b815260040160405180910390fd5b6109228382602001516001600160401b031683604001516001600160401b0316846113a1565b61092a611558565b6109326115d5565b60200151101561069b576040516323ca23a760e21b815260040160405180910390fd5b7f921f40f434e049d23969cbe68d9cf3ac1013fbe8945da07963af6f3142de6afe6109808133610f54565b60408051606081018252600080546001600160401b038082168452600160401b820481166020850152600160801b90910416928201929092524291906109c790839061163c565b604080516060810182526000546001600160401b038082168352600160401b820481166020840152600160801b9091041691810191909152909150610a11908290879087906113a1565b5050505050565b6001600160a01b0381163314610a8d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610a978282611651565b5050565b606080610aa86001611680565b915091509091565b6000610aba6115d5565b60200151905090565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905290610b046112ba565b602081018051845251600554919250610b1c9161185a565b50506020808401919091526001600160a01b0384166000908152600390915260409081902054801580159285019290925290610c655780600190039050600060018281548110610b6e57610b6e613087565b6000918252602091829020604080518082019091529101546001600160401b03808216808452600160401b909204168284015260a087018190529185015190925014610bbb576000610bda565b6020808201516001600160401b03166000908152600690915260409020545b60c08501526000610bea426118f5565b905083604001518111158015610c0a5750610c03611558565b8460200151115b151560808601528351610c1e908490611324565b15801560608701819052610c33575084608001515b15610c62576000546020850151610c5a91600160801b90046001600160401b0316906130ce565b811160808601525b50505b5050919050565b6000806000610c796112ba565b90508060200151816040015192509250509091565b600082815260008051602061331a833981519152602052604081206106f89083611960565b600091825260008051602061333a833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206132fa833981519152610d048133610f54565b61069b838361196c565b7f4af6faa30fabb2c4d8d567d06168f9be8adb583156c1ecb424b4832a7e4d6717610d398133610f54565b610a9782611ae6565b606080610aa86000611680565b600154610d5f9060001990611bf5565b565b600154610d6f908290611bf5565b50565b600081815260008051602061331a8339815191526020526040812061067290611cfc565b610d9f826106ff565b610da98133610f54565b61069b8383611651565b61069b838383611d06565b7fc5219a8d2d0107a57aad00b22081326d173df87bad251126f070df2659770c3e610de98133610f54565b610a978261225f565b6000806000610dff6112ba565b602001519250610e118360055461185a565b50909250839050610e20611558565b149050909192565b60006001600160401b03821115610e905760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610a84565b5090565b610e9e8282610cb3565b610a9757600082815260008051602061333a833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b60006106f8836001600160a01b038416612488565b60006001600160e01b03198216637965db0b60e01b148061067257506301ffc9a760e01b6001600160e01b0319831614610672565b610f5e8282610cb3565b610a9757610f76816001600160a01b031660146124d7565b610f818360206124d7565b604051602001610f92929190613112565b60408051601f198184030181529082905262461bcd60e51b8252610a8491600401613187565b6000610fc383612672565b60018054919250600091610fd791906131ba565b905080821115610fe957610fe96131d1565b600060018381548110610ffe57610ffe613087565b6000918252602091829020604080518082019091529101546001600160401b038082168352600160401b909104169181019190915290508282146111525760006002838154811061105157611051613087565b600091825260209091200154600280546001600160a01b03909216925082918690811061108057611080613087565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600183815481106110c1576110c1613087565b90600052602060002001600185815481106110de576110de613087565b600091825260209091208254910180546001600160401b0392831667ffffffffffffffff1982168117835593546001600160801b0319909116909317600160401b938490049092169092021790556111378460016130ce565b6001600160a01b039091166000908152600360205260409020555b6001805480611163576111636131e7565b600082815260209020810160001990810180546001600160801b03191690550190556002805480611196576111966131e7565b60008281526020808220600019908401810180546001600160a01b03191690559092019092556001600160a01b038716808352600382526040808420939093558251858152918201879052917fa182730913550d27dc6c5813fad297cb0785871bec3d0152c5650e59c5d39d60910160405180910390a280516001600160401b0316156112b05760006112276112ba565b9050806020015182600001516001600160401b031614801561125357508060200151611251611558565b105b156112ae576020808301516001600160401b039081166000908152600690925260408220600101805490929161128991166131fd565b91906101000a8154816001600160401b0302191690836001600160401b031602179055505b505b610a118483611bf5565b6112de60405180606001604052806000815260200160008152602001600081525090565b61131f42604080516060810182526000546001600160401b038082168352600160401b820481166020840152600160801b90910416918101919091526126b3565b905090565b600154600090818061133685846126ea565b9150915080600014158015611355575061135586836001840386612726565b9695505050505050565b6113698282610e94565b600082815260008051602061331a8339815191526020526040902061069b9082610f0a565b600061067261139c836118f5565b612768565b826113bf5760405163ef3d10c160e01b815260040160405180910390fd5b6113f26001600160401b037f00000000000000000000000000000000000000000000000000000000000000201684613216565b821115611412576040516385b552e160e01b815260040160405180910390fd5b604051806060016040528061142686610e28565b6001600160401b0316815260200161143d85610e28565b6001600160401b0316815260200161145484610e28565b6001600160401b0390811690915281516000805460208501516040909501518416600160801b0267ffffffffffffffff60801b19958516600160401b026001600160801b031990921693851693909317179390931617909155815116841415806114cb575080602001516001600160401b03168314155b1561150a5760408051858152602081018590527fe343afa5219eaf28c50ce9cd658acd69cbe28b34fa773eb3a523e28007f64afc910160405180910390a15b80604001516001600160401b03168214611552576040518281527fab8b22776606cc75c47792d32af7e63ed9ca74e85c9780a7fc7994fdbd6fde2b9060200160405180910390a15b50505050565b60085460408051630d61356760e21b815290516000926001600160a01b031691633584d59c916004808301926020929190829003018186803b15801561159d57600080fd5b505afa1580156115b1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131f9190613235565b6115f960405180606001604052806000815260200160008152602001600081525090565b60408051606081018252600080546001600160401b038082168452600160401b820481166020850152600160801b909104169282019290925261131f919061279d565b60006106f861164b848461287b565b836128e5565b61165b8282612915565b600082815260008051602061331a8339815191526020526040902061069b9082612989565b600154606090819060008085156116ad576116a361169c6112ba565b51846126ea565b90925090506116b0565b50815b6116ba82826131ba565b6001600160401b038111156116d1576116d1613071565b6040519080825280602002602001820160405280156116fa578160200160208202803683370190505b50945084516001600160401b0381111561171657611716613071565b60405190808252806020026020018201604052801561173f578160200160208202803683370190505b509350815b818110156118515760006117588583613264565b905060006001828154811061176f5761176f613087565b60009182526020808320604080518082019091529201546001600160401b038082168452600160401b909104169082015291506117ac86856131ba565b9050600283815481106117c1576117c1613087565b9060005260206000200160009054906101000a90046001600160a01b03168982815181106117f1576117f1613087565b60200260200101906001600160a01b031690816001600160a01b03168152505081600001516001600160401b031688828151811061183157611831613087565b6020026020010181815250505050508061184a906130b3565b9050611744565b50505050915091565b600454600090819081906001600160401b031685146118835750600091506000199050816118ee565b505060075460009150600019908290815b818110156118eb576000818152600660205260409020600101546001600160401b03168681106118da5760008281526006602052604090205495509093509150826118eb565b506118e4816130b3565b9050611894565b50505b9250925092565b60007f000000000000000000000000000000000000000000000000000000000000000c6001600160401b03167f0000000000000000000000000000000000000000000000000000000065156ac06001600160401b03168361195691906131ba565b6106729190613278565b60006106f8838361299e565b6001600160a01b038216600090815260036020526040902054156119a357604051637670720160e11b815260040160405180910390fd5b6001600160a01b0382166119ca576040516303988b8160e61b815260040160405180910390fd5b6040805180820182526000808252602080830182815260018054808201825581855294517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6909501805492516001600160401b03908116600160401b026001600160801b031990941696169590951791909117909355600280548085019091557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0388166001600160a01b03199091168117909155925483835260039091529083902081905591517fe17e0e2cd88e2144dd54f3d823c30d4569092bcac1aabaec1129883e9cc12d2e90611ad49084908690918252602082015260400190565b60405180910390a261069b8282611bf5565b604080516060810182526000546001600160401b038082168352600160401b8204811660208401819052600160801b909204169282019290925290611b4c907f00000000000000000000000000000000000000000000000000000000000000209061328c565b6001600160401b0316821115611b75576040516385b552e160e01b815260040160405180910390fd5b80604001516001600160401b03168214610a9757611b9282610e28565b600080546001600160401b0392909216600160801b0267ffffffffffffffff60801b199092169190911790556040518281527fab8b22776606cc75c47792d32af7e63ed9ca74e85c9780a7fc7994fdbd6fde2b9060200160405180910390a15050565b611c00600282613278565b8211611c4057611c11600282613278565b611c1c9060016130ce565b604051632b2dd84d60e01b8152600481019190915260248101839052604401610a84565b600554828114611cd957611c926000198414611c6a576000805160206132fa833981519152611c8c565b7f10b016346186602d93fc7a27ace09ba944baf9453611b186d36acd3d3d667dc05b33610f54565b600583905560408051848152602081018490529081018290527f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1759060600160405180910390a15b6000546001600160401b0316611cee4261138e565b1061069b5761069b836129c8565b6000610672825490565b82611d2457604051631258e44360e01b815260040160405180910390fd5b6001600160401b03831115611d4c5760405163aac8f00960e01b815260040160405180910390fd5b81611d695760405162bf199760e01b815260040160405180910390fd5b6000611d7433612672565b9050600060018281548110611d8b57611d8b613087565b60009182526020808320604080518082019091529201546001600160401b038082168452600160401b90910416908201529150611dc6612a7c565b9050808414611df257604051632a37dd3d60e11b81526004810182905260248101859052604401610a84565b426000611dfe826118f5565b60408051606081018252600080546001600160401b038082168452600160401b820481166020850152600160801b9091041692820192909252919250611e4484836126b3565b905080602001518a14611e6a57604051631258e44360e01b815260040160405180910390fd5b8060400151831115611e8f57604051637c01d16560e11b815260040160405180910390fd5b81604001516001600160401b03168160200151611eac91906130ce565b8311158015611ec65750611ec4878260000151611324565b155b15611ee457604051633e1ca93d60e01b815260040160405180910390fd5b611eec611558565b8a11611f295785516001600160401b03168a1415611f1d57604051631cf7e8a160e31b815260040160405180910390fd5b50505050505050505050565b6004546000906001600160401b03168b14611f6257506004805467ffffffffffffffff19166001600160401b038c161790556000611f67565b506007545b6000805b82826001600160401b0316108015611f9b57506001600160401b0382166000908152600660205260409020548c14155b15611fb057611fa9826132bb565b9150611f6b565b88516001600160401b03168d141561208c5760208901516001600160401b0381168411611fdf57611fdf6131d1565b806001600160401b0316836001600160401b031614156120125760405163fd10cf7360e01b815260040160405180910390fd5b6001600160401b038082166000908152600660205260408120600101805491929091839161204091166131fd565b91906101000a8154816001600160401b0302191690836001600160401b0316021790556001600160401b03169050600160055461207d91906131ba565b81141561208957600192505b50505b600083836001600160401b031610156120fc576001600160401b038084166000908152600660205260408120600101805490926120c991166132bb565b91906101000a8154816001600160401b0302191690836001600160401b0316021790556001600160401b0316905061215d565b506040805180820182528d8152600160208083018281526001600160401b0387811660009081526006909352949091209251835551918101805467ffffffffffffffff19169290931691909117909155612155846130b3565b600781905593505b60405180604001604052808f6001600160401b03168152602001846001600160401b031681525060018c8154811061219757612197613087565b600091825260209182902083519101805493909201516001600160401b03908116600160401b026001600160801b03199094169116179190911790556121da3390565b6001600160a01b03168e7f92f77576dabd7bad26f75c36abb3021b5bbb66a3e5688570a0355daddd4174888f60405161221591815260200190565b60405180910390a360055481106122405761223b858e856001600160401b031684612ac1565b61224f565b811561224f5761224f85612ba2565b5050505050505050505050505050565b6008546001600160a01b0390811690821661228d5760405163154f6dd160e31b815260040160405180910390fd5b806001600160a01b0316826001600160a01b031614156122c05760405163f1b3699f60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b03848116918217909255604051918316917f3b59429457a41af89ea682ac9ed8abb8e99eb5c7d3363d5eedfc6bff6271a81e90600090a360006123166112ba565b90506000600460000160089054906101000a90046001600160401b03166001600160401b031690506000836001600160a01b0316633584d59c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561237957600080fd5b505afa15801561238d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b19190613235565b90506000856001600160a01b0316633584d59c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156123ee57600080fd5b505afa158015612402573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124269190613235565b905083602001518210801561243e5750836020015181105b801561244d5750836020015183145b1561248057600454600160801b90046001600160401b031660009081526006602052604090205461247e8582612c10565b505b505050505050565b60008181526001830160205260408120546124cf57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610672565b506000610672565b606060006124e6836002613216565b6124f19060026130ce565b6001600160401b0381111561250857612508613071565b6040519080825280601f01601f191660200182016040528015612532576020820181803683370190505b509050600360fc1b8160008151811061254d5761254d613087565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061257c5761257c613087565b60200101906001600160f81b031916908160001a90535060006125a0846002613216565b6125ab9060016130ce565b90505b6001811115612623576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106125df576125df613087565b1a60f81b8282815181106125f5576125f5613087565b60200101906001600160f81b031916908160001a90535060049490941c9361261c816132e2565b90506125ae565b5083156106f85760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a84565b6001600160a01b038116600090815260036020526040812054806126a957604051638d35f2ed60e01b815260040160405180910390fd5b6000190192915050565b6126d760405180606001604052806000815260200160008152602001600081525090565b6106f86126e4848461287b565b8361279d565b6005546000908190838110612705576000925083915061271e565b61270f8486613264565b925061271b81846130ce565b91505b509250929050565b60008161273385856131ba565b61273d9190613264565b828561274982896130ce565b61275391906131ba565b61275d9190613264565b111595945050505050565b60006106726001600160401b037f00000000000000000000000000000000000000000000000000000000000000201683613278565b6127c160405180606001604052806000815260200160008152602001600081525090565b60006127cd84846128e5565b905060006127da82612c94565b905060007f0000000000000000000000000000000000000000000000000000000000000020856020015161280e919061328c565b612821906001600160401b0316836130ce565b9050604051806060016040528087815260200160018461284191906131ba565b6001600160401b03168152602001600061285c6001856131ba565b61286691906131ba565b6001600160401b031690529695505050505050565b6000806128878461138e565b83519091506001600160401b03168110156128b55760405163668441f560e11b815260040160405180910390fd5b602083015183516001600160401b03918216916128d39116836131ba565b6128dd9190613278565b949350505050565b600081602001516001600160401b0316836129009190613216565b82516106f891906001600160401b03166130ce565b61291f8282610cb3565b15610a9757600082815260008051602061333a833981519152602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006106f8836001600160a01b038416612cc9565b60008260000182815481106129b5576129b5613087565b9060005260206000200154905092915050565b60408051606081018252600080546001600160401b038082168452600160401b820481166020850152600160801b9091041692820192909252429190612a0f9083906126b3565b90508060400151612a1f836118f5565b1115612a2a57505050565b8060200151612a37611558565b10612a4157505050565b6000806000612a5484602001518761185a565b92509250925060008212612a7357612a6e84848484612ac1565b612480565b61248084612ba2565b60085460408051635be2042560e01b815290516000926001600160a01b031691635be20425916004808301926020929190829003018186803b15801561159d57600080fd5b6020840151600454600160401b90046001600160401b0316141580612af85750600454600160801b90046001600160401b03168214155b15611552576020840151600480546001600160401b03858116600160801b0267ffffffffffffffff60801b19918516600160401b029190911677ffffffffffffffffffffffffffffffff000000000000000019909216919091171790556040517f2b6bc782c916fa763822f1e50c6db0f95dade36d6541a8a4cbe070735b8b226d90612b909086908590918252602082015260400190565b60405180910390a26115528484612c10565b6020810151600454600160401b90046001600160401b03161415610d6f57600480546fffffffffffffffff00000000000000001916905560208101516040517fde3f4ea5aa67881831e8fad2b0855d47e75aa63a2fae6ef657ffd5f856c4a61390600090a2610d6f81612dbc565b600854602083015160408401516001600160a01b039092169163063f36ad918491612c3a90612e21565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401600060405180830381600087803b158015612c8057600080fd5b505af1158015612480573d6000803e3d6000fd5b60006106726001600160401b037f00000000000000000000000000000000000000000000000000000000000000201683613216565b60008181526001830160205260408120548015612db2576000612ced6001836131ba565b8554909150600090612d01906001906131ba565b9050818114612d66576000866000018281548110612d2157612d21613087565b9060005260206000200154905080876000018481548110612d4457612d44613087565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612d7757612d776131e7565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610672565b6000915050610672565b600854602082015160405163d438121760e01b81526001600160a01b039092169163d438121791612df39160040190815260200190565b600060405180830381600087803b158015612e0d57600080fd5b505af1158015610a11573d6000803e3d6000fd5b6000612e566001600160401b037f000000000000000000000000000000000000000000000000000000000000000c1683613216565b610672906001600160401b037f0000000000000000000000000000000000000000000000000000000065156ac0166130ce565b600060208284031215612e9b57600080fd5b81356001600160e01b0319811681146106f857600080fd5b80356001600160a01b0381168114612eca57600080fd5b919050565b60008060408385031215612ee257600080fd5b612eeb83612eb3565b946020939093013593505050565b600060208284031215612f0b57600080fd5b6106f882612eb3565b600060208284031215612f2657600080fd5b5035919050565b60008060408385031215612f4057600080fd5b82359150612f5060208401612eb3565b90509250929050565b600081518084526020808501945080840160005b83811015612f8957815187529582019590820190600101612f6d565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b82811015612fcd57815184529284019290840190600101612fb1565b505050838103828501526113558186612f59565b60008060408385031215612ff457600080fd5b50508035926020909101359150565b604080825283519082018190526000906020906060840190828701845b82811015612fcd5781516001600160a01b031684529284019290840190600101613020565b60008060006060848603121561305a57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156130c7576130c761309d565b5060010190565b600082198211156130e1576130e161309d565b500190565b60005b838110156131015781810151838201526020016130e9565b838111156115525750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161314a8160178501602088016130e6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161317b8160288401602088016130e6565b01602801949350505050565b60208152600082518060208401526131a68160408501602087016130e6565b601f01601f19169190910160400192915050565b6000828210156131cc576131cc61309d565b500390565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60006001600160401b038216806126a9576126a961309d565b60008160001904831182151516156132305761323061309d565b500290565b60006020828403121561324757600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b6000826132735761327361324e565b500690565b6000826132875761328761324e565b500490565b60006001600160401b03808316818516818304811182151516156132b2576132b261309d565b02949350505050565b60006001600160401b03808316818114156132d8576132d861309d565b6001019392505050565b6000816132f1576132f161309d565b50600019019056fe66a484cf1a3c6ef8dfd59d24824943d2853a29d96f34a01271efc55774452a518f8c450dae5029cd48cd91dd9db65da48fb742893edfc7941250f6721d93cbbe9a627a5d4aa7c17f87ff26e3fe9a42c2b6c559e8b41a42282d0ecebb17c0e4d3a264697066735822122098f321a15e730c34a6d98fbc280e4f867ee1796f076d47af61947cde4af9e1a564736f6c63430008090033
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.