Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 25 from a total of 2,276 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Commit | 6672351 | 149 days ago | IN | 0 ETH | 0.0006107 | ||||
Commit | 6672351 | 149 days ago | IN | 0 ETH | 0.000611 | ||||
Commit | 6672195 | 149 days ago | IN | 0 ETH | 0.00015769 | ||||
Commit | 6672046 | 149 days ago | IN | 0 ETH | 0.00010883 | ||||
Commit | 6672046 | 149 days ago | IN | 0 ETH | 0.00010883 | ||||
Commit | 6672046 | 149 days ago | IN | 0 ETH | 0.00010883 | ||||
Commit | 6672042 | 149 days ago | IN | 0 ETH | 0.00011653 | ||||
Commit | 6671283 | 149 days ago | IN | 0 ETH | 0.0003463 | ||||
Commit | 6671281 | 149 days ago | IN | 0 ETH | 0.00031042 | ||||
Commit | 6670828 | 149 days ago | IN | 0 ETH | 0.00024606 | ||||
Commit | 6670827 | 149 days ago | IN | 0 ETH | 0.00022419 | ||||
Commit | 6670676 | 149 days ago | IN | 0 ETH | 0.00021868 | ||||
Commit | 6670676 | 149 days ago | IN | 0 ETH | 0.00021868 | ||||
Commit | 6670676 | 149 days ago | IN | 0 ETH | 0.00021868 | ||||
Commit | 6670219 | 149 days ago | IN | 0 ETH | 0.00034301 | ||||
Commit | 6670219 | 149 days ago | IN | 0 ETH | 0.00034301 | ||||
Commit | 6670065 | 149 days ago | IN | 0 ETH | 0.00021872 | ||||
Commit | 6670065 | 149 days ago | IN | 0 ETH | 0.00021872 | ||||
Commit | 6669916 | 149 days ago | IN | 0 ETH | 0.00011055 | ||||
Commit | 6669916 | 149 days ago | IN | 0 ETH | 0.00011055 | ||||
Commit | 6669914 | 149 days ago | IN | 0 ETH | 0.00010885 | ||||
Commit | 6669765 | 149 days ago | IN | 0 ETH | 0.00017022 | ||||
Commit | 6669612 | 149 days ago | IN | 0 ETH | 0.00005247 | ||||
Commit | 6669612 | 149 days ago | IN | 0 ETH | 0.0000525 | ||||
Commit | 6669612 | 149 days ago | IN | 0 ETH | 0.0000525 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Redistribution
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.19; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./Util/TransformedChunkProof.sol"; import "./Util/ChunkProof.sol"; import "./Util/Signatures.sol"; import "./interface/IPostageStamp.sol"; interface IPriceOracle { function adjustPrice(uint16 redundancy) external; } interface IStakeRegistry { struct Stake { bytes32 overlay; uint256 stakeAmount; uint256 lastUpdatedBlockNumber; } function freezeDeposit(address _owner, uint256 _time) external; function lastUpdatedBlockNumberOfAddress(address _owner) external view returns (uint256); function overlayOfAddress(address _owner) external view returns (bytes32); function nodeEffectiveStake(address _owner) external view returns (uint256); } /** * @title Redistribution contract * @author The Swarm Authors * @dev Implements a Schelling Co-ordination game to form consensus around the Reserve Commitment hash. This takes * place in three phases: _commit_, _reveal_ and _claim_. * * A node, upon establishing that it _isParticipatingInUpcomingRound_, i.e. it's overlay falls within proximity order * of its reported depth with the _currentRoundAnchor_, prepares a "reserve commitment hash" using the chunks * it currently stores in its reserve and calculates the "storage depth" (see Bee for details). These values, if calculated * honestly, and with the right chunks stored, should be the same for every node in a neighbourhood. This is the Schelling point. * Each eligible node can then use these values, together with a random, single use, secret _revealNonce_ and their * _overlay_ as the pre-image values for the obsfucated _commit_, using the _wrapCommit_ method. * * Once the _commit_ round has elapsed, participating nodes must provide the values used to calculate their obsfucated * _commit_ hash, which, once verified for correctness and proximity to the anchor are retained in the _currentReveals_. * Nodes that have committed but do not reveal the correct values used to create the pre-image will have their stake * "frozen" for a period of rounds proportional to their reported depth. * * During the _reveal_ round, randomness is updated after every successful reveal. Once the reveal round is concluded, * the _currentRoundAnchor_ is updated and users can determine if they will be eligible their overlay will be eligible * for the next commit phase using _isParticipatingInUpcomingRound_. * * When the _reveal_ phase has been concluded, the claim phase can begin. At this point, the truth teller and winner * are already determined. By calling _isWinner_, an applicant node can run the relevant logic to determine if they have * been selected as the beneficiary of this round. When calling _claim_, the current pot from the PostageStamp contract * is withdrawn and transferred to that beneficiaries address. Nodes that have revealed values that differ from the truth, * have their stakes "frozen" for a period of rounds proportional to their reported depth. */ contract Redistribution is AccessControl, Pausable { // ----------------------------- Type declarations ------------------------------ // An eligible user may commit to an _obfuscatedHash_ during the commit phase... struct Commit { bytes32 overlay; address owner; bool revealed; uint256 stake; bytes32 obfuscatedHash; uint256 revealIndex; } // ...then provide the actual values that are the constituents of the pre-image of the _obfuscatedHash_ // during the reveal phase. struct Reveal { bytes32 overlay; address owner; uint8 depth; uint256 stake; uint256 stakeDensity; bytes32 hash; } struct ChunkInclusionProof { bytes32[] proofSegments; bytes32 proveSegment; // _RCspan is known for RC 32*32 // Inclusion proof of transformed address bytes32[] proofSegments2; bytes32 proveSegment2; // proveSegmentIndex2 known from deterministic random selection; uint64 chunkSpan; bytes32[] proofSegments3; // _proveSegment3 known, is equal _proveSegment2 // proveSegmentIndex3 know, is equal _proveSegmentIndex2; // chunkSpan2 is equal to chunkSpan (as the data is the same) // PostageProof postageProof; SOCProof[] socProof; } struct SOCProof { address signer; // signer Ethereum address to check against bytes signature; bytes32 identifier; // bytes32 chunkAddr; // wrapped chunk address } struct PostageProof { bytes signature; bytes32 postageId; uint64 index; uint64 timeStamp; // address signer; it is provided by the postage stamp contract // bytes32 chunkAddr; it equals to the proveSegment argument } // The address of the linked PostageStamp contract. IPostageStamp public PostageContract; // The address of the linked PriceOracle contract. IPriceOracle public OracleContract; // The address of the linked Staking contract. IStakeRegistry public Stakes; // Commits for the current round. Commit[] public currentCommits; // Reveals for the current round. Reveal[] public currentReveals; // The current anchor that being processed for the reveal and claim phases of the round. bytes32 private currentRevealRoundAnchor; // The current random value from which we will random. // inputs for selection of the truth teller and beneficiary. bytes32 private seed; // The number of the currently active round phases. uint64 public currentCommitRound; uint64 public currentRevealRound; uint64 public currentClaimRound; // Settings for slashing and freezing uint8 private penaltyMultiplierDisagreement = 1; uint8 private penaltyMultiplierNonRevealed = 2; uint8 private penaltyRandomFactor = 100; // Use 100 as value to ignore random factor in freezing penalty // alpha=0.097612 beta=0.0716570 k=16 uint256 private sampleMaxValue = 1284401000000000000000000000000000000000000000000000000000000000000000000; // The reveal of the winner of the last round. Reveal public winner; // The length of a round in blocks. uint256 private constant ROUND_LENGTH = 152; // Maximum value of the keccack256 hash. bytes32 private constant MAX_H = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; // ----------------------------- Events ------------------------------ /** * @dev Emitted when the winner of a round is selected in the claim phase */ event WinnerSelected(Reveal winner); /** * @dev Emitted when the truth oracle of a round is selected in the claim phase. */ event TruthSelected(bytes32 hash, uint8 depth); // Next two events to be removed after testing phase pending some other usefulness being found. /** * @dev Emits the number of commits being processed by the claim phase. */ event CountCommits(uint256 _count); /** * @dev Emits the number of reveals being processed by the claim phase. */ event CountReveals(uint256 _count); /** * @dev Logs that an overlay has committed */ event Committed(uint256 roundNumber, bytes32 overlay); /** * @dev Emit from Postagestamp contract valid chunk count at the end of claim */ event ChunkCount(uint256 validChunkCount); /** * @dev Bytes32 anhor of current reveal round */ event CurrentRevealAnchor(uint256 roundNumber, bytes32 anchor); /** * @dev Logs that an overlay has revealed */ event Revealed( uint256 roundNumber, bytes32 overlay, uint256 stake, uint256 stakeDensity, bytes32 reserveCommitment, uint8 depth ); /** * @dev Logs for inclusion proof */ event transformedChunkAddressFromInclusionProof(uint256 indexInRC, bytes32 chunkAddress); // ----------------------------- Errors ------------------------------ error NotCommitPhase(); // Game is not in commit phase error NoCommitsReceived(); // Round didn't receive any commits error PhaseLastBlock(); // We don't permit commits in last block of the phase error CommitRoundOver(); // Commit phase in this round is over error CommitRoundNotStarted(); // Commit phase in this round has not started yet error NotMatchingOwner(); // Sender of commit is not matching the overlay address error MustStake2Rounds(); // Before entering the game node must stake 2 rounds prior error NotStaked(); // Node didn't add any staking error WrongPhase(); // Checking in wrong phase, need to check duing claim phase of current round for next round or commit in current round error AlreadyCommitted(); // Node already committed in this round error NotRevealPhase(); // Game is not in reveal phase error OutOfDepthReveal(bytes32); // Anchor is out of reported depth in Reveal phase, anchor data available as argument error OutOfDepthClaim(uint8); // Anchor is out of reported depth in Claim phase, entryProof index is argument error OutOfDepth(); // Anchor is out of reported depth error AlreadyRevealed(); // Node already revealed error NoMatchingCommit(); // No matching commit and hash error NotClaimPhase(); // Game is not in the claim phase error NoReveals(); // Round did not receive any reveals error FirstRevealDone(); // We don't want to return value after first reveal error AlreadyClaimed(); // This round was already claimed error NotAdmin(); // Caller of trx is not admin error OnlyPauser(); // Only account with pauser role can call pause/unpause error SocVerificationFailed(bytes32); // Soc verification failed for this element error SocCalcNotMatching(bytes32); // Soc address calculation does not match with the witness error IndexOutsideSet(bytes32); // Stamp available: index resides outside of the valid index set error SigRecoveryFailed(bytes32); // Stamp authorized: signature recovery failed for element error BatchDoesNotExist(bytes32); // Stamp alive: batch remaining balance validation failed for attached stamp error BucketDiffers(bytes32); // Stamp aligned: postage bucket differs from address bucket error InclusionProofFailed(uint8, bytes32); // 1 = RC inclusion proof failed for element // 2 = First sister segment in data must match, // 3 = Inclusion proof failed for original address of element // 4 = Inclusion proof failed for transformed address of element error RandomElementCheckFailed(); // Random element order check failed error LastElementCheckFailed(); // Last element order check failed error ReserveCheckFailed(bytes32 trALast); // Reserve size estimation check failed // ----------------------------- CONSTRUCTOR ------------------------------ /** * @param staking the address of the linked Staking contract. * @param postageContract the address of the linked PostageStamp contract. * @param oracleContract the address of the linked PriceOracle contract. */ constructor(address staking, address postageContract, address oracleContract) { Stakes = IStakeRegistry(staking); PostageContract = IPostageStamp(postageContract); OracleContract = IPriceOracle(oracleContract); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } //////////////////////////////////////// // STATE CHANGING // //////////////////////////////////////// /** * @notice Begin application for a round if eligible. Commit a hashed value for which the pre-image will be * subsequently revealed. * @dev If a node's overlay is _inProximity_(_depth_) of the _currentRoundAnchor_, that node may compute an * _obfuscatedHash_ by providing their _overlay_, reported storage _depth_, reserve commitment _hash_ and a * randomly generated, and secret _revealNonce_ to the _wrapCommit_ method. * @param _obfuscatedHash The calculated hash resultant of the required pre-image values. * and be derived from the same key pair as the message sender. * @param _roundNumber Node needs to provide round number for which commit is valid */ function commit(bytes32 _obfuscatedHash, uint64 _roundNumber) external whenNotPaused { uint64 cr = currentRound(); bytes32 _overlay = Stakes.overlayOfAddress(msg.sender); uint256 _stake = Stakes.nodeEffectiveStake(msg.sender); uint256 _lastUpdate = Stakes.lastUpdatedBlockNumberOfAddress(msg.sender); if (!currentPhaseCommit()) { revert NotCommitPhase(); } if (block.number % ROUND_LENGTH == (ROUND_LENGTH / 4) - 1) { revert PhaseLastBlock(); } if (cr > _roundNumber) { revert CommitRoundOver(); } if (cr < _roundNumber) { revert CommitRoundNotStarted(); } if (_lastUpdate == 0) { revert NotStaked(); } if (_lastUpdate >= block.number - 2 * ROUND_LENGTH) { revert MustStake2Rounds(); } // if we are in a new commit phase, reset the array of commits and // set the currentCommitRound to be the current one if (cr != currentCommitRound) { delete currentCommits; currentCommitRound = cr; } uint256 commitsArrayLength = currentCommits.length; for (uint256 i = 0; i < commitsArrayLength; ) { if (currentCommits[i].overlay == _overlay) { revert AlreadyCommitted(); } unchecked { ++i; } } currentCommits.push( Commit({ overlay: _overlay, owner: msg.sender, revealed: false, stake: _stake, obfuscatedHash: _obfuscatedHash, revealIndex: 0 }) ); emit Committed(_roundNumber, _overlay); } /** * @notice Reveal the pre-image values used to generate commit provided during this round's commit phase. * @param _depth The reported depth. * @param _hash The reserve commitment hash. * @param _revealNonce The nonce used to generate the commit that is being revealed. */ function reveal(uint8 _depth, bytes32 _hash, bytes32 _revealNonce) external whenNotPaused { uint64 cr = currentRound(); bytes32 _overlay = Stakes.overlayOfAddress(msg.sender); if (_depth < currentMinimumDepth()) { revert OutOfDepth(); } if (!currentPhaseReveal()) { revert NotRevealPhase(); } if (cr != currentCommitRound) { revert NoCommitsReceived(); } if (cr != currentRevealRound) { currentRevealRoundAnchor = currentRoundAnchor(); delete currentReveals; // We set currentRevealRound ONLY after we set current anchor currentRevealRound = cr; emit CurrentRevealAnchor(cr, currentRevealRoundAnchor); updateRandomness(); } bytes32 obfuscatedHash = wrapCommit(_overlay, _depth, _hash, _revealNonce); uint256 id = findCommit(_overlay, obfuscatedHash); Commit memory revealedCommit = currentCommits[id]; // Check that commit is in proximity of the current anchor if (!inProximity(revealedCommit.overlay, currentRevealRoundAnchor, _depth)) { revert OutOfDepthReveal(currentRevealRoundAnchor); } // Check that the commit has not already been revealed if (revealedCommit.revealed) { revert AlreadyRevealed(); } currentCommits[id].revealed = true; currentCommits[id].revealIndex = currentReveals.length; currentReveals.push( Reveal({ overlay: revealedCommit.overlay, owner: revealedCommit.owner, depth: _depth, stake: revealedCommit.stake, stakeDensity: revealedCommit.stake * uint256(2 ** _depth), hash: _hash }) ); emit Revealed( cr, revealedCommit.overlay, revealedCommit.stake, revealedCommit.stake * uint256(2 ** _depth), _hash, _depth ); } /** * @notice Helper function to get this round truth * @dev */ function claim( ChunkInclusionProof calldata entryProof1, ChunkInclusionProof calldata entryProof2, ChunkInclusionProof calldata entryProofLast ) external whenNotPaused { winnerSelection(); Reveal memory winnerSelected = winner; uint256 indexInRC1; uint256 indexInRC2; bytes32 _currentRevealRoundAnchor = currentRevealRoundAnchor; bytes32 _seed = seed; // rand(14) indexInRC1 = uint256(_seed) % 15; // rand(13) indexInRC2 = uint256(_seed) % 14; if (indexInRC2 >= indexInRC1) { indexInRC2++; } if (!inProximity(entryProofLast.proveSegment, _currentRevealRoundAnchor, winnerSelected.depth)) { revert OutOfDepthClaim(3); } inclusionFunction(entryProofLast, 30); stampFunction(entryProofLast); socFunction(entryProofLast); if (!inProximity(entryProof1.proveSegment, _currentRevealRoundAnchor, winnerSelected.depth)) { revert OutOfDepthClaim(2); } inclusionFunction(entryProof1, indexInRC1 * 2); stampFunction(entryProof1); socFunction(entryProof1); if (!inProximity(entryProof2.proveSegment, _currentRevealRoundAnchor, winnerSelected.depth)) { revert OutOfDepthClaim(1); } inclusionFunction(entryProof2, indexInRC2 * 2); stampFunction(entryProof2); socFunction(entryProof2); checkOrder( indexInRC1, indexInRC2, entryProof1.proofSegments[0], entryProof2.proofSegments[0], entryProofLast.proofSegments[0] ); estimateSize(entryProofLast.proofSegments[0]); PostageContract.withdraw(winnerSelected.owner); emit WinnerSelected(winnerSelected); emit ChunkCount(PostageContract.validChunkCount()); } function winnerSelection() internal { uint64 cr = currentRound(); if (!currentPhaseClaim()) { revert NotClaimPhase(); } if (cr != currentRevealRound) { revert NoReveals(); } if (cr <= currentClaimRound) { revert AlreadyClaimed(); } uint256 currentWinnerSelectionSum = 0; uint256 redundancyCount = 0; bytes32 randomNumber; uint256 randomNumberTrunc; bytes32 truthRevealedHash; uint8 truthRevealedDepth; uint256 currentCommitsLength = currentCommits.length; emit CountCommits(currentCommitsLength); emit CountReveals(currentReveals.length); (truthRevealedHash, truthRevealedDepth) = getCurrentTruth(); emit TruthSelected(truthRevealedHash, truthRevealedDepth); string memory winnerSelectionAnchor = currentWinnerSelectionAnchor(); for (uint256 i = 0; i < currentCommitsLength; ) { Commit memory currentCommit = currentCommits[i]; uint256 revIndex = currentCommit.revealIndex; Reveal memory currentReveal = currentReveals[revIndex]; // Select winner with valid truth if ( currentCommit.revealed && truthRevealedHash == currentReveal.hash && truthRevealedDepth == currentReveal.depth ) { currentWinnerSelectionSum += currentReveal.stakeDensity; randomNumber = keccak256(abi.encodePacked(winnerSelectionAnchor, redundancyCount)); randomNumberTrunc = uint256(randomNumber & MAX_H); if (randomNumberTrunc * currentWinnerSelectionSum < currentReveal.stakeDensity * (uint256(MAX_H) + 1)) { winner = currentReveal; } redundancyCount++; } // Freeze deposit if any truth is false, make it a penaltyRandomFactor chance for this to happen if ( currentCommit.revealed && (truthRevealedHash != currentReveal.hash || truthRevealedDepth != currentReveal.depth) && (block.prevrandao % 100 < penaltyRandomFactor) ) { Stakes.freezeDeposit( currentReveal.owner, penaltyMultiplierDisagreement * ROUND_LENGTH * uint256(2 ** truthRevealedDepth) ); } // Slash deposits if revealed is false if (!currentCommit.revealed) { // slash in later phase (ph5) // Stakes.slashDeposit(currentCommits[i].overlay, currentCommits[i].stake); Stakes.freezeDeposit( currentCommit.owner, penaltyMultiplierNonRevealed * ROUND_LENGTH * uint256(2 ** truthRevealedDepth) ); } unchecked { ++i; } } OracleContract.adjustPrice(uint16(redundancyCount)); currentClaimRound = cr; } function inclusionFunction(ChunkInclusionProof calldata entryProof, uint256 indexInRC) internal { uint256 randomChunkSegmentIndex = uint256(seed) % 128; bytes32 calculatedTransformedAddr = TransformedBMTChunk.transformedChunkAddressFromInclusionProof( entryProof.proofSegments3, entryProof.proveSegment2, randomChunkSegmentIndex, entryProof.chunkSpan, currentRevealRoundAnchor ); emit transformedChunkAddressFromInclusionProof(indexInRC, calculatedTransformedAddr); if ( winner.hash != BMTChunk.chunkAddressFromInclusionProof( entryProof.proofSegments, entryProof.proveSegment, indexInRC, 32 * 32 ) ) { revert InclusionProofFailed(1, calculatedTransformedAddr); } if (entryProof.proofSegments2[0] != entryProof.proofSegments3[0]) { revert InclusionProofFailed(2, calculatedTransformedAddr); } bytes32 originalAddress = entryProof.socProof.length > 0 ? entryProof.socProof[0].chunkAddr // soc attestation in socFunction : entryProof.proveSegment; if ( originalAddress != BMTChunk.chunkAddressFromInclusionProof( entryProof.proofSegments2, entryProof.proveSegment2, randomChunkSegmentIndex, entryProof.chunkSpan ) ) { revert InclusionProofFailed(3, calculatedTransformedAddr); } // In case of SOC, the transformed address is hashed together with its address in the sample if (entryProof.socProof.length > 0) { calculatedTransformedAddr = keccak256( abi.encode( entryProof.proveSegment, // SOC address calculatedTransformedAddr ) ); } if (entryProof.proofSegments[0] != calculatedTransformedAddr) { revert InclusionProofFailed(4, calculatedTransformedAddr); } } /** * @notice Set freezing parameters */ function setFreezingParams( uint8 _penaltyMultiplierDisagreement, uint8 _penaltyMultiplierNonRevealed, uint8 _penaltyRandomFactor ) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert NotAdmin(); } penaltyMultiplierDisagreement = _penaltyMultiplierDisagreement; penaltyMultiplierNonRevealed = _penaltyMultiplierNonRevealed; penaltyRandomFactor = _penaltyRandomFactor; } /** * @notice changes the max sample value used for reserve estimation */ function setSampleMaxValue(uint256 _sampleMaxValue) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert NotAdmin(); } sampleMaxValue = _sampleMaxValue; } /** * @notice Updates the source of randomness. Uses block.difficulty in pre-merge chains, this is substituted * to block.prevrandao in post merge chains. */ function updateRandomness() private { seed = keccak256(abi.encode(seed, block.prevrandao)); } /** * @dev Pause the contract. The contract is provably stopped by renouncing the pauser role and the admin role after pausing, can only be called by the `PAUSER` */ function pause() public { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert OnlyPauser(); } _pause(); } /** * @dev Unpause the contract, can only be called by the pauser when paused */ function unPause() public { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert OnlyPauser(); } _unpause(); } //////////////////////////////////////// // STATE READING // //////////////////////////////////////// // ----------------------------- Anchor calculations ------------------------------ /** * @notice Returns the current random seed which is used to determine later utilised random numbers. * If rounds have elapsed without reveals, hash the seed with an incremented nonce to produce a new * random seed and hence a new round anchor. */ function currentSeed() public view returns (bytes32) { uint64 cr = currentRound(); bytes32 currentSeedValue = seed; if (cr > currentRevealRound + 1) { uint256 difference = cr - currentRevealRound - 1; currentSeedValue = keccak256(abi.encodePacked(currentSeedValue, difference)); } return currentSeedValue; } /** * @notice Returns the seed which will become current once the next commit phase begins. * Used to determine what the next round's anchor will be. */ function nextSeed() public view returns (bytes32) { uint64 cr = currentRound() + 1; bytes32 currentSeedValue = seed; if (cr > currentRevealRound + 1) { uint256 difference = cr - currentRevealRound - 1; currentSeedValue = keccak256(abi.encodePacked(currentSeedValue, difference)); } return currentSeedValue; } /** * @notice The random value used to choose the selected truth teller. */ function currentTruthSelectionAnchor() private view returns (string memory) { if (!currentPhaseClaim()) { revert NotClaimPhase(); } uint64 cr = currentRound(); if (cr != currentRevealRound) { revert NoReveals(); } return string(abi.encodePacked(seed, "0")); } /** * @notice The random value used to choose the selected beneficiary. */ function currentWinnerSelectionAnchor() private view returns (string memory) { if (!currentPhaseClaim()) { revert NotClaimPhase(); } uint64 cr = currentRound(); if (cr != currentRevealRound) { revert NoReveals(); } return string(abi.encodePacked(seed, "1")); } /** * @notice The anchor used to determine eligibility for the current round. * @dev A node must be within proximity order of less than or equal to the storage depth they intend to report. */ function currentRoundAnchor() public view returns (bytes32 returnVal) { // This will be called in reveal phase and set as currentRevealRoundAnchor or in // commit phase when checking eligibility for next round by isParticipatingInUpcomingRound if (currentPhaseCommit() || (currentRound() > currentRevealRound && !currentPhaseClaim())) { return currentSeed(); } // This will be called by isParticipatingInUpcomingRound check in claim phase if (currentPhaseClaim()) { return nextSeed(); } // Without this, this function will output 0x0 after first reveal which is value and we prefere it reverts if (currentPhaseReveal() && currentRound() == currentRevealRound) { revert FirstRevealDone(); } } /** * @notice Returns true if an overlay address _A_ is within proximity order _minimum_ of _B_. * @param A An overlay address to compare. * @param B An overlay address to compare. * @param minimum Minimum proximity order. */ function inProximity(bytes32 A, bytes32 B, uint8 minimum) public pure returns (bool) { if (minimum == 0) { return true; } return uint256(A ^ B) < uint256(2 ** (256 - minimum)); } // ----------------------------- Commit ------------------------------ /** * @notice The number of the current round. */ function currentRound() public view returns (uint64) { return uint64(block.number / ROUND_LENGTH); } /** * @notice Returns true if current block is during commit phase. */ function currentPhaseCommit() public view returns (bool) { if (block.number % ROUND_LENGTH < ROUND_LENGTH / 4) { return true; } return false; } /** * @notice Determine if a the owner of a given overlay can participate in the upcoming round. * @param _owner The address of the applicant from. * @param _depth The storage depth the applicant intends to report. */ function isParticipatingInUpcomingRound(address _owner, uint8 _depth) public view returns (bool) { if (currentPhaseReveal()) { revert WrongPhase(); } if (Stakes.lastUpdatedBlockNumberOfAddress(_owner) >= block.number - 2 * ROUND_LENGTH) { revert MustStake2Rounds(); } return inProximity(Stakes.overlayOfAddress(_owner), currentRoundAnchor(), _depth); } // ----------------------------- Reveal ------------------------------ /** * @notice Returns minimum depth reveal has to have to participate in this round */ function currentMinimumDepth() public view returns (uint8) { // We are checking value in reveal phase, as the currentCommitRound is set to the current round // but the currentClaimRound is still set to the last time claim was made // We add 1 to ensure that for the next round the minimum depth is the same as last winner depth uint256 difference = currentCommitRound - currentClaimRound; uint8 skippedRounds = uint8(difference > 254 ? 254 : difference) + 1; uint8 lastWinnerDepth = winner.depth; // We ensure that skippedRounds is not bigger than lastWinnerDepth, because of overflow return skippedRounds >= lastWinnerDepth ? 0 : lastWinnerDepth - skippedRounds; } /** * @notice Helper function to get this node reveal in commits * @dev */ function findCommit(bytes32 _overlay, bytes32 _obfuscatedHash) internal view returns (uint256) { for (uint256 i = 0; i < currentCommits.length; ) { if (currentCommits[i].overlay == _overlay && _obfuscatedHash == currentCommits[i].obfuscatedHash) { return i; } unchecked { ++i; } } revert NoMatchingCommit(); } /** * @notice Hash the pre-image values to the obsfucated hash. * @dev _revealNonce_ must be randomly generated, used once and kept secret until the reveal phase. * @param _overlay The overlay address of the applicant. * @param _depth The reported depth. * @param _hash The reserve commitment hash. * @param revealNonce A random, single use, secret nonce. */ function wrapCommit( bytes32 _overlay, uint8 _depth, bytes32 _hash, bytes32 revealNonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_overlay, _depth, _hash, revealNonce)); } /** * @notice Returns true if current block is during reveal phase. */ function currentPhaseReveal() public view returns (bool) { uint256 number = block.number % ROUND_LENGTH; if (number >= ROUND_LENGTH / 4 && number < ROUND_LENGTH / 2) { return true; } return false; } /** * @notice Returns true if current block is during reveal phase. */ function currentRoundReveals() public view returns (Reveal[] memory) { if (!currentPhaseClaim()) { revert NotClaimPhase(); } uint64 cr = currentRound(); if (cr != currentRevealRound) { revert NoReveals(); } return currentReveals; } // ----------------------------- Claim ------------------------------ /** * @notice Returns true if current block is during claim phase. */ function currentPhaseClaim() public view returns (bool) { if (block.number % ROUND_LENGTH >= ROUND_LENGTH / 2) { return true; } return false; } function getCurrentTruth() internal view returns (bytes32 Hash, uint8 Depth) { uint256 currentSum; bytes32 randomNumber; uint256 randomNumberTrunc; bytes32 truthRevealedHash; uint8 truthRevealedDepth; uint256 revIndex; string memory truthSelectionAnchor = currentTruthSelectionAnchor(); uint256 commitsArrayLength = currentCommits.length; for (uint256 i = 0; i < commitsArrayLength; ) { if (currentCommits[i].revealed) { revIndex = currentCommits[i].revealIndex; currentSum += currentReveals[revIndex].stakeDensity; randomNumber = keccak256(abi.encodePacked(truthSelectionAnchor, i)); randomNumberTrunc = uint256(randomNumber & MAX_H); // question is whether randomNumber / MAX_H < probability // where probability is stakeDensity / currentSum // to avoid resorting to floating points all divisions should be // simplified with multiplying both sides (as long as divisor > 0) // randomNumber / (MAX_H + 1) < stakeDensity / currentSum // ( randomNumber / (MAX_H + 1) ) * currentSum < stakeDensity // randomNumber * currentSum < stakeDensity * (MAX_H + 1) if (randomNumberTrunc * currentSum < currentReveals[revIndex].stakeDensity * (uint256(MAX_H) + 1)) { truthRevealedHash = currentReveals[revIndex].hash; truthRevealedDepth = currentReveals[revIndex].depth; } } unchecked { ++i; } } return (truthRevealedHash, truthRevealedDepth); } /** * @notice Determine if a the owner of a given overlay will be the beneficiary of the claim phase. * @param _overlay The overlay address of the applicant. */ function isWinner(bytes32 _overlay) public view returns (bool) { if (!currentPhaseClaim()) { revert NotClaimPhase(); } uint64 cr = currentRound(); if (cr != currentRevealRound) { revert NoReveals(); } if (cr <= currentClaimRound) { revert AlreadyClaimed(); } uint256 currentWinnerSelectionSum; bytes32 winnerIs; bytes32 randomNumber; uint256 randomNumberTrunc; bytes32 truthRevealedHash; uint8 truthRevealedDepth; uint256 revIndex; string memory winnerSelectionAnchor = currentWinnerSelectionAnchor(); uint256 redundancyCount = 0; // Get current truth (truthRevealedHash, truthRevealedDepth) = getCurrentTruth(); uint256 commitsArrayLength = currentCommits.length; for (uint256 i = 0; i < commitsArrayLength; ) { revIndex = currentCommits[i].revealIndex; // Deterministically read winner if ( currentCommits[i].revealed && truthRevealedHash == currentReveals[revIndex].hash && truthRevealedDepth == currentReveals[revIndex].depth ) { currentWinnerSelectionSum += currentReveals[revIndex].stakeDensity; randomNumber = keccak256(abi.encodePacked(winnerSelectionAnchor, redundancyCount)); randomNumberTrunc = uint256(randomNumber & MAX_H); if ( randomNumberTrunc * currentWinnerSelectionSum < currentReveals[revIndex].stakeDensity * (uint256(MAX_H) + 1) ) { winnerIs = currentReveals[revIndex].overlay; } redundancyCount++; } unchecked { ++i; } } return (winnerIs == _overlay); } // ----------------------------- Claim verifications ------------------------------ function socFunction(ChunkInclusionProof calldata entryProof) internal pure { if (entryProof.socProof.length == 0) return; if ( !Signatures.socVerify( entryProof.socProof[0].signer, // signer Ethereum address to check against entryProof.socProof[0].signature, entryProof.socProof[0].identifier, entryProof.socProof[0].chunkAddr ) ) { revert SocVerificationFailed(entryProof.socProof[0].chunkAddr); } if ( calculateSocAddress(entryProof.socProof[0].identifier, entryProof.socProof[0].signer) != entryProof.proveSegment ) { revert SocCalcNotMatching(entryProof.socProof[0].chunkAddr); } } function stampFunction(ChunkInclusionProof calldata entryProof) internal view { // authentic (address batchOwner, uint8 batchDepth, uint8 bucketDepth, , , ) = PostageContract.batches( entryProof.postageProof.postageId ); // alive if (batchOwner == address(0)) { revert BatchDoesNotExist(entryProof.postageProof.postageId); // Batch does not exist or expired } uint32 postageIndex = getPostageIndex(entryProof.postageProof.index); uint256 maxPostageIndex = postageStampIndexCount(batchDepth, bucketDepth); // available if (postageIndex >= maxPostageIndex) { revert IndexOutsideSet(entryProof.postageProof.postageId); } // aligned uint64 postageBucket = getPostageBucket(entryProof.postageProof.index); uint64 addressBucket = addressToBucket(entryProof.proveSegment, bucketDepth); if (postageBucket != addressBucket) { revert BucketDiffers(entryProof.postageProof.postageId); } // authorized if ( !Signatures.postageVerify( batchOwner, entryProof.postageProof.signature, entryProof.proveSegment, entryProof.postageProof.postageId, entryProof.postageProof.index, entryProof.postageProof.timeStamp ) ) { revert SigRecoveryFailed(entryProof.postageProof.postageId); } } function addressToBucket(bytes32 swarmAddress, uint8 bucketDepth) internal pure returns (uint32) { uint32 prefix = uint32(uint256(swarmAddress) >> (256 - 32)); return prefix >> (32 - bucketDepth); } function postageStampIndexCount(uint8 postageDepth, uint8 bucketDepth) internal pure returns (uint256) { return 1 << (postageDepth - bucketDepth); } function getPostageIndex(uint64 signedIndex) internal pure returns (uint32) { return uint32(signedIndex); } function getPostageBucket(uint64 signedIndex) internal pure returns (uint64) { return uint32(signedIndex >> 32); } function calculateSocAddress(bytes32 identifier, address signer) internal pure returns (bytes32) { return keccak256(abi.encodePacked(identifier, signer)); } function checkOrder(uint256 a, uint256 b, bytes32 trA1, bytes32 trA2, bytes32 trALast) internal pure { if (a < b) { if (uint256(trA1) >= uint256(trA2)) { revert RandomElementCheckFailed(); } if (uint256(trA2) >= uint256(trALast)) { revert LastElementCheckFailed(); } } else { if (uint256(trA2) >= uint256(trA1)) { revert RandomElementCheckFailed(); } if (uint256(trA1) >= uint256(trALast)) { revert LastElementCheckFailed(); } } } function estimateSize(bytes32 trALast) internal view { if (uint256(trALast) >= sampleMaxValue) { revert ReserveCheckFailed(trALast); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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; } mapping(bytes32 => RoleData) private _roles; 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); _; } /** * @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 virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @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 virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " 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 virtual override returns (bytes32) { return _roles[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. * * May emit a {RoleGranted} event. */ 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. * * May emit a {RoleRevoked} event. */ 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`. * * May emit a {RoleRevoked} event. */ 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. * * May emit a {RoleGranted} event. * * [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); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// 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 (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// 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 (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.19; interface IPostageStamp { function withdraw(address beneficiary) external; function validChunkCount() external view returns (uint256); function batchOwner(bytes32 _batchId) external view returns (address); function batchDepth(bytes32 _batchId) external view returns (uint8); function batchBucketDepth(bytes32 _batchId) external view returns (uint8); function remainingBalance(bytes32 _batchId) external view returns (uint256); function minimumInitialBalancePerChunk() external view returns (uint256); function setPrice(uint256 _price) external; function batches( bytes32 ) external view returns ( address owner, uint8 depth, uint8 bucketDepth, bool immutableFlag, uint256 normalisedBalance, uint256 lastUpdatedBlockNumber ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; library BMTChunk { // max chunk payload size uint256 public constant MAX_CHUNK_PAYLOAD_SIZE = 4096; // segment byte size uint256 public constant SEGMENT_SIZE = 32; /** * @notice Changes the endianness of a uint64. * @dev https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel * @param _b The unsigned integer to reverse * @return v - The reversed value */ function reverseUint64(uint64 _b) public pure returns (uint64) { uint256 v = _b; // swap bytes v = ((v >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) | ((v & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8); // swap 2-byte long pairs v = ((v >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) | ((v & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16); // swap 4-byte long pairs v = ((v >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32); return uint64(v); } /** Calculates the root hash from the provided inclusion proof segments and its corresponding segment index * @param _proofSegments Proof segments. * @param _proveSegment Segment to prove. * @param _proveSegmentIndex Prove segment index * @return _calculatedHash chunk hash */ function rootHashFromInclusionProof( bytes32[] memory _proofSegments, bytes32 _proveSegment, uint256 _proveSegmentIndex ) internal pure returns (bytes32 _calculatedHash) { _calculatedHash = _proveSegment; for (uint256 i = 0; i < _proofSegments.length; i++) { bool mergeFromRight = _proveSegmentIndex % 2 == 0; _calculatedHash = mergeSegment(_calculatedHash, _proofSegments[i], mergeFromRight); _proveSegmentIndex >>= 1; } return _calculatedHash; } /** * Calculate the chunk address from the Binary Merkle Tree of the chunk data * * The BMT chunk address is the hash of the 8 byte span and the root * hash of a binary Merkle tree (BMT) built on the 32-byte segments * of the underlying data. * @param _proofSegments Proof segments. * @param _proveSegment Segment to prove. * @param _proveSegmentIndex Prove segment index * @param _chunkSpan chunk bytes length * @return _chunkHash chunk hash */ function chunkAddressFromInclusionProof( bytes32[] memory _proofSegments, bytes32 _proveSegment, uint256 _proveSegmentIndex, uint64 _chunkSpan ) internal pure returns (bytes32) { bytes32 rootHash = rootHashFromInclusionProof(_proofSegments, _proveSegment, _proveSegmentIndex); return keccak256(abi.encodePacked(reverseUint64(_chunkSpan), rootHash)); } function mergeSegment( bytes32 _calculatedHash, bytes32 _proofSegment, bool mergeFromRight ) internal pure returns (bytes32 res) { if (mergeFromRight) { res = keccak256(abi.encode(_calculatedHash, _proofSegment)); } else { res = keccak256(abi.encode(_proofSegment, _calculatedHash)); } return res; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; library Signatures { error InvalidSignatureLength(); /** Hash of the message to sign */ function getPostageMessageHash( bytes32 _chunkAddr, bytes32 _batchId, uint64 _index, uint64 _timeStamp ) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_chunkAddr, _batchId, _index, _timeStamp)); } function postageVerify( address _signer, // signer Ethereum address to check against bytes memory _signature, bytes32 _chunkAddr, bytes32 _postageId, uint64 _index, uint64 _timeStamp ) internal pure returns (bool) { bytes32 messageHash = getPostageMessageHash(_chunkAddr, _postageId, _index, _timeStamp); bytes32 ethMessageHash = getEthSignedMessageHash(messageHash); return recoverSigner(ethMessageHash, _signature) == _signer; } function getEthSignedMessageHash(bytes32 _messageHash) internal pure returns (bytes32) { /* Signature is produced by signing a keccak256 hash with the following format: "\x19Ethereum Signed Message\n" + len(msg) + msg */ return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash)); } function recoverSigner( bytes32 _ethSignedMessageHash, // it has to be prefixed message: https://ethereum.stackexchange.com/questions/19582/does-ecrecover-in-solidity-expects-the-x19ethereum-signed-message-n-prefix/21037 bytes memory _signature ) internal pure returns (address) { (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature); return ecrecover(_ethSignedMessageHash, v, r, s); } function splitSignature(bytes memory sig) internal pure returns (bytes32 r_, bytes32 s_, uint8 v_) { if (sig.length != 65) { revert InvalidSignatureLength(); } assembly { /* verbose explanation: https://ethereum.stackexchange.com/questions/135591/split-signature-function-in-solidity-by-example-docs First 32 bytes stores the length of the signature add(sig, 32) = pointer of sig + 32 effectively, skips first 32 bytes of signature mload(p) loads next 32 bytes starting at the memory address p into memory */ // first 32 bytes, after the length prefix r_ := mload(add(sig, 32)) // second 32 bytes s_ := mload(add(sig, 64)) // final byte (first byte of the next 32 bytes) v_ := byte(0, mload(add(sig, 96))) } // implicitly return (r, s, v) } function getSocMessageHash(bytes32 _identifier, bytes32 _chunkAddr) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_identifier, _chunkAddr)); } function socVerify( address _signer, // signer Ethereum address to check against bytes memory _signature, bytes32 _identifier, bytes32 _chunkAddr ) internal pure returns (bool) { bytes32 messageHash = getSocMessageHash(_identifier, _chunkAddr); bytes32 ethMessageHash = getEthSignedMessageHash(messageHash); return recoverSigner(ethMessageHash, _signature) == _signer; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; library TransformedBMTChunk { // max chunk payload size uint256 public constant MAX_CHUNK_PAYLOAD_SIZE = 4096; // segment byte size uint256 public constant SEGMENT_SIZE = 32; /** Calculates the root hash from the provided inclusion proof segments and its corresponding segment index * @param _proofSegments Proof segments. * @param _proveSegment Segment to prove. * @param _proveSegmentIndex Prove segment index * @return _calculatedHash chunk hash */ function transformedRootHashFromInclusionProof( bytes32[] memory _proofSegments, bytes32 _proveSegment, uint256 _proveSegmentIndex, bytes32 key ) internal pure returns (bytes32 _calculatedHash) { _calculatedHash = _proveSegment; for (uint256 i = 0; i < _proofSegments.length; i++) { bool mergeFromRight = _proveSegmentIndex % 2 == 0 ? true : false; _calculatedHash = transformedMergeSegment(_calculatedHash, _proofSegments[i], mergeFromRight, key); _proveSegmentIndex >>= 1; } return _calculatedHash; } /** * @notice Changes the endianness of a uint64. * @dev https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel * @param _b The unsigned integer to reverse * @return v - The reversed value */ function reverseUint64(uint64 _b) public pure returns (uint64) { uint256 v = _b; // swap bytes v = ((v >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) | ((v & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8); // swap 2-byte long pairs v = ((v >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) | ((v & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16); // swap 4-byte long pairs v = ((v >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32); return uint64(v); } /** * Calculate the chunk address from the Binary Merkle Tree of the chunk data * * The BMT chunk address is the hash of the 8 byte span and the root * hash of a binary Merkle tree (BMT) built on the 32-byte segments * of the underlying data. * @param _proofSegments Proof segments. * @param _proveSegment Segment to prove. * @param _proveSegmentIndex Prove segment index * @param _chunkSpan chunk bytes length * @return _chunkHash chunk hash */ function transformedChunkAddressFromInclusionProof( bytes32[] memory _proofSegments, bytes32 _proveSegment, uint256 _proveSegmentIndex, uint64 _chunkSpan, bytes32 key ) internal pure returns (bytes32) { bytes32 rootHash = transformedRootHashFromInclusionProof( _proofSegments, _proveSegment, _proveSegmentIndex, key ); return keccak256(abi.encodePacked(key, reverseUint64(_chunkSpan), rootHash)); } function transformedMergeSegment( bytes32 _calculatedHash, bytes32 _proofSegment, bool mergeFromRight, bytes32 key ) internal pure returns (bytes32 res) { if (mergeFromRight) { res = keccak256(abi.encode(key, _calculatedHash, _proofSegment)); } else { res = keccak256(abi.encode(key, _proofSegment, _calculatedHash)); } return res; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"staking","type":"address"},{"internalType":"address","name":"postageContract","type":"address"},{"internalType":"address","name":"oracleContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"AlreadyCommitted","type":"error"},{"inputs":[],"name":"AlreadyRevealed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"BatchDoesNotExist","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"BucketDiffers","type":"error"},{"inputs":[],"name":"CommitRoundNotStarted","type":"error"},{"inputs":[],"name":"CommitRoundOver","type":"error"},{"inputs":[],"name":"FirstRevealDone","type":"error"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"InclusionProofFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"IndexOutsideSet","type":"error"},{"inputs":[],"name":"InvalidSignatureLength","type":"error"},{"inputs":[],"name":"LastElementCheckFailed","type":"error"},{"inputs":[],"name":"MustStake2Rounds","type":"error"},{"inputs":[],"name":"NoCommitsReceived","type":"error"},{"inputs":[],"name":"NoMatchingCommit","type":"error"},{"inputs":[],"name":"NoReveals","type":"error"},{"inputs":[],"name":"NotAdmin","type":"error"},{"inputs":[],"name":"NotClaimPhase","type":"error"},{"inputs":[],"name":"NotCommitPhase","type":"error"},{"inputs":[],"name":"NotMatchingOwner","type":"error"},{"inputs":[],"name":"NotRevealPhase","type":"error"},{"inputs":[],"name":"NotStaked","type":"error"},{"inputs":[],"name":"OnlyPauser","type":"error"},{"inputs":[],"name":"OutOfDepth","type":"error"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"OutOfDepthClaim","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"OutOfDepthReveal","type":"error"},{"inputs":[],"name":"PhaseLastBlock","type":"error"},{"inputs":[],"name":"RandomElementCheckFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"trALast","type":"bytes32"}],"name":"ReserveCheckFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"SigRecoveryFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"SocCalcNotMatching","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"SocVerificationFailed","type":"error"},{"inputs":[],"name":"WrongPhase","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"validChunkCount","type":"uint256"}],"name":"ChunkCount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"roundNumber","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"overlay","type":"bytes32"}],"name":"Committed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_count","type":"uint256"}],"name":"CountCommits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_count","type":"uint256"}],"name":"CountReveals","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"roundNumber","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"anchor","type":"bytes32"}],"name":"CurrentRevealAnchor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"roundNumber","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"overlay","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"stake","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakeDensity","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"reserveCommitment","type":"bytes32"},{"indexed":false,"internalType":"uint8","name":"depth","type":"uint8"}],"name":"Revealed","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"uint8","name":"depth","type":"uint8"}],"name":"TruthSelected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"bytes32","name":"overlay","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"depth","type":"uint8"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeDensity","type":"uint256"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"indexed":false,"internalType":"struct Redistribution.Reveal","name":"winner","type":"tuple"}],"name":"WinnerSelected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"indexInRC","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"chunkAddress","type":"bytes32"}],"name":"transformedChunkAddressFromInclusionProof","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OracleContract","outputs":[{"internalType":"contract IPriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PostageContract","outputs":[{"internalType":"contract IPostageStamp","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Stakes","outputs":[{"internalType":"contract IStakeRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32[]","name":"proofSegments","type":"bytes32[]"},{"internalType":"bytes32","name":"proveSegment","type":"bytes32"},{"internalType":"bytes32[]","name":"proofSegments2","type":"bytes32[]"},{"internalType":"bytes32","name":"proveSegment2","type":"bytes32"},{"internalType":"uint64","name":"chunkSpan","type":"uint64"},{"internalType":"bytes32[]","name":"proofSegments3","type":"bytes32[]"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"postageId","type":"bytes32"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"uint64","name":"timeStamp","type":"uint64"}],"internalType":"struct Redistribution.PostageProof","name":"postageProof","type":"tuple"},{"components":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"identifier","type":"bytes32"},{"internalType":"bytes32","name":"chunkAddr","type":"bytes32"}],"internalType":"struct Redistribution.SOCProof[]","name":"socProof","type":"tuple[]"}],"internalType":"struct Redistribution.ChunkInclusionProof","name":"entryProof1","type":"tuple"},{"components":[{"internalType":"bytes32[]","name":"proofSegments","type":"bytes32[]"},{"internalType":"bytes32","name":"proveSegment","type":"bytes32"},{"internalType":"bytes32[]","name":"proofSegments2","type":"bytes32[]"},{"internalType":"bytes32","name":"proveSegment2","type":"bytes32"},{"internalType":"uint64","name":"chunkSpan","type":"uint64"},{"internalType":"bytes32[]","name":"proofSegments3","type":"bytes32[]"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"postageId","type":"bytes32"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"uint64","name":"timeStamp","type":"uint64"}],"internalType":"struct Redistribution.PostageProof","name":"postageProof","type":"tuple"},{"components":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"identifier","type":"bytes32"},{"internalType":"bytes32","name":"chunkAddr","type":"bytes32"}],"internalType":"struct Redistribution.SOCProof[]","name":"socProof","type":"tuple[]"}],"internalType":"struct Redistribution.ChunkInclusionProof","name":"entryProof2","type":"tuple"},{"components":[{"internalType":"bytes32[]","name":"proofSegments","type":"bytes32[]"},{"internalType":"bytes32","name":"proveSegment","type":"bytes32"},{"internalType":"bytes32[]","name":"proofSegments2","type":"bytes32[]"},{"internalType":"bytes32","name":"proveSegment2","type":"bytes32"},{"internalType":"uint64","name":"chunkSpan","type":"uint64"},{"internalType":"bytes32[]","name":"proofSegments3","type":"bytes32[]"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"postageId","type":"bytes32"},{"internalType":"uint64","name":"index","type":"uint64"},{"internalType":"uint64","name":"timeStamp","type":"uint64"}],"internalType":"struct Redistribution.PostageProof","name":"postageProof","type":"tuple"},{"components":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"identifier","type":"bytes32"},{"internalType":"bytes32","name":"chunkAddr","type":"bytes32"}],"internalType":"struct Redistribution.SOCProof[]","name":"socProof","type":"tuple[]"}],"internalType":"struct Redistribution.ChunkInclusionProof","name":"entryProofLast","type":"tuple"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_obfuscatedHash","type":"bytes32"},{"internalType":"uint64","name":"_roundNumber","type":"uint64"}],"name":"commit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentClaimRound","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentCommitRound","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currentCommits","outputs":[{"internalType":"bytes32","name":"overlay","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"bool","name":"revealed","type":"bool"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"bytes32","name":"obfuscatedHash","type":"bytes32"},{"internalType":"uint256","name":"revealIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentMinimumDepth","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhaseClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhaseCommit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhaseReveal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRevealRound","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currentReveals","outputs":[{"internalType":"bytes32","name":"overlay","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"depth","type":"uint8"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeDensity","type":"uint256"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRound","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRoundAnchor","outputs":[{"internalType":"bytes32","name":"returnVal","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRoundReveals","outputs":[{"components":[{"internalType":"bytes32","name":"overlay","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"depth","type":"uint8"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeDensity","type":"uint256"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"internalType":"struct Redistribution.Reveal[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"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":"bytes32","name":"A","type":"bytes32"},{"internalType":"bytes32","name":"B","type":"bytes32"},{"internalType":"uint8","name":"minimum","type":"uint8"}],"name":"inProximity","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint8","name":"_depth","type":"uint8"}],"name":"isParticipatingInUpcomingRound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_overlay","type":"bytes32"}],"name":"isWinner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_depth","type":"uint8"},{"internalType":"bytes32","name":"_hash","type":"bytes32"},{"internalType":"bytes32","name":"_revealNonce","type":"bytes32"}],"name":"reveal","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":"uint8","name":"_penaltyMultiplierDisagreement","type":"uint8"},{"internalType":"uint8","name":"_penaltyMultiplierNonRevealed","type":"uint8"},{"internalType":"uint8","name":"_penaltyRandomFactor","type":"uint8"}],"name":"setFreezingParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sampleMaxValue","type":"uint256"}],"name":"setSampleMaxValue","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":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"winner","outputs":[{"internalType":"bytes32","name":"overlay","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"depth","type":"uint8"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeDensity","type":"uint256"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_overlay","type":"bytes32"},{"internalType":"uint8","name":"_depth","type":"uint8"},{"internalType":"bytes32","name":"_hash","type":"bytes32"},{"internalType":"bytes32","name":"revealNonce","type":"bytes32"}],"name":"wrapCommit","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
60806040526008805462ffffff60c01b19166264020160c01b1790557dba1914b54e0348a1028d1a103a95ed55c4004b9d332400000000000000006009553480156200004a57600080fd5b5060405162004af938038062004af98339810160408190526200006d916200019d565b60018054600380546001600160a01b03199081166001600160a01b03888116919091179092556001600160a81b0319909216610100868316021790925560028054909116918316919091179055620000c7600033620000d0565b505050620001e7565b620000dc8282620000e0565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000dc576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200013c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b03811681146200019857600080fd5b919050565b600080600060608486031215620001b357600080fd5b620001be8462000180565b9250620001ce6020850162000180565b9150620001de6040850162000180565b90509250925092565b61490280620001f76000396000f3fe608060405234801561001057600080fd5b50600436106102775760003560e01c806377c75d1011610160578063b6cd5822116100d8578063dfbf53ae1161008c578063f69ee1d111610071578063f69ee1d1146105d5578063f7b188a5146105e8578063fb00f2f3146105f057600080fd5b8063dfbf53ae14610592578063f4e6fcca146105c257600080fd5b8063ce987745116100bd578063ce98774514610564578063d1e8b63d14610577578063d547741f1461057f57600080fd5b8063b6cd582214610537578063c46b40291461054a57600080fd5b80638456cb591161012f5780638d8b6428116101145780638d8b6428146104f057806391d14854146104f8578063a217fddf1461052f57600080fd5b80638456cb59146104e05780638a19c8bc146104e857600080fd5b806377c75d101461045a5780637fe019c61461046d57806382b39b1b1461048857806383220626146104d857600080fd5b80635c975abb116101f357806364c34a85116101c257806369da9114116101a757806369da9114146103de5780636f94aaf2146103f157806372286cba1461040c57600080fd5b806364c34a85146103a957806369bfac01146103b157600080fd5b80635c975abb146103705780635d4844ea1461037b57806362fd29ae1461038e57806363f5cf7c1461039657600080fd5b80632a4e62491161024a5780632f3906da1161022f5780632f3906da1461034257806336568abe1461034a5780635838d6731461035d57600080fd5b80632a4e6249146103185780632f2ff15d1461032d57600080fd5b806301ffc9a71461027c5780631736d472146102a457806318350096146102b7578063248a9ca3146102e7575b600080fd5b61028f61028a366004614053565b610603565b60405190151581526020015b60405180910390f35b61028f6102b23660046140a1565b61066c565b6001546102cf9061010090046001600160a01b031681565b6040516001600160a01b03909116815260200161029b565b61030a6102f53660046140da565b60009081526020819052604090206001015490565b60405190815260200161029b565b6103206107d4565b60405161029b91906140f3565b61034061033b366004614182565b6108e1565b005b61028f61090b565b610340610358366004614182565b610955565b61034061036b3660046141c4565b6109e6565b60015460ff1661028f565b6003546102cf906001600160a01b031681565b61030a610f48565b6103406103a4366004614209565b611014565b61030a6113af565b6008546103c59067ffffffffffffffff1681565b60405167ffffffffffffffff909116815260200161029b565b6002546102cf906001600160a01b031681565b6008546103c590600160801b900467ffffffffffffffff1681565b61041f61041a3660046140da565b61148f565b604080519687526001600160a01b039095166020870152921515938501939093526060840152608083019190915260a082015260c00161029b565b61028f6104683660046140da565b6114e6565b6008546103c590600160401b900467ffffffffffffffff1681565b61049b6104963660046140da565b611796565b604080519687526001600160a01b03909516602087015260ff909316938501939093526060840152608083019190915260a082015260c00161029b565b61030a6117a6565b6103406117b1565b6103c561180a565b61028f611817565b61028f610506366004614182565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61030a600081565b610340610545366004614291565b611841565b610552611d7e565b60405160ff909116815260200161029b565b61030a6105723660046142c6565b611e03565b61028f611e72565b61034061058d366004614182565b611e97565b600a54600b54600c54600d54600e5461049b94936001600160a01b03811693600160a01b90910460ff1692909186565b6103406105d0366004614303565b611ebc565b6103406105e33660046140da565b611fa3565b610340611ff7565b61028f6105fe36600461434e565b61204e565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061066657507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b600061067661090b565b156106ad576040517fe2586bcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106b960986002614392565b6106c390436143a9565b60035460405163d1052d1f60e01b81526001600160a01b0386811660048301529091169063d1052d1f90602401602060405180830381865afa15801561070d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073191906143bc565b1061074f57604051630a0744c560e01b815260040160405180910390fd5b6003546040516397adedb560e01b81526001600160a01b0385811660048301526107cd9216906397adedb590602401602060405180830381865afa15801561079b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bf91906143bc565b6107c76113af565b8461204e565b9392505050565b60606107de611817565b6107fb57604051633788c6c160e11b815260040160405180910390fd5b600061080561180a565b60085490915067ffffffffffffffff808316600160401b909204161461083e57604051636fbabc7760e01b815260040160405180910390fd5b6005805480602002602001604051908101604052809291908181526020016000905b828210156108d75760008481526020908190206040805160c08101825260058602909201805483526001808201546001600160a01b03811685870152600160a01b900460ff169284019290925260028101546060840152600381015460808401526004015460a08301529083529092019101610860565b5050505091505090565b6000828152602081905260409020600101546108fc8161208a565b6109068383612097565b505050565b6000806109196098436143eb565b9050610927600460986143ff565b8110158015610940575061093d600260986143ff565b81105b1561094d57600191505090565b600091505090565b6001600160a01b03811633146109d85760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109e28282612135565b5050565b6109ee6121b4565b60006109f861180a565b6003546040516397adedb560e01b81523360048201529192506000916001600160a01b03909116906397adedb590602401602060405180830381865afa158015610a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6a91906143bc565b6003546040517f830a053e0000000000000000000000000000000000000000000000000000000081523360048201529192506000916001600160a01b039091169063830a053e90602401602060405180830381865afa158015610ad1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af591906143bc565b60035460405163d1052d1f60e01b81523360048201529192506000916001600160a01b039091169063d1052d1f90602401602060405180830381865afa158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906143bc565b9050610b71611e72565b610ba7576040517fdc816a8700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001610bb5600460986143ff565b610bbf91906143a9565b610bca6098436143eb565b03610c01576040517f5baef6b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8467ffffffffffffffff168467ffffffffffffffff161115610c4f576040517f50ff7c0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8467ffffffffffffffff168467ffffffffffffffff161015610c9d576040517f7a0c0fd600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610cd7576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ce360986002614392565b610ced90436143a9565b8110610d0c57604051630a0744c560e01b815260040160405180910390fd5b60085467ffffffffffffffff858116911614610d4c57610d2e60046000613fea565b6008805467ffffffffffffffff191667ffffffffffffffff86161790555b60045460005b81811015610dbf578460048281548110610d6e57610d6e614413565b90600052602060002090600502016000015403610db7576040517fbfec555800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600101610d52565b506040805160c081018252858152336020808301918252600083850181815260608501898152608086018e815260a0870184815260048054600181018255955296517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b60059095029485015594517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c8401805493516001600160a01b0390921674ffffffffffffffffffffffffffffffffffffffffff1990941693909317600160a01b9115159190910217909155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e83015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19f90910155815167ffffffffffffffff891681529081018690527f68e0867601a98978930107aee7f425665e61edd70ca594c68ca5da9e81f84c29910160405180910390a150505050505050565b600080610f5361180a565b610f5e906001614429565b60075460085491925090610f8490600160401b900467ffffffffffffffff166001614429565b67ffffffffffffffff168267ffffffffffffffff16111561066657600854600090600190610fc390600160401b900467ffffffffffffffff1685614451565b610fcd9190614451565b67ffffffffffffffff1690508181604051602001610ff5929190918252602082015260400190565b6040516020818303038152906040528051906020012091505092915050565b61101c6121b4565b611024612207565b6040805160c081018252600a548152600b546001600160a01b0381166020830152600160a01b900460ff1691810191909152600c546060820152600d546080820152600e5460a08201526006546007546000918291611084600f826143eb565b9350611091600e826143eb565b92508383106110a857826110a481614472565b9350505b6110bb866020013583876040015161204e565b6110db57604051633b5f43a360e01b8152600360048201526024016109cf565b6110e686601e612813565b6110ef86612b25565b6110f886612e32565b61110b886020013583876040015161204e565b61112b57604051633b5f43a360e01b8152600260048201526024016109cf565b61113f8861113a866002614392565b612813565b61114888612b25565b61115188612e32565b611164876020013583876040015161204e565b61118457604051633b5f43a360e01b8152600160048201526024016109cf565b6111938761113a856002614392565b61119c87612b25565b6111a587612e32565b61121b84846111b48b8061448b565b60008181106111c5576111c5614413565b602002919091013590506111d98b8061448b565b60008181106111ea576111ea614413565b602002919091013590506111fe8b8061448b565b600081811061120f5761120f614413565b905060200201356130c6565b611245611228878061448b565b600081811061123957611239614413565b90506020020135613153565b60015460208601516040517f51cff8d90000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015261010090920416906351cff8d990602401600060405180830381600087803b1580156112ae57600080fd5b505af11580156112c2573d6000803e3d6000fd5b505050507f788e77979e6e6a8a6a5d2c19c58b1ff9671298f54c85ac6f6aa30379aed5861a856040516112f591906144dc565b60405180910390a17fbee3fc8a3523c1a65fa9308ce1f2b8fd90c24975b141b754603194597846e4dd60018054906101000a90046001600160a01b03166001600160a01b0316638a5e8e326040518163ffffffff1660e01b8152600401602060405180830381865afa15801561136f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139391906143bc565b6040519081526020015b60405180910390a15050505050505050565b60006113b9611e72565b806113f75750600854600160401b900467ffffffffffffffff166113db61180a565b67ffffffffffffffff161180156113f757506113f5611817565b155b15611409576114046117a6565b905090565b611411611817565b1561141e57611404610f48565b61142661090b565b80156114555750600854600160401b900467ffffffffffffffff1661144961180a565b67ffffffffffffffff16145b1561148c576040517f36b7884b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90565b6004818154811061149f57600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294506001600160a01b03821693600160a01b90920460ff169290919086565b60006114f0611817565b61150d57604051633788c6c160e11b815260040160405180910390fd5b600061151761180a565b60085490915067ffffffffffffffff808316600160401b909204161461155057604051636fbabc7760e01b815260040160405180910390fd5b60085467ffffffffffffffff600160801b90910481169082161161158757604051630c8d9eab60e31b815260040160405180910390fd5b60008060008060008060008061159b613191565b905060006115a761324b565b600454919650945060005b8181101561178257600481815481106115cd576115cd614413565b9060005260206000209060050201600401549450600481815481106115f4576115f4614413565b906000526020600020906005020160010160149054906101000a900460ff16801561164257506005858154811061162d5761162d614413565b90600052602060002090600502016004015487145b801561168057506005858154811061165c5761165c614413565b600091825260209091206001600590920201015460ff878116600160a01b90920416145b1561177a576005858154811061169857611698614413565b9060005260206000209060050201600301548b6116b5919061452b565b9a5083836040516020016116ca929190614562565b60408051601f19818403018152919052805160209091012098506fffffffffffffffffffffffffffffffff808a16985061170590600161452b565b6005868154811061171857611718614413565b9060005260206000209060050201600301546117349190614392565b61173e8c8a614392565b101561176c576005858154811061175757611757614413565b90600052602060002090600502016000015499505b8261177681614472565b9350505b6001016115b2565b505050959099149998505050505050505050565b6005818154811061149f57600080fd5b600080610f5e61180a565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff1661180057604051631d77d47760e21b815260040160405180910390fd5b611808613404565b565b60006114046098436143ff565b6000611825600260986143ff565b6118306098436143eb565b1061183b5750600190565b50600090565b6118496121b4565b600061185361180a565b6003546040516397adedb560e01b81523360048201529192506000916001600160a01b03909116906397adedb590602401602060405180830381865afa1580156118a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c591906143bc565b90506118cf611d7e565b60ff168560ff16101561190e576040517f83d9b7bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61191661090b565b61194c576040517fd1088db600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60085467ffffffffffffffff838116911614611994576040517f842a9e0a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60085467ffffffffffffffff838116600160401b9092041614611a7c576119b96113af565b6006556119c860056000613fea565b600880547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff16600160401b67ffffffffffffffff8516908102919091179091556006546040805192835260208301919091527ff0ae472da9c8da86bda4991a549c03a3cb328b5f360ea11a5b8814f32bb85176910160405180910390a1611a7c600754604080516020810192909252449082015260600160408051601f198184030181529190528051602090910120600755565b6000611a8a82878787611e03565b90506000611a988383613458565b9050600060048281548110611aaf57611aaf614413565b60009182526020918290206040805160c081018252600593909302909101805480845260018201546001600160a01b03811695850195909552600160a01b90940460ff1615159183019190915260028101546060830152600381015460808301526004015460a0820152600654909250611b2a91908a61204e565b611b66576006546040517f14ebbbe40000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b806040015115611ba2576040517fa89ac15100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160048381548110611bb757611bb7614413565b906000526020600020906005020160010160146101000a81548160ff02191690831515021790555060058054905060048381548110611bf857611bf8614413565b90600052602060002090600502016004018190555060056040518060c001604052808360000151815260200183602001516001600160a01b031681526020018a60ff168152602001836060015181526020018a6002611c579190614668565b8460600151611c669190614392565b815260209081018a90528254600181810185556000948552938290208351600590920201908155908201519281018054604084015160ff16600160a01b0274ffffffffffffffffffffffffffffffffffffffffff199091166001600160a01b0390951694909417939093179092556060808201516002808501919091556080830151600385015560a0909201516004909301929092558251918301517f13fc17fd71632266fe82092de6dd91a06b4fa68d8dc950492e5421cbed55a6a5928892909190611d34908d90614668565b8560600151611d439190614392565b6040805167ffffffffffffffff909516855260208501939093529183015260608201526080810189905260ff8a1660a082015260c00161139d565b6008546000908190611da39067ffffffffffffffff600160801b820481169116614451565b67ffffffffffffffff169050600060fe8211611dbf5781611dc2565b60fe5b611dcd906001614677565b600b5490915060ff600160a01b9091048116908216811115611df857611df38282614690565b611dfb565b60005b935050505090565b60408051602081018690527fff0000000000000000000000000000000000000000000000000000000000000060f886901b169181019190915260418101839052606181018290526000906081015b6040516020818303038152906040528051906020012090505b949350505050565b6000611e80600460986143ff565b611e8b6098436143eb565b101561183b5750600190565b600082815260208190526040902060010154611eb28161208a565b6109068383612135565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16611f0b57604051637bfa4b9f60e01b815260040160405180910390fd5b600880547fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b60ff958616027fffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff1617600160c81b93851693909302929092177fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b9190931602919091179055565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16611ff257604051637bfa4b9f60e01b815260040160405180910390fd5b600955565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff1661204657604051631d77d47760e21b815260040160405180910390fd5b611808613503565b60008160ff16600003612063575060016107cd565b61207260ff83166101006146a9565b61207d9060026146c4565b8484181090509392505050565b612094813361353c565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166109e2576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556120f13390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156109e2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60015460ff16156118085760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016109cf565b600061221161180a565b905061221b611817565b61223857604051633788c6c160e11b815260040160405180910390fd5b60085467ffffffffffffffff828116600160401b909204161461226e57604051636fbabc7760e01b815260040160405180910390fd5b60085467ffffffffffffffff600160801b9091048116908216116122a557604051630c8d9eab60e31b815260040160405180910390fd5b600454604051818152600091829182918291829182917f6752c5e71c95fb93bc7137adeb115a33fa4e54e2683e33d3f90c2bb1c4b6c2a59060200160405180910390a16005546040519081527f4c03de6a759749c0c9387b7014634dc5c6af610e1366023d90751c783a998f8d9060200160405180910390a161232661324b565b6040805183815260ff831660208201529295509093507f34e8eda4cd857cd2865becf58a47748f31415f4a382cbb2cc0c64b9a27c717be910160405180910390a16000612371613191565b905060005b8281101561274d5760006004828154811061239357612393614413565b600091825260208083206040805160c08101825260059485029092018054835260018101546001600160a01b03811694840194909452600160a01b90930460ff16151590820152600282015460608201526003820154608082015260049091015460a0820181905282549194509291908390811061241357612413614413565b60009182526020918290206040805160c0810182526005939093029091018054835260018101546001600160a01b03811694840194909452600160a01b90930460ff1682820152600283015460608301526003830154608083015260049092015460a082015290840151909150801561248f57508060a0015188145b80156124a45750806040015160ff168760ff16145b156125995760808101516124b8908d61452b565b9b50848b6040516020016124cd929190614562565b60408051601f19818403018152919052805160209091012099506fffffffffffffffffffffffffffffffff808b16995061250890600161452b565b81608001516125179190614392565b6125218d8b614392565b101561258b578051600a556020810151600b8054604084015160ff16600160a01b0274ffffffffffffffffffffffffffffffffffffffffff199091166001600160a01b03909316929092179190911790556060810151600c556080810151600d5560a0810151600e555b8a61259581614472565b9b50505b826040015180156125c257508060a00151881415806125c25750806040015160ff168760ff1614155b80156125e35750600854600160d01b900460ff166125e16064446143eb565b105b1561268f5760035460208201516001600160a01b039091169063d009b2d69061260d8a6002614668565b60085461262690609890600160c01b900460ff16614392565b6126309190614392565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561267657600080fd5b505af115801561268a573d6000803e3d6000fd5b505050505b826040015161273f5760035460208401516001600160a01b039091169063d009b2d6906126bd8a6002614668565b6008546126d690609890600160c81b900460ff16614392565b6126e09190614392565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561272657600080fd5b505af115801561273a573d6000803e3d6000fd5b505050505b836001019350505050612376565b506002546040517fffb98fe300000000000000000000000000000000000000000000000000000000815261ffff891660048201526001600160a01b039091169063ffb98fe390602401600060405180830381600087803b1580156127b057600080fd5b505af11580156127c4573d6000803e3d6000fd5b50506008805467ffffffffffffffff909c16600160801b027fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff909c169b909b17909a5550505050505050505050565b600754600090612825906080906143eb565b9050600061288861283960a086018661448b565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050505060608601358461288060a0890160808a016146d4565b6006546135af565b60408051858152602081018390529192507f94e252069a85aa79db21f5bd8ca4e14dd3a3927aa492711017a2c8ddad95af00910160405180910390a16129106128d1858061448b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050602086013585610400613727565b600e541461293b5760405163755f0a2560e01b815260016004820152602481018290526044016109cf565b61294860a085018561448b565b600081811061295957612959614413565b90506020020135848060400190612970919061448b565b600081811061298157612981614413565b90506020020135146129b05760405163755f0a2560e01b815260026004820152602481018290526044016109cf565b6000806129c060e087018761448b565b9050116129d1578460200135612a06565b6129de60e086018661448b565b60008181106129ef576129ef614413565b9050602002810190612a0191906146ef565b606001355b9050612a64612a18604087018761448b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050606087013585612a5f60a08a0160808b016146d4565b613727565b8114612a8d5760405163755f0a2560e01b815260036004820152602481018390526044016109cf565b6000612a9c60e087018761448b565b90501115612ad45760408051602080880135908201529081018390526060016040516020818303038152906040528051906020012091505b81612adf868061448b565b6000818110612af057612af0614413565b9050602002013514612b1e5760405163755f0a2560e01b8152600481810152602481018390526044016109cf565b5050505050565b6001546000908190819061010090046001600160a01b031663c81e25ab612b4f60c08701876146ef565b602001356040518263ffffffff1660e01b8152600401612b7191815260200190565b60c060405180830381865afa158015612b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb2919061470f565b509396509194509250506001600160a01b0384169050612c1257612bd960c08501856146ef565b602001356040517f2396d34e0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b6000612c35612c2460c08701876146ef565b61148c9060608101906040016146d4565b90506000612c438484613895565b9050808263ffffffff1610612c9857612c5f60c08701876146ef565b602001356040517f1362e4a00000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b6000612cc7612caa60c08901896146ef565b612cbb9060608101906040016146d4565b60201c63ffffffff1690565b90506000612cd98860200135866138b0565b63ffffffff16905067ffffffffffffffff82168114612d3857612cff60c08901896146ef565b602001356040517f6dd6a24f0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b612dde87612d4960c08b018b6146ef565b612d539080614787565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050505060208b0135612d9960c08d018d6146ef565b60200135612daa60c08e018e6146ef565b612dbb9060608101906040016146d4565b612dc860c08f018f6146ef565b612dd99060808101906060016146d4565b6138d7565b612e2857612def60c08901896146ef565b602001356040517fdb12fb9d0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b5050505050505050565b612e3f60e082018261448b565b9050600003612e4b5750565b612f6c612e5b60e083018361448b565b6000818110612e6c57612e6c614413565b9050602002810190612e7e91906146ef565b612e8c9060208101906147ce565b612e9960e084018461448b565b6000818110612eaa57612eaa614413565b9050602002810190612ebc91906146ef565b612eca906020810190614787565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612f0c9250505060e085018561448b565b6000818110612f1d57612f1d614413565b9050602002810190612f2f91906146ef565b60400135612f4060e086018661448b565b6000818110612f5157612f51614413565b9050602002810190612f6391906146ef565b6060013561396e565b612fd957612f7d60e082018261448b565b6000818110612f8e57612f8e614413565b9050602002810190612fa091906146ef565b606001356040517fd740df610000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b6020810135613058612fee60e084018461448b565b6000818110612fff57612fff614413565b905060200281019061301191906146ef565b6040013561302260e085018561448b565b600081811061303357613033614413565b905060200281019061304591906146ef565b6130539060208101906147ce565b613a01565b146120945761306a60e082018261448b565b600081811061307b5761307b614413565b905060200281019061308d91906146ef565b606001356040517f82f2469d0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b83851015613113578183106130ee57604051633d386eb360e11b815260040160405180910390fd5b80821061310e57604051633588c6d360e11b815260040160405180910390fd5b612b1e565b82821061313357604051633d386eb360e11b815260040160405180910390fd5b808310612b1e57604051633588c6d360e11b815260040160405180910390fd5b6009548110612094576040517fb6052cdf000000000000000000000000000000000000000000000000000000008152600481018290526024016109cf565b606061319b611817565b6131b857604051633788c6c160e11b815260040160405180910390fd5b60006131c261180a565b60085490915067ffffffffffffffff808316600160401b90920416146131fb57604051636fbabc7760e01b815260040160405180910390fd5b6007546040516020016132369181527f3100000000000000000000000000000000000000000000000000000000000000602082015260210190565b60405160208183030381529060405291505090565b6000806000806000806000806000613261613a4f565b60045490915060005b818110156133f3576004818154811061328557613285614413565b906000526020600020906005020160010160149054906101000a900460ff16156133eb57600481815481106132bc576132bc614413565b9060005260206000209060050201600401549350600584815481106132e3576132e3614413565b90600052602060002090600502016003015489613300919061452b565b98508281604051602001613315929190614562565b60408051601f19818403018152919052805160209091012097506fffffffffffffffffffffffffffffffff808916975061335090600161452b565b6005858154811061336357613363614413565b90600052602060002090600502016003015461337f9190614392565b6133898a89614392565b10156133eb57600584815481106133a2576133a2614413565b9060005260206000209060050201600401549550600584815481106133c9576133c9614413565b906000526020600020906005020160010160149054906101000a900460ff1694505b60010161326a565b509399929850919650505050505050565b61340c6121b4565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b6000805b6004548110156134d057836004828154811061347a5761347a614413565b9060005260206000209060050201600001541480156134bc5750600481815481106134a7576134a7614413565b90600052602060002090600502016003015483145b156134c8579050610666565b60010161345c565b506040517fd950091500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61350b613ad8565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361343b565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166109e25761356d81613b2a565b613578836020613b3c565b6040516020016135899291906147eb565b60408051601f198184030181529082905262461bcd60e51b82526109cf9160040161486c565b6000806135be87878786613d01565b9050826136c3856000808267ffffffffffffffff1690506008817eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff16901b600882901c7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff161790506010817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff16901b601082901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff161790506020817bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16901b602082901c7bffffffff00000000ffffffff00000000ffffffff00000000ffffffff1617905080915050919050565b826040516020016137059392919092835260c09190911b77ffffffffffffffffffffffffffffffffffffffffffffffff19166020830152602882015260480190565b6040516020818303038152906040528051906020012091505095945050505050565b600080613735868686613d77565b9050613839836000808267ffffffffffffffff1690506008817eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff16901b600882901c7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff161790506010817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff16901b601082901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff161790506020817bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16901b602082901c7bffffffff00000000ffffffff00000000ffffffff00000000ffffffff1617905080915050919050565b8160405160200161387492919060c09290921b77ffffffffffffffffffffffffffffffffffffffffffffffff19168252600882015260280190565b60405160208183030381529060405280519060200120915050949350505050565b60006138a18284614690565b60ff166001901b905092915050565b600060e083901c6138c2836020614690565b60ff168163ffffffff16901c91505092915050565b6000806138e686868686613ddf565b90506000613941826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b9050886001600160a01b0316613957828a613e2a565b6001600160a01b0316149998505050505050505050565b60008061397b8484613ea9565b905060006139d6826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b9050866001600160a01b03166139ec8288613e2a565b6001600160a01b031614979650505050505050565b60008282604051602001613a3192919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b6060613a59611817565b613a7657604051633788c6c160e11b815260040160405180910390fd5b6000613a8061180a565b60085490915067ffffffffffffffff808316600160401b9092041614613ab957604051636fbabc7760e01b815260040160405180910390fd5b600754604051602001613236918152600360fc1b602082015260210190565b60015460ff166118085760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016109cf565b60606106666001600160a01b03831660145b60606000613b4b836002614392565b613b5690600261452b565b67ffffffffffffffff811115613b6e57613b6e61489f565b6040519080825280601f01601f191660200182016040528015613b98576020820181803683370190505b509050600360fc1b81600081518110613bb357613bb3614413565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bfe57613bfe614413565b60200101906001600160f81b031916908160001a9053506000613c22846002614392565b613c2d90600161452b565b90505b6001811115613cb2577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613c6e57613c6e614413565b1a60f81b828281518110613c8457613c84614413565b60200101906001600160f81b031916908160001a90535060049490941c93613cab816148b5565b9050613c30565b5083156107cd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109cf565b8260005b8551811015613d6e576000613d1b6002866143eb565b15613d27576000613d2a565b60015b9050613d5183888481518110613d4257613d42614413565b60200260200101518387613ec5565b9250600185901c9450508080613d6690614472565b915050613d05565b50949350505050565b8160005b8451811015613dd7576000613d916002856143eb565b6000149050613dba83878481518110613dac57613dac614413565b602002602001015183613f25565b9250600184901c9350508080613dcf90614472565b915050613d7b565b509392505050565b604080516020810186905290810184905277ffffffffffffffffffffffffffffffffffffffffffffffff1960c084811b8216606084015283901b166068820152600090607001611e51565b600080600080613e3985613f8c565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015613e94573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b6040805160208101849052908101829052600090606001613a31565b60008215613f0557604080516020810184905290810186905260608101859052608001604051602081830303815290604052805190602001209050611e6a565b604080516020810184905290810185905260608101869052608001611e51565b60008115613f5e5760408051602081018690529081018490526060016040516020818303038152906040528051906020012090506107cd565b5050604080516020808201939093528082019390935280518084038201815260609093019052815191012090565b60008060008351604114613fcc576040517f4be6321b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505060208101516040820151606090920151909260009190911a90565b508054600082556005029060005260206000209081019061209491905b8082111561404f57600080825560018201805474ffffffffffffffffffffffffffffffffffffffffff1916905560028201819055600382018190556004820155600501614007565b5090565b60006020828403121561406557600080fd5b81356001600160e01b0319811681146107cd57600080fd5b6001600160a01b038116811461209457600080fd5b60ff8116811461209457600080fd5b600080604083850312156140b457600080fd5b82356140bf8161407d565b915060208301356140cf81614092565b809150509250929050565b6000602082840312156140ec57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561417657614163838551805182526001600160a01b03602082015116602083015260ff6040820151166040830152606081015160608301526080810151608083015260a081015160a08301525050565b9284019260c0929092019160010161410f565b50909695505050505050565b6000806040838503121561419557600080fd5b8235915060208301356140cf8161407d565b803567ffffffffffffffff811681146141bf57600080fd5b919050565b600080604083850312156141d757600080fd5b823591506141e7602084016141a7565b90509250929050565b6000610100828403121561420357600080fd5b50919050565b60008060006060848603121561421e57600080fd5b833567ffffffffffffffff8082111561423657600080fd5b614242878388016141f0565b9450602086013591508082111561425857600080fd5b614264878388016141f0565b9350604086013591508082111561427a57600080fd5b50614287868287016141f0565b9150509250925092565b6000806000606084860312156142a657600080fd5b83356142b181614092565b95602085013595506040909401359392505050565b600080600080608085870312156142dc57600080fd5b8435935060208501356142ee81614092565b93969395505050506040820135916060013590565b60008060006060848603121561431857600080fd5b833561432381614092565b9250602084013561433381614092565b9150604084013561434381614092565b809150509250925092565b60008060006060848603121561436357600080fd5b8335925060208401359150604084013561434381614092565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106665761066661437c565b818103818111156106665761066661437c565b6000602082840312156143ce57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b6000826143fa576143fa6143d5565b500690565b60008261440e5761440e6143d5565b500490565b634e487b7160e01b600052603260045260246000fd5b67ffffffffffffffff81811683821601908082111561444a5761444a61437c565b5092915050565b67ffffffffffffffff82811682821603908082111561444a5761444a61437c565b6000600182016144845761448461437c565b5060010190565b6000808335601e198436030181126144a257600080fd5b83018035915067ffffffffffffffff8211156144bd57600080fd5b6020019150600581901b36038213156144d557600080fd5b9250929050565b60c081016106668284805182526001600160a01b03602082015116602083015260ff6040820151166040830152606081015160608301526080810151608083015260a081015160a08301525050565b808201808211156106665761066661437c565b60005b83811015614559578181015183820152602001614541565b50506000910152565b6000835161457481846020880161453e565b9190910191825250602001919050565b600181815b808511156145bf5781600019048211156145a5576145a561437c565b808516156145b257918102915b93841c9390800290614589565b509250929050565b6000826145d657506001610666565b816145e357506000610666565b81600181146145f957600281146146035761461f565b6001915050610666565b60ff8411156146145761461461437c565b50506001821b610666565b5060208310610133831016604e8410600b8410161715614642575081810a610666565b61464c8383614584565b80600019048211156146605761466061437c565b029392505050565b60006107cd60ff8416836145c7565b60ff81811683821601908111156106665761066661437c565b60ff82811682821603908111156106665761066661437c565b61ffff82811682821603908082111561444a5761444a61437c565b60006107cd61ffff8416836145c7565b6000602082840312156146e657600080fd5b6107cd826141a7565b60008235607e1983360301811261470557600080fd5b9190910192915050565b60008060008060008060c0878903121561472857600080fd5b86516147338161407d565b602088015190965061474481614092565b604088015190955061475581614092565b6060880151909450801515811461476b57600080fd5b809350506080870151915060a087015190509295509295509295565b6000808335601e1984360301811261479e57600080fd5b83018035915067ffffffffffffffff8211156147b957600080fd5b6020019150368190038213156144d557600080fd5b6000602082840312156147e057600080fd5b81356107cd8161407d565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161482381601785016020880161453e565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161486081602884016020880161453e565b01602801949350505050565b602081526000825180602084015261488b81604085016020870161453e565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b6000816148c4576148c461437c565b50600019019056fea26469706673582212200ee3b010b6e6132df84327e2ab5e573e177e3ed2a665f5c10ddbb299e9a458d464736f6c634300081300330000000000000000000000005cf39e699b601c2ebc3e25b19fd4102d8366b56f000000000000000000000000cdfdc3752caaa826fe62531e0000c40546ec56a6000000000000000000000000f19f9d88e963a61c735c1716f8a689dc2887f463
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102775760003560e01c806377c75d1011610160578063b6cd5822116100d8578063dfbf53ae1161008c578063f69ee1d111610071578063f69ee1d1146105d5578063f7b188a5146105e8578063fb00f2f3146105f057600080fd5b8063dfbf53ae14610592578063f4e6fcca146105c257600080fd5b8063ce987745116100bd578063ce98774514610564578063d1e8b63d14610577578063d547741f1461057f57600080fd5b8063b6cd582214610537578063c46b40291461054a57600080fd5b80638456cb591161012f5780638d8b6428116101145780638d8b6428146104f057806391d14854146104f8578063a217fddf1461052f57600080fd5b80638456cb59146104e05780638a19c8bc146104e857600080fd5b806377c75d101461045a5780637fe019c61461046d57806382b39b1b1461048857806383220626146104d857600080fd5b80635c975abb116101f357806364c34a85116101c257806369da9114116101a757806369da9114146103de5780636f94aaf2146103f157806372286cba1461040c57600080fd5b806364c34a85146103a957806369bfac01146103b157600080fd5b80635c975abb146103705780635d4844ea1461037b57806362fd29ae1461038e57806363f5cf7c1461039657600080fd5b80632a4e62491161024a5780632f3906da1161022f5780632f3906da1461034257806336568abe1461034a5780635838d6731461035d57600080fd5b80632a4e6249146103185780632f2ff15d1461032d57600080fd5b806301ffc9a71461027c5780631736d472146102a457806318350096146102b7578063248a9ca3146102e7575b600080fd5b61028f61028a366004614053565b610603565b60405190151581526020015b60405180910390f35b61028f6102b23660046140a1565b61066c565b6001546102cf9061010090046001600160a01b031681565b6040516001600160a01b03909116815260200161029b565b61030a6102f53660046140da565b60009081526020819052604090206001015490565b60405190815260200161029b565b6103206107d4565b60405161029b91906140f3565b61034061033b366004614182565b6108e1565b005b61028f61090b565b610340610358366004614182565b610955565b61034061036b3660046141c4565b6109e6565b60015460ff1661028f565b6003546102cf906001600160a01b031681565b61030a610f48565b6103406103a4366004614209565b611014565b61030a6113af565b6008546103c59067ffffffffffffffff1681565b60405167ffffffffffffffff909116815260200161029b565b6002546102cf906001600160a01b031681565b6008546103c590600160801b900467ffffffffffffffff1681565b61041f61041a3660046140da565b61148f565b604080519687526001600160a01b039095166020870152921515938501939093526060840152608083019190915260a082015260c00161029b565b61028f6104683660046140da565b6114e6565b6008546103c590600160401b900467ffffffffffffffff1681565b61049b6104963660046140da565b611796565b604080519687526001600160a01b03909516602087015260ff909316938501939093526060840152608083019190915260a082015260c00161029b565b61030a6117a6565b6103406117b1565b6103c561180a565b61028f611817565b61028f610506366004614182565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61030a600081565b610340610545366004614291565b611841565b610552611d7e565b60405160ff909116815260200161029b565b61030a6105723660046142c6565b611e03565b61028f611e72565b61034061058d366004614182565b611e97565b600a54600b54600c54600d54600e5461049b94936001600160a01b03811693600160a01b90910460ff1692909186565b6103406105d0366004614303565b611ebc565b6103406105e33660046140da565b611fa3565b610340611ff7565b61028f6105fe36600461434e565b61204e565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061066657507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b600061067661090b565b156106ad576040517fe2586bcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106b960986002614392565b6106c390436143a9565b60035460405163d1052d1f60e01b81526001600160a01b0386811660048301529091169063d1052d1f90602401602060405180830381865afa15801561070d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073191906143bc565b1061074f57604051630a0744c560e01b815260040160405180910390fd5b6003546040516397adedb560e01b81526001600160a01b0385811660048301526107cd9216906397adedb590602401602060405180830381865afa15801561079b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bf91906143bc565b6107c76113af565b8461204e565b9392505050565b60606107de611817565b6107fb57604051633788c6c160e11b815260040160405180910390fd5b600061080561180a565b60085490915067ffffffffffffffff808316600160401b909204161461083e57604051636fbabc7760e01b815260040160405180910390fd5b6005805480602002602001604051908101604052809291908181526020016000905b828210156108d75760008481526020908190206040805160c08101825260058602909201805483526001808201546001600160a01b03811685870152600160a01b900460ff169284019290925260028101546060840152600381015460808401526004015460a08301529083529092019101610860565b5050505091505090565b6000828152602081905260409020600101546108fc8161208a565b6109068383612097565b505050565b6000806109196098436143eb565b9050610927600460986143ff565b8110158015610940575061093d600260986143ff565b81105b1561094d57600191505090565b600091505090565b6001600160a01b03811633146109d85760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109e28282612135565b5050565b6109ee6121b4565b60006109f861180a565b6003546040516397adedb560e01b81523360048201529192506000916001600160a01b03909116906397adedb590602401602060405180830381865afa158015610a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6a91906143bc565b6003546040517f830a053e0000000000000000000000000000000000000000000000000000000081523360048201529192506000916001600160a01b039091169063830a053e90602401602060405180830381865afa158015610ad1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af591906143bc565b60035460405163d1052d1f60e01b81523360048201529192506000916001600160a01b039091169063d1052d1f90602401602060405180830381865afa158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906143bc565b9050610b71611e72565b610ba7576040517fdc816a8700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001610bb5600460986143ff565b610bbf91906143a9565b610bca6098436143eb565b03610c01576040517f5baef6b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8467ffffffffffffffff168467ffffffffffffffff161115610c4f576040517f50ff7c0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8467ffffffffffffffff168467ffffffffffffffff161015610c9d576040517f7a0c0fd600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610cd7576040517f039f2e1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ce360986002614392565b610ced90436143a9565b8110610d0c57604051630a0744c560e01b815260040160405180910390fd5b60085467ffffffffffffffff858116911614610d4c57610d2e60046000613fea565b6008805467ffffffffffffffff191667ffffffffffffffff86161790555b60045460005b81811015610dbf578460048281548110610d6e57610d6e614413565b90600052602060002090600502016000015403610db7576040517fbfec555800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600101610d52565b506040805160c081018252858152336020808301918252600083850181815260608501898152608086018e815260a0870184815260048054600181018255955296517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b60059095029485015594517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c8401805493516001600160a01b0390921674ffffffffffffffffffffffffffffffffffffffffff1990941693909317600160a01b9115159190910217909155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e83015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19f90910155815167ffffffffffffffff891681529081018690527f68e0867601a98978930107aee7f425665e61edd70ca594c68ca5da9e81f84c29910160405180910390a150505050505050565b600080610f5361180a565b610f5e906001614429565b60075460085491925090610f8490600160401b900467ffffffffffffffff166001614429565b67ffffffffffffffff168267ffffffffffffffff16111561066657600854600090600190610fc390600160401b900467ffffffffffffffff1685614451565b610fcd9190614451565b67ffffffffffffffff1690508181604051602001610ff5929190918252602082015260400190565b6040516020818303038152906040528051906020012091505092915050565b61101c6121b4565b611024612207565b6040805160c081018252600a548152600b546001600160a01b0381166020830152600160a01b900460ff1691810191909152600c546060820152600d546080820152600e5460a08201526006546007546000918291611084600f826143eb565b9350611091600e826143eb565b92508383106110a857826110a481614472565b9350505b6110bb866020013583876040015161204e565b6110db57604051633b5f43a360e01b8152600360048201526024016109cf565b6110e686601e612813565b6110ef86612b25565b6110f886612e32565b61110b886020013583876040015161204e565b61112b57604051633b5f43a360e01b8152600260048201526024016109cf565b61113f8861113a866002614392565b612813565b61114888612b25565b61115188612e32565b611164876020013583876040015161204e565b61118457604051633b5f43a360e01b8152600160048201526024016109cf565b6111938761113a856002614392565b61119c87612b25565b6111a587612e32565b61121b84846111b48b8061448b565b60008181106111c5576111c5614413565b602002919091013590506111d98b8061448b565b60008181106111ea576111ea614413565b602002919091013590506111fe8b8061448b565b600081811061120f5761120f614413565b905060200201356130c6565b611245611228878061448b565b600081811061123957611239614413565b90506020020135613153565b60015460208601516040517f51cff8d90000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015261010090920416906351cff8d990602401600060405180830381600087803b1580156112ae57600080fd5b505af11580156112c2573d6000803e3d6000fd5b505050507f788e77979e6e6a8a6a5d2c19c58b1ff9671298f54c85ac6f6aa30379aed5861a856040516112f591906144dc565b60405180910390a17fbee3fc8a3523c1a65fa9308ce1f2b8fd90c24975b141b754603194597846e4dd60018054906101000a90046001600160a01b03166001600160a01b0316638a5e8e326040518163ffffffff1660e01b8152600401602060405180830381865afa15801561136f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139391906143bc565b6040519081526020015b60405180910390a15050505050505050565b60006113b9611e72565b806113f75750600854600160401b900467ffffffffffffffff166113db61180a565b67ffffffffffffffff161180156113f757506113f5611817565b155b15611409576114046117a6565b905090565b611411611817565b1561141e57611404610f48565b61142661090b565b80156114555750600854600160401b900467ffffffffffffffff1661144961180a565b67ffffffffffffffff16145b1561148c576040517f36b7884b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90565b6004818154811061149f57600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294506001600160a01b03821693600160a01b90920460ff169290919086565b60006114f0611817565b61150d57604051633788c6c160e11b815260040160405180910390fd5b600061151761180a565b60085490915067ffffffffffffffff808316600160401b909204161461155057604051636fbabc7760e01b815260040160405180910390fd5b60085467ffffffffffffffff600160801b90910481169082161161158757604051630c8d9eab60e31b815260040160405180910390fd5b60008060008060008060008061159b613191565b905060006115a761324b565b600454919650945060005b8181101561178257600481815481106115cd576115cd614413565b9060005260206000209060050201600401549450600481815481106115f4576115f4614413565b906000526020600020906005020160010160149054906101000a900460ff16801561164257506005858154811061162d5761162d614413565b90600052602060002090600502016004015487145b801561168057506005858154811061165c5761165c614413565b600091825260209091206001600590920201015460ff878116600160a01b90920416145b1561177a576005858154811061169857611698614413565b9060005260206000209060050201600301548b6116b5919061452b565b9a5083836040516020016116ca929190614562565b60408051601f19818403018152919052805160209091012098506fffffffffffffffffffffffffffffffff808a16985061170590600161452b565b6005868154811061171857611718614413565b9060005260206000209060050201600301546117349190614392565b61173e8c8a614392565b101561176c576005858154811061175757611757614413565b90600052602060002090600502016000015499505b8261177681614472565b9350505b6001016115b2565b505050959099149998505050505050505050565b6005818154811061149f57600080fd5b600080610f5e61180a565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff1661180057604051631d77d47760e21b815260040160405180910390fd5b611808613404565b565b60006114046098436143ff565b6000611825600260986143ff565b6118306098436143eb565b1061183b5750600190565b50600090565b6118496121b4565b600061185361180a565b6003546040516397adedb560e01b81523360048201529192506000916001600160a01b03909116906397adedb590602401602060405180830381865afa1580156118a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c591906143bc565b90506118cf611d7e565b60ff168560ff16101561190e576040517f83d9b7bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61191661090b565b61194c576040517fd1088db600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60085467ffffffffffffffff838116911614611994576040517f842a9e0a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60085467ffffffffffffffff838116600160401b9092041614611a7c576119b96113af565b6006556119c860056000613fea565b600880547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff16600160401b67ffffffffffffffff8516908102919091179091556006546040805192835260208301919091527ff0ae472da9c8da86bda4991a549c03a3cb328b5f360ea11a5b8814f32bb85176910160405180910390a1611a7c600754604080516020810192909252449082015260600160408051601f198184030181529190528051602090910120600755565b6000611a8a82878787611e03565b90506000611a988383613458565b9050600060048281548110611aaf57611aaf614413565b60009182526020918290206040805160c081018252600593909302909101805480845260018201546001600160a01b03811695850195909552600160a01b90940460ff1615159183019190915260028101546060830152600381015460808301526004015460a0820152600654909250611b2a91908a61204e565b611b66576006546040517f14ebbbe40000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b806040015115611ba2576040517fa89ac15100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160048381548110611bb757611bb7614413565b906000526020600020906005020160010160146101000a81548160ff02191690831515021790555060058054905060048381548110611bf857611bf8614413565b90600052602060002090600502016004018190555060056040518060c001604052808360000151815260200183602001516001600160a01b031681526020018a60ff168152602001836060015181526020018a6002611c579190614668565b8460600151611c669190614392565b815260209081018a90528254600181810185556000948552938290208351600590920201908155908201519281018054604084015160ff16600160a01b0274ffffffffffffffffffffffffffffffffffffffffff199091166001600160a01b0390951694909417939093179092556060808201516002808501919091556080830151600385015560a0909201516004909301929092558251918301517f13fc17fd71632266fe82092de6dd91a06b4fa68d8dc950492e5421cbed55a6a5928892909190611d34908d90614668565b8560600151611d439190614392565b6040805167ffffffffffffffff909516855260208501939093529183015260608201526080810189905260ff8a1660a082015260c00161139d565b6008546000908190611da39067ffffffffffffffff600160801b820481169116614451565b67ffffffffffffffff169050600060fe8211611dbf5781611dc2565b60fe5b611dcd906001614677565b600b5490915060ff600160a01b9091048116908216811115611df857611df38282614690565b611dfb565b60005b935050505090565b60408051602081018690527fff0000000000000000000000000000000000000000000000000000000000000060f886901b169181019190915260418101839052606181018290526000906081015b6040516020818303038152906040528051906020012090505b949350505050565b6000611e80600460986143ff565b611e8b6098436143eb565b101561183b5750600190565b600082815260208190526040902060010154611eb28161208a565b6109068383612135565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16611f0b57604051637bfa4b9f60e01b815260040160405180910390fd5b600880547fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b60ff958616027fffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff1617600160c81b93851693909302929092177fffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b9190931602919091179055565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16611ff257604051637bfa4b9f60e01b815260040160405180910390fd5b600955565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff1661204657604051631d77d47760e21b815260040160405180910390fd5b611808613503565b60008160ff16600003612063575060016107cd565b61207260ff83166101006146a9565b61207d9060026146c4565b8484181090509392505050565b612094813361353c565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166109e2576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556120f13390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156109e2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60015460ff16156118085760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016109cf565b600061221161180a565b905061221b611817565b61223857604051633788c6c160e11b815260040160405180910390fd5b60085467ffffffffffffffff828116600160401b909204161461226e57604051636fbabc7760e01b815260040160405180910390fd5b60085467ffffffffffffffff600160801b9091048116908216116122a557604051630c8d9eab60e31b815260040160405180910390fd5b600454604051818152600091829182918291829182917f6752c5e71c95fb93bc7137adeb115a33fa4e54e2683e33d3f90c2bb1c4b6c2a59060200160405180910390a16005546040519081527f4c03de6a759749c0c9387b7014634dc5c6af610e1366023d90751c783a998f8d9060200160405180910390a161232661324b565b6040805183815260ff831660208201529295509093507f34e8eda4cd857cd2865becf58a47748f31415f4a382cbb2cc0c64b9a27c717be910160405180910390a16000612371613191565b905060005b8281101561274d5760006004828154811061239357612393614413565b600091825260208083206040805160c08101825260059485029092018054835260018101546001600160a01b03811694840194909452600160a01b90930460ff16151590820152600282015460608201526003820154608082015260049091015460a0820181905282549194509291908390811061241357612413614413565b60009182526020918290206040805160c0810182526005939093029091018054835260018101546001600160a01b03811694840194909452600160a01b90930460ff1682820152600283015460608301526003830154608083015260049092015460a082015290840151909150801561248f57508060a0015188145b80156124a45750806040015160ff168760ff16145b156125995760808101516124b8908d61452b565b9b50848b6040516020016124cd929190614562565b60408051601f19818403018152919052805160209091012099506fffffffffffffffffffffffffffffffff808b16995061250890600161452b565b81608001516125179190614392565b6125218d8b614392565b101561258b578051600a556020810151600b8054604084015160ff16600160a01b0274ffffffffffffffffffffffffffffffffffffffffff199091166001600160a01b03909316929092179190911790556060810151600c556080810151600d5560a0810151600e555b8a61259581614472565b9b50505b826040015180156125c257508060a00151881415806125c25750806040015160ff168760ff1614155b80156125e35750600854600160d01b900460ff166125e16064446143eb565b105b1561268f5760035460208201516001600160a01b039091169063d009b2d69061260d8a6002614668565b60085461262690609890600160c01b900460ff16614392565b6126309190614392565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561267657600080fd5b505af115801561268a573d6000803e3d6000fd5b505050505b826040015161273f5760035460208401516001600160a01b039091169063d009b2d6906126bd8a6002614668565b6008546126d690609890600160c81b900460ff16614392565b6126e09190614392565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561272657600080fd5b505af115801561273a573d6000803e3d6000fd5b505050505b836001019350505050612376565b506002546040517fffb98fe300000000000000000000000000000000000000000000000000000000815261ffff891660048201526001600160a01b039091169063ffb98fe390602401600060405180830381600087803b1580156127b057600080fd5b505af11580156127c4573d6000803e3d6000fd5b50506008805467ffffffffffffffff909c16600160801b027fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff909c169b909b17909a5550505050505050505050565b600754600090612825906080906143eb565b9050600061288861283960a086018661448b565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050505060608601358461288060a0890160808a016146d4565b6006546135af565b60408051858152602081018390529192507f94e252069a85aa79db21f5bd8ca4e14dd3a3927aa492711017a2c8ddad95af00910160405180910390a16129106128d1858061448b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050602086013585610400613727565b600e541461293b5760405163755f0a2560e01b815260016004820152602481018290526044016109cf565b61294860a085018561448b565b600081811061295957612959614413565b90506020020135848060400190612970919061448b565b600081811061298157612981614413565b90506020020135146129b05760405163755f0a2560e01b815260026004820152602481018290526044016109cf565b6000806129c060e087018761448b565b9050116129d1578460200135612a06565b6129de60e086018661448b565b60008181106129ef576129ef614413565b9050602002810190612a0191906146ef565b606001355b9050612a64612a18604087018761448b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050606087013585612a5f60a08a0160808b016146d4565b613727565b8114612a8d5760405163755f0a2560e01b815260036004820152602481018390526044016109cf565b6000612a9c60e087018761448b565b90501115612ad45760408051602080880135908201529081018390526060016040516020818303038152906040528051906020012091505b81612adf868061448b565b6000818110612af057612af0614413565b9050602002013514612b1e5760405163755f0a2560e01b8152600481810152602481018390526044016109cf565b5050505050565b6001546000908190819061010090046001600160a01b031663c81e25ab612b4f60c08701876146ef565b602001356040518263ffffffff1660e01b8152600401612b7191815260200190565b60c060405180830381865afa158015612b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb2919061470f565b509396509194509250506001600160a01b0384169050612c1257612bd960c08501856146ef565b602001356040517f2396d34e0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b6000612c35612c2460c08701876146ef565b61148c9060608101906040016146d4565b90506000612c438484613895565b9050808263ffffffff1610612c9857612c5f60c08701876146ef565b602001356040517f1362e4a00000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b6000612cc7612caa60c08901896146ef565b612cbb9060608101906040016146d4565b60201c63ffffffff1690565b90506000612cd98860200135866138b0565b63ffffffff16905067ffffffffffffffff82168114612d3857612cff60c08901896146ef565b602001356040517f6dd6a24f0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b612dde87612d4960c08b018b6146ef565b612d539080614787565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050505060208b0135612d9960c08d018d6146ef565b60200135612daa60c08e018e6146ef565b612dbb9060608101906040016146d4565b612dc860c08f018f6146ef565b612dd99060808101906060016146d4565b6138d7565b612e2857612def60c08901896146ef565b602001356040517fdb12fb9d0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b5050505050505050565b612e3f60e082018261448b565b9050600003612e4b5750565b612f6c612e5b60e083018361448b565b6000818110612e6c57612e6c614413565b9050602002810190612e7e91906146ef565b612e8c9060208101906147ce565b612e9960e084018461448b565b6000818110612eaa57612eaa614413565b9050602002810190612ebc91906146ef565b612eca906020810190614787565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612f0c9250505060e085018561448b565b6000818110612f1d57612f1d614413565b9050602002810190612f2f91906146ef565b60400135612f4060e086018661448b565b6000818110612f5157612f51614413565b9050602002810190612f6391906146ef565b6060013561396e565b612fd957612f7d60e082018261448b565b6000818110612f8e57612f8e614413565b9050602002810190612fa091906146ef565b606001356040517fd740df610000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b6020810135613058612fee60e084018461448b565b6000818110612fff57612fff614413565b905060200281019061301191906146ef565b6040013561302260e085018561448b565b600081811061303357613033614413565b905060200281019061304591906146ef565b6130539060208101906147ce565b613a01565b146120945761306a60e082018261448b565b600081811061307b5761307b614413565b905060200281019061308d91906146ef565b606001356040517f82f2469d0000000000000000000000000000000000000000000000000000000081526004016109cf91815260200190565b83851015613113578183106130ee57604051633d386eb360e11b815260040160405180910390fd5b80821061310e57604051633588c6d360e11b815260040160405180910390fd5b612b1e565b82821061313357604051633d386eb360e11b815260040160405180910390fd5b808310612b1e57604051633588c6d360e11b815260040160405180910390fd5b6009548110612094576040517fb6052cdf000000000000000000000000000000000000000000000000000000008152600481018290526024016109cf565b606061319b611817565b6131b857604051633788c6c160e11b815260040160405180910390fd5b60006131c261180a565b60085490915067ffffffffffffffff808316600160401b90920416146131fb57604051636fbabc7760e01b815260040160405180910390fd5b6007546040516020016132369181527f3100000000000000000000000000000000000000000000000000000000000000602082015260210190565b60405160208183030381529060405291505090565b6000806000806000806000806000613261613a4f565b60045490915060005b818110156133f3576004818154811061328557613285614413565b906000526020600020906005020160010160149054906101000a900460ff16156133eb57600481815481106132bc576132bc614413565b9060005260206000209060050201600401549350600584815481106132e3576132e3614413565b90600052602060002090600502016003015489613300919061452b565b98508281604051602001613315929190614562565b60408051601f19818403018152919052805160209091012097506fffffffffffffffffffffffffffffffff808916975061335090600161452b565b6005858154811061336357613363614413565b90600052602060002090600502016003015461337f9190614392565b6133898a89614392565b10156133eb57600584815481106133a2576133a2614413565b9060005260206000209060050201600401549550600584815481106133c9576133c9614413565b906000526020600020906005020160010160149054906101000a900460ff1694505b60010161326a565b509399929850919650505050505050565b61340c6121b4565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b6000805b6004548110156134d057836004828154811061347a5761347a614413565b9060005260206000209060050201600001541480156134bc5750600481815481106134a7576134a7614413565b90600052602060002090600502016003015483145b156134c8579050610666565b60010161345c565b506040517fd950091500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61350b613ad8565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361343b565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166109e25761356d81613b2a565b613578836020613b3c565b6040516020016135899291906147eb565b60408051601f198184030181529082905262461bcd60e51b82526109cf9160040161486c565b6000806135be87878786613d01565b9050826136c3856000808267ffffffffffffffff1690506008817eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff16901b600882901c7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff161790506010817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff16901b601082901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff161790506020817bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16901b602082901c7bffffffff00000000ffffffff00000000ffffffff00000000ffffffff1617905080915050919050565b826040516020016137059392919092835260c09190911b77ffffffffffffffffffffffffffffffffffffffffffffffff19166020830152602882015260480190565b6040516020818303038152906040528051906020012091505095945050505050565b600080613735868686613d77565b9050613839836000808267ffffffffffffffff1690506008817eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff16901b600882901c7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff161790506010817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff16901b601082901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff161790506020817bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16901b602082901c7bffffffff00000000ffffffff00000000ffffffff00000000ffffffff1617905080915050919050565b8160405160200161387492919060c09290921b77ffffffffffffffffffffffffffffffffffffffffffffffff19168252600882015260280190565b60405160208183030381529060405280519060200120915050949350505050565b60006138a18284614690565b60ff166001901b905092915050565b600060e083901c6138c2836020614690565b60ff168163ffffffff16901c91505092915050565b6000806138e686868686613ddf565b90506000613941826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b9050886001600160a01b0316613957828a613e2a565b6001600160a01b0316149998505050505050505050565b60008061397b8484613ea9565b905060006139d6826040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b9050866001600160a01b03166139ec8288613e2a565b6001600160a01b031614979650505050505050565b60008282604051602001613a3192919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b6060613a59611817565b613a7657604051633788c6c160e11b815260040160405180910390fd5b6000613a8061180a565b60085490915067ffffffffffffffff808316600160401b9092041614613ab957604051636fbabc7760e01b815260040160405180910390fd5b600754604051602001613236918152600360fc1b602082015260210190565b60015460ff166118085760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016109cf565b60606106666001600160a01b03831660145b60606000613b4b836002614392565b613b5690600261452b565b67ffffffffffffffff811115613b6e57613b6e61489f565b6040519080825280601f01601f191660200182016040528015613b98576020820181803683370190505b509050600360fc1b81600081518110613bb357613bb3614413565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613bfe57613bfe614413565b60200101906001600160f81b031916908160001a9053506000613c22846002614392565b613c2d90600161452b565b90505b6001811115613cb2577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613c6e57613c6e614413565b1a60f81b828281518110613c8457613c84614413565b60200101906001600160f81b031916908160001a90535060049490941c93613cab816148b5565b9050613c30565b5083156107cd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109cf565b8260005b8551811015613d6e576000613d1b6002866143eb565b15613d27576000613d2a565b60015b9050613d5183888481518110613d4257613d42614413565b60200260200101518387613ec5565b9250600185901c9450508080613d6690614472565b915050613d05565b50949350505050565b8160005b8451811015613dd7576000613d916002856143eb565b6000149050613dba83878481518110613dac57613dac614413565b602002602001015183613f25565b9250600184901c9350508080613dcf90614472565b915050613d7b565b509392505050565b604080516020810186905290810184905277ffffffffffffffffffffffffffffffffffffffffffffffff1960c084811b8216606084015283901b166068820152600090607001611e51565b600080600080613e3985613f8c565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015613e94573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b6040805160208101849052908101829052600090606001613a31565b60008215613f0557604080516020810184905290810186905260608101859052608001604051602081830303815290604052805190602001209050611e6a565b604080516020810184905290810185905260608101869052608001611e51565b60008115613f5e5760408051602081018690529081018490526060016040516020818303038152906040528051906020012090506107cd565b5050604080516020808201939093528082019390935280518084038201815260609093019052815191012090565b60008060008351604114613fcc576040517f4be6321b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505060208101516040820151606090920151909260009190911a90565b508054600082556005029060005260206000209081019061209491905b8082111561404f57600080825560018201805474ffffffffffffffffffffffffffffffffffffffffff1916905560028201819055600382018190556004820155600501614007565b5090565b60006020828403121561406557600080fd5b81356001600160e01b0319811681146107cd57600080fd5b6001600160a01b038116811461209457600080fd5b60ff8116811461209457600080fd5b600080604083850312156140b457600080fd5b82356140bf8161407d565b915060208301356140cf81614092565b809150509250929050565b6000602082840312156140ec57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561417657614163838551805182526001600160a01b03602082015116602083015260ff6040820151166040830152606081015160608301526080810151608083015260a081015160a08301525050565b9284019260c0929092019160010161410f565b50909695505050505050565b6000806040838503121561419557600080fd5b8235915060208301356140cf8161407d565b803567ffffffffffffffff811681146141bf57600080fd5b919050565b600080604083850312156141d757600080fd5b823591506141e7602084016141a7565b90509250929050565b6000610100828403121561420357600080fd5b50919050565b60008060006060848603121561421e57600080fd5b833567ffffffffffffffff8082111561423657600080fd5b614242878388016141f0565b9450602086013591508082111561425857600080fd5b614264878388016141f0565b9350604086013591508082111561427a57600080fd5b50614287868287016141f0565b9150509250925092565b6000806000606084860312156142a657600080fd5b83356142b181614092565b95602085013595506040909401359392505050565b600080600080608085870312156142dc57600080fd5b8435935060208501356142ee81614092565b93969395505050506040820135916060013590565b60008060006060848603121561431857600080fd5b833561432381614092565b9250602084013561433381614092565b9150604084013561434381614092565b809150509250925092565b60008060006060848603121561436357600080fd5b8335925060208401359150604084013561434381614092565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106665761066661437c565b818103818111156106665761066661437c565b6000602082840312156143ce57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b6000826143fa576143fa6143d5565b500690565b60008261440e5761440e6143d5565b500490565b634e487b7160e01b600052603260045260246000fd5b67ffffffffffffffff81811683821601908082111561444a5761444a61437c565b5092915050565b67ffffffffffffffff82811682821603908082111561444a5761444a61437c565b6000600182016144845761448461437c565b5060010190565b6000808335601e198436030181126144a257600080fd5b83018035915067ffffffffffffffff8211156144bd57600080fd5b6020019150600581901b36038213156144d557600080fd5b9250929050565b60c081016106668284805182526001600160a01b03602082015116602083015260ff6040820151166040830152606081015160608301526080810151608083015260a081015160a08301525050565b808201808211156106665761066661437c565b60005b83811015614559578181015183820152602001614541565b50506000910152565b6000835161457481846020880161453e565b9190910191825250602001919050565b600181815b808511156145bf5781600019048211156145a5576145a561437c565b808516156145b257918102915b93841c9390800290614589565b509250929050565b6000826145d657506001610666565b816145e357506000610666565b81600181146145f957600281146146035761461f565b6001915050610666565b60ff8411156146145761461461437c565b50506001821b610666565b5060208310610133831016604e8410600b8410161715614642575081810a610666565b61464c8383614584565b80600019048211156146605761466061437c565b029392505050565b60006107cd60ff8416836145c7565b60ff81811683821601908111156106665761066661437c565b60ff82811682821603908111156106665761066661437c565b61ffff82811682821603908082111561444a5761444a61437c565b60006107cd61ffff8416836145c7565b6000602082840312156146e657600080fd5b6107cd826141a7565b60008235607e1983360301811261470557600080fd5b9190910192915050565b60008060008060008060c0878903121561472857600080fd5b86516147338161407d565b602088015190965061474481614092565b604088015190955061475581614092565b6060880151909450801515811461476b57600080fd5b809350506080870151915060a087015190509295509295509295565b6000808335601e1984360301811261479e57600080fd5b83018035915067ffffffffffffffff8211156147b957600080fd5b6020019150368190038213156144d557600080fd5b6000602082840312156147e057600080fd5b81356107cd8161407d565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161482381601785016020880161453e565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161486081602884016020880161453e565b01602801949350505050565b602081526000825180602084015261488b81604085016020870161453e565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b6000816148c4576148c461437c565b50600019019056fea26469706673582212200ee3b010b6e6132df84327e2ab5e573e177e3ed2a665f5c10ddbb299e9a458d464736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005cf39e699b601c2ebc3e25b19fd4102d8366b56f000000000000000000000000cdfdc3752caaa826fe62531e0000c40546ec56a6000000000000000000000000f19f9d88e963a61c735c1716f8a689dc2887f463
-----Decoded View---------------
Arg [0] : staking (address): 0x5CF39e699b601c2EBc3e25b19Fd4102d8366b56F
Arg [1] : postageContract (address): 0xcdfdC3752caaA826fE62531E0000C40546eC56A6
Arg [2] : oracleContract (address): 0xf19F9d88e963A61c735C1716F8A689Dc2887F463
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000005cf39e699b601c2ebc3e25b19fd4102d8366b56f
Arg [1] : 000000000000000000000000cdfdc3752caaa826fe62531e0000c40546ec56a6
Arg [2] : 000000000000000000000000f19f9d88e963a61c735c1716f8a689dc2887f463
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.