More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 5,593 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Expire Limited | 36475974 | 13 mins ago | IN | 0 xDAI | 0.00091876 | ||||
Expire Limited | 36475825 | 25 mins ago | IN | 0 xDAI | 0.00057928 | ||||
Expire Limited | 36475673 | 38 mins ago | IN | 0 xDAI | 0.00019675 | ||||
Expire Limited | 36475672 | 39 mins ago | IN | 0 xDAI | 0.0007935 | ||||
Expire Limited | 36475522 | 51 mins ago | IN | 0 xDAI | 0.00100212 | ||||
Expire Limited | 36475368 | 1 hr ago | IN | 0 xDAI | 0.00073782 | ||||
Expire Limited | 36475218 | 1 hr ago | IN | 0 xDAI | 0.00057928 | ||||
Expire Limited | 36475066 | 1 hr ago | IN | 0 xDAI | 0.0007935 | ||||
Expire Limited | 36474760 | 1 hr ago | IN | 0 xDAI | 0.00062032 | ||||
Expire Limited | 36474455 | 2 hrs ago | IN | 0 xDAI | 0.00087501 | ||||
Expire Limited | 36474152 | 2 hrs ago | IN | 0 xDAI | 0.00062032 | ||||
Expire Limited | 36467614 | 12 hrs ago | IN | 0 xDAI | 0.0007935 | ||||
Expire Limited | 36467310 | 12 hrs ago | IN | 0 xDAI | 0.00106752 | ||||
Expire Limited | 36467160 | 12 hrs ago | IN | 0 xDAI | 0.00062032 | ||||
Expire Limited | 36467007 | 13 hrs ago | IN | 0 xDAI | 0.00089053 | ||||
Expire Limited | 36466855 | 13 hrs ago | IN | 0 xDAI | 0.00095592 | ||||
Expire Limited | 36466703 | 13 hrs ago | IN | 0 xDAI | 0.00061302 | ||||
Expire Limited | 36466401 | 13 hrs ago | IN | 0 xDAI | 0.00063449 | ||||
Expire Limited | 36465793 | 14 hrs ago | IN | 0 xDAI | 0.00075159 | ||||
Expire Limited | 36465640 | 14 hrs ago | IN | 0 xDAI | 0.00063449 | ||||
Expire Limited | 36465486 | 15 hrs ago | IN | 0 xDAI | 0.00070254 | ||||
Create Batch | 36465238 | 15 hrs ago | IN | 0 xDAI | 0.00071546 | ||||
Create Batch | 36465207 | 15 hrs ago | IN | 0 xDAI | 0.00070089 | ||||
Expire Limited | 36465184 | 15 hrs ago | IN | 0 xDAI | 0.00063771 | ||||
Expire Limited | 36465032 | 15 hrs ago | IN | 0 xDAI | 0.00046524 |
View more zero value Internal Transactions in Advanced View mode
Loading...
Loading
Contract Name:
PostageStamp
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/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./OrderStatisticsTree/HitchensOrderStatisticsTreeLib.sol"; /** * @title PostageStamp contract * @author The Swarm Authors * @dev The postage stamp contracts allows users to create and manage postage stamp batches. * The current balance for each batch is stored ordered in descending order of normalised balance. * Balance is normalised to be per chunk and the total spend since the contract was deployed, i.e. when a batch * is bought, its per-chunk balance is supplemented with the current cost of storing one chunk since the beginning of time, * as if the batch had existed since the contract's inception. During the _expiry_ process, each of these balances is * checked against the _currentTotalOutPayment_, a similarly normalised figure that represents the current cost of * storing one chunk since the beginning of time. A batch with a normalised balance less than _currentTotalOutPayment_ * is treated as expired. * * The _currentTotalOutPayment_ is calculated using _totalOutPayment_ which is updated during _setPrice_ events so * that the applicable per-chunk prices can be charged for the relevant periods of time. This can then be multiplied * by the amount of chunks which are allowed to be stamped by each batch to get the actual cost of storage. * * The amount of chunks a batch can stamp is determined by the _bucketDepth_. A batch may store a maximum of 2^depth chunks. * The global figure for the currently allowed chunks is tracked by _validChunkCount_ and updated during batch _expiry_ events. */ contract PostageStamp is AccessControl, Pausable { using HitchensOrderStatisticsTreeLib for HitchensOrderStatisticsTreeLib.Tree; // ----------------------------- State variables ------------------------------ // Address of the ERC20 token this contract references. address public bzzToken; // Minimum allowed depth of bucket. uint8 public minimumBucketDepth; // Role allowed to increase totalOutPayment. bytes32 public immutable PRICE_ORACLE_ROLE; // Role allowed to pause bytes32 public immutable PAUSER_ROLE; // Role allowed to withdraw the pot. bytes32 public immutable REDISTRIBUTOR_ROLE; // Associate every batch id with batch data. mapping(bytes32 => Batch) public batches; // Store every batch id ordered by normalisedBalance. HitchensOrderStatisticsTreeLib.Tree tree; // Total out payment per chunk, at the blockheight of the last price change. uint256 private totalOutPayment; // Combined global chunk capacity of valid batches remaining at the blockheight expire() was last called. uint256 public validChunkCount; // Lottery pot at last update. uint256 public pot; // Normalised balance at the blockheight expire() was last called. uint256 public lastExpiryBalance; // Price from the last update. uint64 public lastPrice; // blocks in 24 hours ~ 24 * 60 * 60 / 5 = 17280 uint64 public minimumValidityBlocks = 17280; // Block at which the last update occured. uint64 public lastUpdatedBlock; // ----------------------------- Type declarations ------------------------------ struct Batch { // Owner of this batch (0 if not valid). address owner; // Current depth of this batch. uint8 depth; // Bucket depth defined in this batch uint8 bucketDepth; // Whether this batch is immutable. bool immutableFlag; // Normalised balance per chunk. uint256 normalisedBalance; // When was this batch last updated uint256 lastUpdatedBlockNumber; } struct ImportBatch { bytes32 batchId; address owner; uint8 depth; uint8 bucketDepth; bool immutableFlag; uint256 remainingBalance; } // ----------------------------- Events ------------------------------ /** * @dev Emitted when a new batch is created. */ event BatchCreated( bytes32 indexed batchId, uint256 totalAmount, uint256 normalisedBalance, address owner, uint8 depth, uint8 bucketDepth, bool immutableFlag ); /** * @dev Emitted when an pot is Withdrawn. */ event PotWithdrawn(address recipient, uint256 totalAmount); /** * @dev Emitted when an existing batch is topped up. */ event BatchTopUp(bytes32 indexed batchId, uint256 topupAmount, uint256 normalisedBalance); /** * @dev Emitted when the depth of an existing batch increases. */ event BatchDepthIncrease(bytes32 indexed batchId, uint8 newDepth, uint256 normalisedBalance); /** *@dev Emitted on every price update. */ event PriceUpdate(uint256 price); /** *@dev Emitted on every batch failed in bulk batch creation */ event CopyBatchFailed(uint index, bytes32 batchId); // ----------------------------- Errors ------------------------------ error ZeroAddress(); // Owner cannot be the zero address error InvalidDepth(); // Invalid bucket depth error BatchExists(); // Batch already exists error InsufficientBalance(); // Insufficient initial balance for 24h minimum validity error TransferFailed(); // Failed transfer of BZZ tokens error ZeroBalance(); // NormalisedBalance cannot be zero error AdministratorOnly(); // Only administrator can use copy method error BatchDoesNotExist(); // Batch does not exist or has expired error BatchExpired(); // Batch already expired error BatchTooSmall(); // Batch too small to renew error NotBatchOwner(); // Not batch owner error DepthNotIncreasing(); // Depth not increasing error PriceOracleOnly(); // Only price oracle can set the price error InsufficienChunkCount(); // Insufficient valid chunk count error TotalOutpaymentDecreased(); // Current total outpayment should never decrease error NoBatchesExist(); // There are no batches error OnlyPauser(); // Only Pauser role can pause or unpause contracts error OnlyRedistributor(); // Only redistributor role can withdraw from the contract // ----------------------------- CONSTRUCTOR ------------------------------ /** * @param _bzzToken The ERC20 token address to reference in this contract. * @param _minimumBucketDepth The minimum bucket depth of batches that can be purchased. */ constructor(address _bzzToken, uint8 _minimumBucketDepth) { bzzToken = _bzzToken; minimumBucketDepth = _minimumBucketDepth; PRICE_ORACLE_ROLE = keccak256("PRICE_ORACLE_ROLE"); PAUSER_ROLE = keccak256("PAUSER_ROLE"); REDISTRIBUTOR_ROLE = keccak256("REDISTRIBUTOR_ROLE"); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(PAUSER_ROLE, msg.sender); } //////////////////////////////////////// // STATE CHANGING // //////////////////////////////////////// /** * @notice Create a new batch. * @dev At least `_initialBalancePerChunk*2^depth` tokens must be approved in the ERC20 token contract. * @param _owner Owner of the new batch. * @param _initialBalancePerChunk Initial balance per chunk. * @param _depth Initial depth of the new batch. * @param _nonce A random value used in the batch id derivation to allow multiple batches per owner. * @param _immutable Whether the batch is mutable. */ function createBatch( address _owner, uint256 _initialBalancePerChunk, uint8 _depth, uint8 _bucketDepth, bytes32 _nonce, bool _immutable ) external whenNotPaused returns (bytes32) { if (_owner == address(0)) { revert ZeroAddress(); } if (_bucketDepth == 0 || _bucketDepth < minimumBucketDepth || _bucketDepth >= _depth) { revert InvalidDepth(); } bytes32 batchId = keccak256(abi.encode(msg.sender, _nonce)); if (batches[batchId].owner != address(0)) { revert BatchExists(); } if (_initialBalancePerChunk < minimumInitialBalancePerChunk()) { revert InsufficientBalance(); } uint256 totalAmount = _initialBalancePerChunk * (1 << _depth); if (!ERC20(bzzToken).transferFrom(msg.sender, address(this), totalAmount)) { revert TransferFailed(); } uint256 normalisedBalance = currentTotalOutPayment() + (_initialBalancePerChunk); if (normalisedBalance == 0) { revert ZeroBalance(); } expireLimited(type(uint256).max); validChunkCount += 1 << _depth; batches[batchId] = Batch({ owner: _owner, depth: _depth, bucketDepth: _bucketDepth, immutableFlag: _immutable, normalisedBalance: normalisedBalance, lastUpdatedBlockNumber: block.number }); tree.insert(batchId, normalisedBalance); emit BatchCreated(batchId, totalAmount, normalisedBalance, _owner, _depth, _bucketDepth, _immutable); return batchId; } /** * @notice Manually create a new batch when facilitating migration, can only be called by the Admin role. * @dev At least `_initialBalancePerChunk*2^depth` tokens must be approved in the ERC20 token contract. * @param _owner Owner of the new batch. * @param _initialBalancePerChunk Initial balance per chunk of the batch. * @param _depth Initial depth of the new batch. * @param _batchId BatchId being copied (from previous version contract data). * @param _immutable Whether the batch is mutable. */ function copyBatch( address _owner, uint256 _initialBalancePerChunk, uint8 _depth, uint8 _bucketDepth, bytes32 _batchId, bool _immutable ) public whenNotPaused { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert AdministratorOnly(); } if (_owner == address(0)) { revert ZeroAddress(); } if (_bucketDepth == 0 || _bucketDepth >= _depth) { revert InvalidDepth(); } if (batches[_batchId].owner != address(0)) { revert BatchExists(); } uint256 totalAmount = _initialBalancePerChunk * (1 << _depth); uint256 normalisedBalance = currentTotalOutPayment() + (_initialBalancePerChunk); if (normalisedBalance == 0) { revert ZeroBalance(); } //update validChunkCount to remove currently expired batches expireLimited(type(uint256).max); validChunkCount += 1 << _depth; batches[_batchId] = Batch({ owner: _owner, depth: _depth, bucketDepth: _bucketDepth, immutableFlag: _immutable, normalisedBalance: normalisedBalance, lastUpdatedBlockNumber: block.number }); tree.insert(_batchId, normalisedBalance); emit BatchCreated(_batchId, totalAmount, normalisedBalance, _owner, _depth, _bucketDepth, _immutable); } /** * @notice Import batches in bulk * @dev Import batches in bulk to lower the number of transactions needed, * @dev becase of block limitations 90 batches per trx is ceiling, 60 to 70 sweetspot * @param bulkBatches array of batches */ function copyBatchBulk(ImportBatch[] calldata bulkBatches) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert AdministratorOnly(); } for (uint i = 0; i < bulkBatches.length; i++) { ImportBatch memory _batch = bulkBatches[i]; try this.copyBatch( _batch.owner, _batch.remainingBalance, _batch.depth, _batch.bucketDepth, _batch.batchId, _batch.immutableFlag ) { // Successful copyBatch call } catch { // copyBatch failed, handle error emit CopyBatchFailed(i, _batch.batchId); } } } /** * @notice Top up an existing batch. * @dev At least `_topupAmountPerChunk*2^depth` tokens must be approved in the ERC20 token contract. * @param _batchId The id of an existing batch. * @param _topupAmountPerChunk The amount of additional tokens to add per chunk. */ function topUp(bytes32 _batchId, uint256 _topupAmountPerChunk) external whenNotPaused { Batch memory batch = batches[_batchId]; if (batch.owner == address(0)) { revert BatchDoesNotExist(); } if (batch.normalisedBalance <= currentTotalOutPayment()) { revert BatchExpired(); } if (batch.depth <= minimumBucketDepth) { revert BatchTooSmall(); } if (remainingBalance(_batchId) + (_topupAmountPerChunk) < minimumInitialBalancePerChunk()) { revert InsufficientBalance(); } // per chunk balance multiplied by the batch size in chunks must be transferred from the sender uint256 totalAmount = _topupAmountPerChunk * (1 << batch.depth); if (!ERC20(bzzToken).transferFrom(msg.sender, address(this), totalAmount)) { revert TransferFailed(); } // update by removing batch and then reinserting tree.remove(_batchId, batch.normalisedBalance); batch.normalisedBalance = batch.normalisedBalance + (_topupAmountPerChunk); tree.insert(_batchId, batch.normalisedBalance); batches[_batchId].normalisedBalance = batch.normalisedBalance; emit BatchTopUp(_batchId, totalAmount, batch.normalisedBalance); } /** * @notice Increase the depth of an existing batch. * @dev Can only be called by the owner of the batch. * @param _batchId the id of an existing batch. * @param _newDepth the new (larger than the previous one) depth for this batch. */ function increaseDepth(bytes32 _batchId, uint8 _newDepth) external whenNotPaused { Batch memory batch = batches[_batchId]; if (batch.owner != msg.sender) { revert NotBatchOwner(); } if (!(minimumBucketDepth < _newDepth && batch.depth < _newDepth)) { revert DepthNotIncreasing(); } if (batch.normalisedBalance <= currentTotalOutPayment()) { revert BatchExpired(); } uint8 depthChange = _newDepth - batch.depth; uint256 newRemainingBalance = remainingBalance(_batchId) / (1 << depthChange); if (newRemainingBalance < minimumInitialBalancePerChunk()) { revert InsufficientBalance(); } expireLimited(type(uint256).max); validChunkCount += (1 << _newDepth) - (1 << batch.depth); tree.remove(_batchId, batch.normalisedBalance); batches[_batchId].depth = _newDepth; batches[_batchId].lastUpdatedBlockNumber = block.number; batch.normalisedBalance = currentTotalOutPayment() + newRemainingBalance; batches[_batchId].normalisedBalance = batch.normalisedBalance; tree.insert(_batchId, batch.normalisedBalance); emit BatchDepthIncrease(_batchId, _newDepth, batch.normalisedBalance); } /** * @notice Set a new price. * @dev Can only be called by the price oracle role. * @param _price The new price. */ function setPrice(uint256 _price) external { if (!hasRole(PRICE_ORACLE_ROLE, msg.sender)) { revert PriceOracleOnly(); } if (lastPrice != 0) { totalOutPayment = currentTotalOutPayment(); } lastPrice = uint64(_price); lastUpdatedBlock = uint64(block.number); emit PriceUpdate(_price); } function setMinimumValidityBlocks(uint64 _value) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { revert AdministratorOnly(); } minimumValidityBlocks = _value; } /** * @notice Reclaims a limited number of expired batches * @dev Can be used if reclaiming all expired batches would exceed the block gas limit, causing other * contract method calls to fail. * @param limit The maximum number of batches to expire. */ function expireLimited(uint256 limit) public { // the lower bound of the normalised balance for which we will check if batches have expired uint256 _lastExpiryBalance = lastExpiryBalance; uint256 i; for (i; i < limit; ) { if (isBatchesTreeEmpty()) { lastExpiryBalance = currentTotalOutPayment(); break; } // get the batch with the smallest normalised balance bytes32 fbi = firstBatchId(); // if the batch with the smallest balance has not yet expired // we have already reached the end of the batches we need // to expire, so exit the loop if (remainingBalance(fbi) > 0) { // the upper bound of the normalised balance for which we will check if batches have expired // value is updated when there are no expired batches left lastExpiryBalance = currentTotalOutPayment(); break; } // otherwise, the batch with the smallest balance has expired, // so we must remove the chunks this batch contributes to the global validChunkCount Batch memory batch = batches[fbi]; uint256 batchSize = 1 << batch.depth; if (validChunkCount < batchSize) { revert InsufficienChunkCount(); } validChunkCount -= batchSize; // since the batch expired _during_ the period we must add // remaining normalised payout for this batch only pot += batchSize * (batch.normalisedBalance - _lastExpiryBalance); tree.remove(fbi, batch.normalisedBalance); delete batches[fbi]; unchecked { ++i; } } // then, for all batches that have _not_ expired during the period // add the total normalised payout of all batches // multiplied by the remaining total valid chunk count // to the pot for the period since the last expiry if (lastExpiryBalance < _lastExpiryBalance) { revert TotalOutpaymentDecreased(); } // then, for all batches that have _not_ expired during the period // add the total normalised payout of all batches // multiplied by the remaining total valid chunk count // to the pot for the period since the last expiry pot += validChunkCount * (lastExpiryBalance - _lastExpiryBalance); } /** * @notice The current pot. */ function totalPot() public returns (uint256) { expireLimited(type(uint256).max); uint256 balance = ERC20(bzzToken).balanceOf(address(this)); return pot < balance ? pot : balance; } /** * @notice Withdraw the pot, authorised callers only. * @param beneficiary Recieves the current total pot. */ function withdraw(address beneficiary) external { if (!hasRole(REDISTRIBUTOR_ROLE, msg.sender)) { revert OnlyRedistributor(); } uint256 totalAmount = totalPot(); if (!ERC20(bzzToken).transfer(beneficiary, totalAmount)) { revert TransferFailed(); } emit PotWithdrawn(beneficiary, totalAmount); pot = 0; } /** * @notice Pause the contract. * @dev Can only be called by the pauser when not paused. * The contract can be provably stopped by renouncing the pauser role and the admin role once paused. */ function pause() public { if (!hasRole(PAUSER_ROLE, msg.sender)) { revert OnlyPauser(); } _pause(); } /** * @notice Unpause the contract. * @dev Can only be called by the pauser role while paused. */ function unPause() public { if (!hasRole(PAUSER_ROLE, msg.sender)) { revert OnlyPauser(); } _unpause(); } //////////////////////////////////////// // STATE READING // //////////////////////////////////////// /** * @notice Total per-chunk cost since the contract's deployment. * @dev Returns the total normalised all-time per chunk payout. * Only Batches with a normalised balance greater than this are valid. */ function currentTotalOutPayment() public view returns (uint256) { uint256 blocks = block.number - lastUpdatedBlock; uint256 increaseSinceLastUpdate = lastPrice * (blocks); return totalOutPayment + (increaseSinceLastUpdate); } function minimumInitialBalancePerChunk() public view returns (uint256) { return minimumValidityBlocks * lastPrice; } /** * @notice Return the per chunk balance not yet used up. * @param _batchId The id of an existing batch. */ function remainingBalance(bytes32 _batchId) public view returns (uint256) { Batch memory batch = batches[_batchId]; if (batch.owner == address(0)) { revert BatchDoesNotExist(); // Batch does not exist or expired } if (batch.normalisedBalance <= currentTotalOutPayment()) { return 0; } return batch.normalisedBalance - currentTotalOutPayment(); } /** * @notice Indicates whether expired batches exist. */ function expiredBatchesExist() public view returns (bool) { if (isBatchesTreeEmpty()) { return false; } return (remainingBalance(firstBatchId()) <= 0); } /** * @notice Return true if no batches exist */ function isBatchesTreeEmpty() public view returns (bool) { return tree.count() == 0; } /** * @notice Get the first batch id ordered by ascending normalised balance. * @dev If more than one batch id, return index at 0, if no batches, revert. */ function firstBatchId() public view returns (bytes32) { uint256 val = tree.first(); if (val == 0) { revert NoBatchesExist(); } return tree.valueKeyAtIndex(val, 0); } function batchOwner(bytes32 _batchId) public view returns (address) { return batches[_batchId].owner; } function batchDepth(bytes32 _batchId) public view returns (uint8) { return batches[_batchId].depth; } function batchBucketDepth(bytes32 _batchId) public view returns (uint8) { return batches[_batchId].bucketDepth; } function batchImmutableFlag(bytes32 _batchId) public view returns (bool) { return batches[_batchId].immutableFlag; } function batchNormalisedBalance(bytes32 _batchId) public view returns (uint256) { return batches[_batchId].normalisedBalance; } function batchLastUpdatedBlockNumber(bytes32 _batchId) public view returns (uint256) { return batches[_batchId].lastUpdatedBlockNumber; } }
// 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 (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// 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: MIT pragma solidity ^0.8.19; /* Hitchens Order Statistics Tree v0.99 A Solidity Red-Black Tree library to store and maintain a sorted data structure in a Red-Black binary search tree, with O(log 2n) insert, remove and search time (and gas, approximately) https://github.com/rob-Hitchens/OrderStatisticsTree Copyright (c) Rob Hitchens. the MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Significant portions from BokkyPooBahsRedBlackTreeLibrary, https://github.com/bokkypoobah/BokkyPooBahsRedBlackTreeLibrary THIS SOFTWARE IS NOT TESTED OR AUDITED. DO NOT USE FOR PRODUCTION. */ library HitchensOrderStatisticsTreeLib { uint private constant EMPTY = 0; struct Node { uint parent; uint left; uint right; bool red; bytes32[] keys; mapping(bytes32 => uint) keyMap; uint count; } struct Tree { uint root; mapping(uint => Node) nodes; } error ValueDoesNotExist(); // Provided value doesn't exist in the tree. error ValueCannotBeZero(); // Value to insert cannot be zero error ValueKeyPairExists(); // Value and Key pair exists. Cannot be inserted again. function first(Tree storage self) internal view returns (uint _value) { _value = self.root; if (_value == EMPTY) return 0; while (self.nodes[_value].left != EMPTY) { _value = self.nodes[_value].left; } } function exists(Tree storage self, uint value) internal view returns (bool _exists) { if (value == EMPTY) return false; if (value == self.root) return true; if (self.nodes[value].parent != EMPTY) return true; return false; } function keyExists(Tree storage self, bytes32 key, uint value) internal view returns (bool _exists) { if (!exists(self, value)) return false; return self.nodes[value].keys[self.nodes[value].keyMap[key]] == key; } function getNode( Tree storage self, uint value ) internal view returns (uint _parent, uint _left, uint _right, bool _red, uint keyCount, uint __count) { if (!exists(self, value)) { revert ValueDoesNotExist(); } Node storage gn = self.nodes[value]; return (gn.parent, gn.left, gn.right, gn.red, gn.keys.length, gn.keys.length + gn.count); } function getNodeCount(Tree storage self, uint value) internal view returns (uint __count) { Node storage gn = self.nodes[value]; return gn.keys.length + gn.count; } function valueKeyAtIndex(Tree storage self, uint value, uint index) internal view returns (bytes32 _key) { if (!exists(self, value)) { revert ValueDoesNotExist(); } return self.nodes[value].keys[index]; } function count(Tree storage self) internal view returns (uint _count) { return getNodeCount(self, self.root); } /* We don't use this functionality, so it is commented out to make audit easier function percentile(Tree storage self, uint value) internal view returns(uint _percentile) { uint denominator = count(self); uint numerator = rank(self, value); _percentile = ((uint(1000) * numerator)/denominator+(uint(5)))/uint(10); } function permil(Tree storage self, uint value) internal view returns(uint _permil) { uint denominator = count(self); uint numerator = rank(self, value); _permil = ((uint(10000) * numerator)/denominator+(uint(5)))/uint(10); } function atPercentile(Tree storage self, uint _percentile) internal view returns(uint _value) { uint findRank = (((_percentile * count(self))/uint(10)) + uint(5)) / uint(10); return atRank(self,findRank); } function atPermil(Tree storage self, uint _permil) internal view returns(uint _value) { uint findRank = (((_permil * count(self))/uint(100)) + uint(5)) / uint(10); return atRank(self,findRank); } function median(Tree storage self) internal view returns(uint value) { return atPercentile(self,50); } function below(Tree storage self, uint value) public view returns(uint _below) { if(count(self) > 0 && value > 0) _below = rank(self,value)-uint(1); } function above(Tree storage self, uint value) public view returns(uint _above) { if(count(self) > 0) _above = count(self)-rank(self,value); } function valueBelowEstimate(Tree storage self, uint estimate) public view returns(uint _below) { if(count(self) > 0 && estimate > 0) { uint highestValue = last(self); uint lowestValue = first(self); if(estimate < lowestValue) { return 0; } if(estimate >= highestValue) { return highestValue; } uint rankOfValue = rank(self, estimate); // approximation _below = atRank(self, rankOfValue); if(_below > estimate) { // fix error in approximation rankOfValue--; _below = atRank(self, rankOfValue); } } } function valueAboveEstimate(Tree storage self, uint estimate) public view returns(uint _above) { if(count(self) > 0 && estimate > 0) { uint highestValue = last(self); uint lowestValue = first(self); if(estimate > highestValue) { return 0; } if(estimate <= lowestValue) { return lowestValue; } uint rankOfValue = rank(self, estimate); // approximation _above = atRank(self, rankOfValue); if(_above < estimate) { // fix error in approximation rankOfValue++; _above = atRank(self, rankOfValue); } } } function rank(Tree storage self, uint value) internal view returns(uint _rank) { if(count(self) > 0) { bool finished; uint cursor = self.root; Node storage c = self.nodes[cursor]; uint smaller = getNodeCount(self,c.left); while (!finished) { uint keyCount = c.keys.length; if(cursor == value) { finished = true; } else { if(cursor < value) { cursor = c.right; c = self.nodes[cursor]; smaller += keyCount + getNodeCount(self,c.left); } else { cursor = c.left; c = self.nodes[cursor]; smaller -= (keyCount + getNodeCount(self,c.right)); } } if (!exists(self,cursor)) { finished = true; } } return smaller + 1; } } function atRank(Tree storage self, uint _rank) internal view returns(uint _value) { bool finished; uint cursor = self.root; Node storage c = self.nodes[cursor]; uint smaller = getNodeCount(self,c.left); while (!finished) { _value = cursor; c = self.nodes[cursor]; uint keyCount = c.keys.length; if(smaller + 1 >= _rank && smaller + keyCount <= _rank) { _value = cursor; finished = true; } else { if(smaller + keyCount <= _rank) { cursor = c.right; c = self.nodes[cursor]; smaller += keyCount + getNodeCount(self,c.left); } else { cursor = c.left; c = self.nodes[cursor]; smaller -= (keyCount + getNodeCount(self,c.right)); } } if (!exists(self,cursor)) { finished = true; } } } */ function insert(Tree storage self, bytes32 key, uint value) internal { if (value == EMPTY) { revert ValueCannotBeZero(); } if (keyExists(self, key, value)) { revert ValueKeyPairExists(); } uint cursor; uint probe = self.root; while (probe != EMPTY) { cursor = probe; if (value < probe) { probe = self.nodes[probe].left; } else if (value > probe) { probe = self.nodes[probe].right; } else if (value == probe) { self.nodes[probe].keys.push(key); self.nodes[probe].keyMap[key] = self.nodes[probe].keys.length - uint(1); return; } self.nodes[cursor].count++; } Node storage nValue = self.nodes[value]; nValue.parent = cursor; nValue.left = EMPTY; nValue.right = EMPTY; nValue.red = true; nValue.keys.push(key); nValue.keyMap[key] = nValue.keys.length - uint(1); if (cursor == EMPTY) { self.root = value; } else if (value < cursor) { self.nodes[cursor].left = value; } else { self.nodes[cursor].right = value; } insertFixup(self, value); } function remove(Tree storage self, bytes32 key, uint value) internal { if (value == EMPTY) { revert ValueCannotBeZero(); } if (!keyExists(self, key, value)) { revert ValueDoesNotExist(); } Node storage nValue = self.nodes[value]; uint rowToDelete = nValue.keyMap[key]; bytes32 last = nValue.keys[nValue.keys.length - uint(1)]; nValue.keys[rowToDelete] = last; nValue.keyMap[last] = rowToDelete; nValue.keys.pop(); uint probe; uint cursor; if (nValue.keys.length == 0) { if (self.nodes[value].left == EMPTY || self.nodes[value].right == EMPTY) { cursor = value; } else { cursor = self.nodes[value].right; while (self.nodes[cursor].left != EMPTY) { cursor = self.nodes[cursor].left; } } if (self.nodes[cursor].left != EMPTY) { probe = self.nodes[cursor].left; } else { probe = self.nodes[cursor].right; } uint cursorParent = self.nodes[cursor].parent; self.nodes[probe].parent = cursorParent; if (cursorParent != EMPTY) { if (cursor == self.nodes[cursorParent].left) { self.nodes[cursorParent].left = probe; } else { self.nodes[cursorParent].right = probe; } } else { self.root = probe; } bool doFixup = !self.nodes[cursor].red; if (cursor != value) { replaceParent(self, cursor, value); self.nodes[cursor].left = self.nodes[value].left; self.nodes[self.nodes[cursor].left].parent = cursor; self.nodes[cursor].right = self.nodes[value].right; self.nodes[self.nodes[cursor].right].parent = cursor; self.nodes[cursor].red = self.nodes[value].red; (cursor, value) = (value, cursor); fixCountRecurse(self, value); } if (doFixup) { removeFixup(self, probe); } fixCountRecurse(self, cursorParent); delete self.nodes[cursor]; } } function fixCountRecurse(Tree storage self, uint value) private { while (value != EMPTY) { self.nodes[value].count = getNodeCount(self, self.nodes[value].left) + getNodeCount(self, self.nodes[value].right); value = self.nodes[value].parent; } } function treeMinimum(Tree storage self, uint value) private view returns (uint) { while (self.nodes[value].left != EMPTY) { value = self.nodes[value].left; } return value; } function treeMaximum(Tree storage self, uint value) private view returns (uint) { while (self.nodes[value].right != EMPTY) { value = self.nodes[value].right; } return value; } function rotateLeft(Tree storage self, uint value) private { uint cursor = self.nodes[value].right; uint parent = self.nodes[value].parent; uint cursorLeft = self.nodes[cursor].left; self.nodes[value].right = cursorLeft; if (cursorLeft != EMPTY) { self.nodes[cursorLeft].parent = value; } self.nodes[cursor].parent = parent; if (parent == EMPTY) { self.root = cursor; } else if (value == self.nodes[parent].left) { self.nodes[parent].left = cursor; } else { self.nodes[parent].right = cursor; } self.nodes[cursor].left = value; self.nodes[value].parent = cursor; self.nodes[value].count = getNodeCount(self, self.nodes[value].left) + getNodeCount(self, self.nodes[value].right); self.nodes[cursor].count = getNodeCount(self, self.nodes[cursor].left) + getNodeCount(self, self.nodes[cursor].right); } function rotateRight(Tree storage self, uint value) private { uint cursor = self.nodes[value].left; uint parent = self.nodes[value].parent; uint cursorRight = self.nodes[cursor].right; self.nodes[value].left = cursorRight; if (cursorRight != EMPTY) { self.nodes[cursorRight].parent = value; } self.nodes[cursor].parent = parent; if (parent == EMPTY) { self.root = cursor; } else if (value == self.nodes[parent].right) { self.nodes[parent].right = cursor; } else { self.nodes[parent].left = cursor; } self.nodes[cursor].right = value; self.nodes[value].parent = cursor; self.nodes[value].count = getNodeCount(self, self.nodes[value].left) + getNodeCount(self, self.nodes[value].right); self.nodes[cursor].count = getNodeCount(self, self.nodes[cursor].left) + getNodeCount(self, self.nodes[cursor].right); } function insertFixup(Tree storage self, uint value) private { uint cursor; while (value != self.root && self.nodes[self.nodes[value].parent].red) { uint valueParent = self.nodes[value].parent; if (valueParent == self.nodes[self.nodes[valueParent].parent].left) { cursor = self.nodes[self.nodes[valueParent].parent].right; if (self.nodes[cursor].red) { self.nodes[valueParent].red = false; self.nodes[cursor].red = false; self.nodes[self.nodes[valueParent].parent].red = true; value = self.nodes[valueParent].parent; } else { if (value == self.nodes[valueParent].right) { value = valueParent; rotateLeft(self, value); } valueParent = self.nodes[value].parent; self.nodes[valueParent].red = false; self.nodes[self.nodes[valueParent].parent].red = true; rotateRight(self, self.nodes[valueParent].parent); } } else { cursor = self.nodes[self.nodes[valueParent].parent].left; if (self.nodes[cursor].red) { self.nodes[valueParent].red = false; self.nodes[cursor].red = false; self.nodes[self.nodes[valueParent].parent].red = true; value = self.nodes[valueParent].parent; } else { if (value == self.nodes[valueParent].left) { value = valueParent; rotateRight(self, value); } valueParent = self.nodes[value].parent; self.nodes[valueParent].red = false; self.nodes[self.nodes[valueParent].parent].red = true; rotateLeft(self, self.nodes[valueParent].parent); } } } self.nodes[self.root].red = false; } function replaceParent(Tree storage self, uint a, uint b) private { uint bParent = self.nodes[b].parent; self.nodes[a].parent = bParent; if (bParent == EMPTY) { self.root = a; } else { if (b == self.nodes[bParent].left) { self.nodes[bParent].left = a; } else { self.nodes[bParent].right = a; } } } function removeFixup(Tree storage self, uint value) private { uint cursor; while (value != self.root && !self.nodes[value].red) { uint valueParent = self.nodes[value].parent; if (value == self.nodes[valueParent].left) { cursor = self.nodes[valueParent].right; if (self.nodes[cursor].red) { self.nodes[cursor].red = false; self.nodes[valueParent].red = true; rotateLeft(self, valueParent); cursor = self.nodes[valueParent].right; } if (!self.nodes[self.nodes[cursor].left].red && !self.nodes[self.nodes[cursor].right].red) { self.nodes[cursor].red = true; value = valueParent; } else { if (!self.nodes[self.nodes[cursor].right].red) { self.nodes[self.nodes[cursor].left].red = false; self.nodes[cursor].red = true; rotateRight(self, cursor); cursor = self.nodes[valueParent].right; } self.nodes[cursor].red = self.nodes[valueParent].red; self.nodes[valueParent].red = false; self.nodes[self.nodes[cursor].right].red = false; rotateLeft(self, valueParent); value = self.root; } } else { cursor = self.nodes[valueParent].left; if (self.nodes[cursor].red) { self.nodes[cursor].red = false; self.nodes[valueParent].red = true; rotateRight(self, valueParent); cursor = self.nodes[valueParent].left; } if (!self.nodes[self.nodes[cursor].right].red && !self.nodes[self.nodes[cursor].left].red) { self.nodes[cursor].red = true; value = valueParent; } else { if (!self.nodes[self.nodes[cursor].left].red) { self.nodes[self.nodes[cursor].right].red = false; self.nodes[cursor].red = true; rotateLeft(self, cursor); cursor = self.nodes[valueParent].left; } self.nodes[cursor].red = self.nodes[valueParent].red; self.nodes[valueParent].red = false; self.nodes[self.nodes[cursor].left].red = false; rotateRight(self, valueParent); value = self.root; } } } self.nodes[value].red = false; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_bzzToken","type":"address"},{"internalType":"uint8","name":"_minimumBucketDepth","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AdministratorOnly","type":"error"},{"inputs":[],"name":"BatchDoesNotExist","type":"error"},{"inputs":[],"name":"BatchExists","type":"error"},{"inputs":[],"name":"BatchExpired","type":"error"},{"inputs":[],"name":"BatchTooSmall","type":"error"},{"inputs":[],"name":"DepthNotIncreasing","type":"error"},{"inputs":[],"name":"InsufficienChunkCount","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidDepth","type":"error"},{"inputs":[],"name":"NoBatchesExist","type":"error"},{"inputs":[],"name":"NotBatchOwner","type":"error"},{"inputs":[],"name":"OnlyPauser","type":"error"},{"inputs":[],"name":"OnlyRedistributor","type":"error"},{"inputs":[],"name":"PriceOracleOnly","type":"error"},{"inputs":[],"name":"TotalOutpaymentDecreased","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"ValueCannotBeZero","type":"error"},{"inputs":[],"name":"ValueDoesNotExist","type":"error"},{"inputs":[],"name":"ValueKeyPairExists","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroBalance","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"batchId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"normalisedBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint8","name":"depth","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"bucketDepth","type":"uint8"},{"indexed":false,"internalType":"bool","name":"immutableFlag","type":"bool"}],"name":"BatchCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"batchId","type":"bytes32"},{"indexed":false,"internalType":"uint8","name":"newDepth","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"normalisedBalance","type":"uint256"}],"name":"BatchDepthIncrease","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"batchId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"topupAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"normalisedBalance","type":"uint256"}],"name":"BatchTopUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"batchId","type":"bytes32"}],"name":"CopyBatchFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"PotWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"PriceUpdate","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":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_ORACLE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDISTRIBUTOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"batchBucketDepth","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"batchDepth","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"batchImmutableFlag","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"batchLastUpdatedBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"batchNormalisedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"batchOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"batches","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"depth","type":"uint8"},{"internalType":"uint8","name":"bucketDepth","type":"uint8"},{"internalType":"bool","name":"immutableFlag","type":"bool"},{"internalType":"uint256","name":"normalisedBalance","type":"uint256"},{"internalType":"uint256","name":"lastUpdatedBlockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bzzToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_initialBalancePerChunk","type":"uint256"},{"internalType":"uint8","name":"_depth","type":"uint8"},{"internalType":"uint8","name":"_bucketDepth","type":"uint8"},{"internalType":"bytes32","name":"_batchId","type":"bytes32"},{"internalType":"bool","name":"_immutable","type":"bool"}],"name":"copyBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"batchId","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"depth","type":"uint8"},{"internalType":"uint8","name":"bucketDepth","type":"uint8"},{"internalType":"bool","name":"immutableFlag","type":"bool"},{"internalType":"uint256","name":"remainingBalance","type":"uint256"}],"internalType":"struct PostageStamp.ImportBatch[]","name":"bulkBatches","type":"tuple[]"}],"name":"copyBatchBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_initialBalancePerChunk","type":"uint256"},{"internalType":"uint8","name":"_depth","type":"uint8"},{"internalType":"uint8","name":"_bucketDepth","type":"uint8"},{"internalType":"bytes32","name":"_nonce","type":"bytes32"},{"internalType":"bool","name":"_immutable","type":"bool"}],"name":"createBatch","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentTotalOutPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"expireLimited","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expiredBatchesExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"firstBatchId","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":"_batchId","type":"bytes32"},{"internalType":"uint8","name":"_newDepth","type":"uint8"}],"name":"increaseDepth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isBatchesTreeEmpty","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastExpiryBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPrice","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdatedBlock","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumBucketDepth","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumInitialBalancePerChunk","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumValidityBlocks","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"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":[],"name":"pot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"}],"name":"remainingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_value","type":"uint64"}],"name":"setMinimumValidityBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_batchId","type":"bytes32"},{"internalType":"uint256","name":"_topupAmountPerChunk","type":"uint256"}],"name":"topUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalPot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"validChunkCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e060405260098054600160401b600160801b03191669438000000000000000001790553480156200003057600080fd5b5060405162003bc938038062003bc98339810160408190526200005391620001c4565b600180546001600160b01b0319166101006001600160a01b0385160260ff60a81b191617600160a81b60ff8416021790557f1337d7d57528a8879766fdf2d0456253114c66c4fc263c97168bfdb007c64c666080527f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60a0527f3e35b14a9f4fef84b59f9bdcd3044fc28783144b7e42bfb2cd075e6a02cb082860c052620000fd60003362000114565b60a0516200010c903362000114565b505062000213565b62000120828262000124565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000120576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001803390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008060408385031215620001d857600080fd5b82516001600160a01b0381168114620001f057600080fd5b602084015190925060ff811681146200020857600080fd5b809150509250929050565b60805160a05160c05161396a6200025f600039600081816105bb015261118b01526000818161075e015281816118ad0152611e2b015260008181610609015261199e015261396a6000f3fe608060405234801561001057600080fd5b50600436106102f45760003560e01c806381e508b911610191578063b998902f116100e3578063dd483cfb11610097578063ea612e1f11610071578063ea612e1f14610780578063f7b188a514610789578063f90ce5ba1461079157600080fd5b8063dd483cfb14610716578063df67438514610736578063e63ab1e91461075957600080fd5b8063d547741f116100c8578063d547741f146106c6578063d71ba7c4146106d9578063d968f44b146106ec57600080fd5b8063b998902f14610604578063c81e25ab1461062b57600080fd5b806391b7f5ed11610145578063a6471a1d1161011f578063a6471a1d146105b6578063a81064ee146105dd578063b67644b9146105f157600080fd5b806391b7f5ed1461056457806391d1485414610577578063a217fddf146105ae57600080fd5b80638a5e8e32116101765780638a5e8e321461054b5780638b82547f14610554578063906978421461055c57600080fd5b806381e508b91461051f5780638456cb591461054357600080fd5b8063420fc4db1161024a57806351b17cd0116101fe5780635c975abb116101d85780635c975abb146104f9578063628de87714610504578063711bfa2b1461051757600080fd5b806351b17cd0146104cb57806351cff8d9146104d35780635239af71146104e657600080fd5b806347aab79b1161022f57806347aab79b1461049c5780634ba2363a146104af5780634bb13e34146104b857600080fd5b8063420fc4db1461045a57806344beae8e1461047257600080fd5b80632182ddb1116102ac5780632f2ff15d116102865780632f2ff15d146103f857806332ac57dd1461040b57806336568abe1461044757600080fd5b80632182ddb11461037e578063248a9ca3146103bf57806324b570a9146103f057600080fd5b80631889b99b116102dd5780631889b99b1461034e57806318c8572f146103565780631a37b4851461036b57600080fd5b806301ffc9a7146102f9578063053f14da14610321575b600080fd5b61030c610307366004613427565b6107ac565b60405190151581526020015b60405180910390f35b6009546103359067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610318565b61030c610845565b6103696103643660046134aa565b610857565b005b610369610379366004613514565b610af1565b6103a761038c36600461353e565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b039091168152602001610318565b6103e26103cd36600461353e565b60009081526020819052604090206001015490565b604051908152602001610318565b6103e2610b87565b610369610406366004613557565b610c3a565b61043561041936600461353e565b600090815260026020526040902054600160a81b900460ff1690565b60405160ff9091168152602001610318565b610369610455366004613557565b610c64565b6001546103a79061010090046001600160a01b031681565b61043561048036600461353e565b600090815260026020526040902054600160a01b900460ff1690565b6103696104aa366004613583565b610cf5565b6103e260075481565b6103696104c63660046135a6565b610fa8565b6103e2611131565b6103696104e136600461361b565b611189565b6103e26104f43660046134aa565b611306565b60015460ff1661030c565b61036961051236600461353e565b611664565b61030c611882565b6103e261052d36600461353e565b6000908152600260208190526040909120015490565b6103696118ab565b6103e260065481565b6103e261190e565b6103e2611964565b61036961057236600461353e565b61199c565b61030c610585366004613557565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6103e2600081565b6103e27f000000000000000000000000000000000000000000000000000000000000000081565b60015461043590600160a81b900460ff1681565b6103696105ff366004613636565b611aab565b6103e27f000000000000000000000000000000000000000000000000000000000000000081565b61068661063936600461353e565b60026020819052600091825260409091208054600182015491909201546001600160a01b0383169260ff600160a01b8204811693600160a81b8304821693600160b01b9093049091169186565b604080516001600160a01b0397909716875260ff9586166020880152939094169285019290925215156060840152608083015260a082015260c001610318565b6103696106d4366004613557565b611d3f565b6103e26106e736600461353e565b611d64565b61030c6106fa36600461353e565b600090815260026020526040902054600160b01b900460ff1690565b6009546103359068010000000000000000900467ffffffffffffffff1681565b6103e261074436600461353e565b60009081526002602052604090206001015490565b6103e27f000000000000000000000000000000000000000000000000000000000000000081565b6103e260085481565b610369611e29565b60095461033590600160801b900467ffffffffffffffff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061083f57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006108516003611e8a565b15919050565b61085f611e9a565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff166108ae57604051635844c9e760e11b815260040160405180910390fd5b6001600160a01b0386166108d55760405163d92e233d60e01b815260040160405180910390fd5b60ff831615806108eb57508360ff168360ff1610155b1561090957604051630a0b2c3560e41b815260040160405180910390fd5b6000828152600260205260409020546001600160a01b03161561093f576040516311ab459f60e21b815260040160405180910390fd5b6000610951600160ff87161b8761366e565b905060008661095e611131565b6109689190613685565b90508060000361098b5760405163334ab3f560e11b815260040160405180910390fd5b610996600019611664565b8560ff166001901b600660008282546109af9190613685565b90915550506040805160c0810182526001600160a01b03808b16825260ff808a1660208085019182528a831685870190815289151560608701908152608087018981524360a0890190815260008e815260029586905299909920975188549551935192511515600160b01b0260ff60b01b19938816600160a81b029390931661ffff60a81b1994909716600160a01b0274ffffffffffffffffffffffffffffffffffffffffff19909616971696909617939093171692909217178355905160018301559151910155610a8360038583611eed565b60408051838152602081018390526001600160a01b038a168183015260ff88811660608301528716608082015284151560a0820152905185917f9b088e2c89b322a3c1d81515e1c88db3d386d022926f0e2d0b9b5813b7413d58919081900360c00190a25050505050505050565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16610b4057604051635844c9e760e11b815260040160405180910390fd5b6009805467ffffffffffffffff90921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055565b6000610b94600019611664565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f9190613698565b90508060075410610c305780610c34565b6007545b91505090565b600082815260208190526040902060010154610c55816120f0565b610c5f83836120fd565b505050565b6001600160a01b0381163314610ce75760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b610cf1828261219b565b5050565b610cfd611e9a565b600082815260026020818152604092839020835160c08101855281546001600160a01b03811680835260ff600160a01b8304811695840195909552600160a81b8204851696830196909652600160b01b900490921615156060830152600181015460808301529091015460a0820152903314610da5576040517fb72bcb2f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460ff808416600160a81b90920416108015610dcc57508160ff16816020015160ff16105b610e02576040517fd5fd03fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e0a611131565b816080015111610e2d576040516368aebbc560e01b815260040160405180910390fd5b6000816020015183610e3f91906136b1565b90506000600160ff83161b610e5386611d64565b610e5d91906136ca565b9050610e67611964565b811015610e8757604051631e9acf1760e31b815260040160405180910390fd5b610e92600019611664565b826020015160ff166001901b8460ff166001901b610eb091906136ec565b60066000828254610ec19190613685565b90915550506080830151610ed990600390879061221a565b600085815260026020819052604090912080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b60ff8816021781554391015580610f28611131565b610f329190613685565b6080840181815260008781526002602052604090206001019190915551610f5d906003908790611eed565b60808301516040805160ff87168152602081019290925286917faf27998ec15e9d3809edad41aec1b5551d8412e71bd07c91611a0237ead1dc8e910160405180910390a25050505050565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16610ff757604051635844c9e760e11b815260040160405180910390fd5b60005b81811015610c5f576000838383818110611016576110166136ff565b905060c0020180360381019061102c919061372b565b602081015160a082015160408084015160608501518551608087015193517f18c8572f0000000000000000000000000000000000000000000000000000000081526001600160a01b039096166004870152602486019490945260ff91821660448601521660648401526084830191909152151560a482015290915030906318c8572f9060c401600060405180830381600087803b1580156110cc57600080fd5b505af19250505080156110dd575060015b61111e5780516040805184815260208101929092527f7ded044f9ef68a0ffb6bdb48c80387f300787e7492659224ad140db77893950d910160405180910390a15b5080611129816137cd565b915050610ffa565b600954600090819061115490600160801b900467ffffffffffffffff16436136ec565b60095490915060009061117290839067ffffffffffffffff1661366e565b9050806005546111829190613685565b9250505090565b7f000000000000000000000000000000000000000000000000000000000000000060009081526020818152604080832033845290915290205460ff166111fb576040517f24876df800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611205610b87565b6001546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152602482018490529293506101009091049091169063a9059cbb906044016020604051808303816000875af115801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e91906137e6565b6112bb576040516312171d8360e31b815260040160405180910390fd5b604080516001600160a01b0384168152602081018390527ff5d8f9b1e7af440e1e7915f4693ccc004d1461a7dafd17ea7347d03decf298e1910160405180910390a150506000600755565b6000611310611e9a565b6001600160a01b0387166113375760405163d92e233d60e01b815260040160405180910390fd5b60ff84161580611356575060015460ff600160a81b9091048116908516105b8061136757508460ff168460ff1610155b1561138557604051630a0b2c3560e41b815260040160405180910390fd5b6040805133602082015290810184905260009060600160408051601f198184030181529181528151602092830120600081815260029093529120549091506001600160a01b0316156113ea576040516311ab459f60e21b815260040160405180910390fd5b6113f2611964565b87101561141257604051631e9acf1760e31b815260040160405180910390fd5b6000611424600160ff89161b8961366e565b6001546040516323b872dd60e01b81523360048201523060248201526044810183905291925061010090046001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611481573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a591906137e6565b6114c2576040516312171d8360e31b815260040160405180910390fd5b6000886114cd611131565b6114d79190613685565b9050806000036114fa5760405163334ab3f560e11b815260040160405180910390fd5b611505600019611664565b8760ff166001901b6006600082825461151e9190613685565b90915550506040805160c0810182526001600160a01b03808d16825260ff808c1660208085019182528c83168587019081528b151560608701908152608087018981524360a0890190815260008d815260029586905299909920975188549551935192511515600160b01b0260ff60b01b19938816600160a81b029390931661ffff60a81b1994909716600160a01b0274ffffffffffffffffffffffffffffffffffffffffff199096169716969096179390931716929092171783559051600183015591519101556115f260038483611eed565b60408051838152602081018390526001600160a01b038c168183015260ff8a811660608301528916608082015286151560a0820152905184917f9b088e2c89b322a3c1d81515e1c88db3d386d022926f0e2d0b9b5813b7413d58919081900360c00190a2509098975050505050505050565b60085460005b828110156118105761167a610845565b1561168f57611687611131565b600855611810565b600061169961190e565b905060006116a682611d64565b11156116bd576116b4611131565b60085550611810565b600081815260026020818152604092839020835160c08101855281546001600160a01b038116825260ff600160a01b82048116948301859052600160a81b8204811696830196909652600160b01b900490941615156060850152600180820154608086015292015460a084015260065491901b9081111561176a576040517f9b02220b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806006600082825461177c91906136ec565b909155505060808201516117919086906136ec565b61179b908261366e565b600760008282546117ac9190613685565b909155505060808201516117c490600390859061221a565b50506000908152600260208190526040822080547fffffffffffffffffff000000000000000000000000000000000000000000000016815560018082018490559101919091550161166a565b81600854101561184c576040517f530da97a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8160085461185a91906136ec565b600654611867919061366e565b600760008282546118789190613685565b9091555050505050565b600061188c610845565b156118975750600090565b60006118a46106e761190e565b1115905090565b7f000000000000000000000000000000000000000000000000000000000000000060009081526020818152604080832033845290915290205460ff1661190457604051631d77d47760e21b815260040160405180910390fd5b61190c61256b565b565b60008061191b60036125bf565b905080600003611957576040517f46c83ec800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c346003826000612606565b60095460009061198d9067ffffffffffffffff8082169168010000000000000000900416613803565b67ffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000060009081526020818152604080832033845290915290205460ff16611a0e576040517fea0f601b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60095467ffffffffffffffff1615611a2c57611a28611131565b6005555b600980544367ffffffffffffffff908116600160801b027fffffffffffffffff0000000000000000ffffffffffffffff0000000000000000909216908416171790556040517fae46785019700e30375a5d7b4f91e32f8060ef085111f896ebf889450aa2ab5a90611aa09083815260200190565b60405180910390a150565b611ab3611e9a565b600082815260026020818152604092839020835160c08101855281546001600160a01b03811680835260ff600160a01b8304811695840195909552600160a81b8204851696830196909652600160b01b900490921615156060830152600181015460808301529091015460a082015290611b4057604051634ee9bc0f60e01b815260040160405180910390fd5b611b48611131565b816080015111611b6b576040516368aebbc560e01b815260040160405180910390fd5b600154602082015160ff600160a81b9092048216911611611bb8576040517f7103b80500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611bc0611964565b82611bca85611d64565b611bd49190613685565b1015611bf357604051631e9acf1760e31b815260040160405180910390fd5b6000816020015160ff166001901b83611c0c919061366e565b6001546040516323b872dd60e01b81523360048201523060248201526044810183905291925061010090046001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8d91906137e6565b611caa576040516312171d8360e31b815260040160405180910390fd5b6080820151611cbd90600390869061221a565b828260800151611ccd9190613685565b60808301819052611ce2906003908690611eed565b60808201805160008681526002602090815260409182902060010192909255915182518481529182015285917faf5756c62d6c0722ef9be1f82bef97ab06ea5aea7f3eb8ad348422079f01d88d910160405180910390a250505050565b600082815260208190526040902060010154611d5a816120f0565b610c5f838361219b565b6000818152600260208181526040808420815160c08101835281546001600160a01b03811680835260ff600160a01b8304811696840196909652600160a81b8204861694830194909452600160b01b900490931615156060840152600181015460808401529092015460a082015290611df057604051634ee9bc0f60e01b815260040160405180910390fd5b611df8611131565b816080015111611e0b5750600092915050565b611e13611131565b8160800151611e2291906136ec565b9392505050565b7f000000000000000000000000000000000000000000000000000000000000000060009081526020818152604080832033845290915290205460ff16611e8257604051631d77d47760e21b815260040160405180910390fd5b61190c612668565b600061083f8283600001546126a1565b60015460ff161561190c5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610cde565b80611f0b576040516363868c5560e11b815260040160405180910390fd5b611f168383836126cd565b15611f4d576040517f6082d5c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82546000905b80156120315780915080831015611f7d576000908152600180860160205260409091200154612008565b80831115611f9e576000908152600185016020526040902060020154612008565b808303612008576000818152600180870160209081526040832060040180548084018255818552918420909101879055918390529054611fde91906136ec565b60009182526001909501602090815260408083209583526005909501905292909220929092555050565b60008281526001860160205260408120600601805491612027836137cd565b9190505550611f53565b600083815260018087016020908152604083208581558083018490556002810184905560038101805460ff191684179055600481018054808501825581865292909420909101879055915461208691906136ec565b6000868152600583016020526040902055826120a4578386556120de565b828410156120c757600083815260018088016020526040909120018490556120de565b600083815260018701602052604090206002018490555b6120e88685612733565b505050505050565b6120fa813361299b565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610cf1576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556121573390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610cf1576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80612238576040516363868c5560e11b815260040160405180910390fd5b6122438383836126cd565b61226057604051635889b1c560e11b815260040160405180910390fd5b6000818152600180850160209081526040808420868552600581019092528320546004820180549294919391929091612298916136ec565b815481106122a8576122a86136ff565b90600052602060002001549050808360040183815481106122cb576122cb6136ff565b60009182526020808320909101929092558281526005850190915260409020829055600483018054806123005761230061382f565b6001900381819060005260206000200160009055905560008084600401805490506000036125615760008681526001808a0160205260409091200154158061235957506000868152600189016020526040902060020154155b156123655750846123ad565b5060008581526001880160205260409020600201545b60008181526001808a0160205260409091200154156123ad57600090815260018089016020526040909120015461237b565b60008181526001808a0160205260409091200154156123e15760008181526001808a016020526040909120015491506123f8565b600081815260018901602052604090206002015491505b600081815260018901602052604080822054848352912081905580156124685760008181526001808b0160205260409091200154820361244d5760008181526001808b0160205260409091200183905561246c565b600081815260018a016020526040902060020183905561246c565b8289555b600082815260018a01602052604090206003015460ff16158783146124ff576124968a848a612a0e565b600088815260018b8101602052604080832080830154878552828520938401819055845281842087905560028082015490840181905584529083208690556003908101549286905201805460ff191660ff90921615159190911790559196916124ff8a89612a87565b801561250f5761250f8a85612af4565b6125198a83612a87565b60008381526001808c01602052604082208281559081018290556002810182905560038101805460ff191690559061255460048301826133f5565b6006820160009055505050505b5050505050505050565b612573611e9a565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b8054806125ce57506000919050565b5b6000818152600180840160205260409091200154156126015760009081526001808301602052604090912001546125cf565b919050565b60006126128484612f0d565b61262f57604051635889b1c560e11b815260040160405180910390fd5b60008381526001850160205260409020600401805483908110612654576126546136ff565b906000526020600020015490509392505050565b612670612f53565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336125a2565b60008181526001830160205260408120600681015460048201546126c59190613685565b949350505050565b60006126d98483612f0d565b6126e557506000611e22565b60008281526001850160209081526040808320868452600581019092529091205460049091018054859290811061271e5761271e6136ff565b90600052602060002001541490509392505050565b60005b825482148015906127605750600082815260018401602052604080822054825290206003015460ff165b1561297957600082815260018085016020526040808320548084528184205484529220015481036128815760008181526001850160205260408082205482528082206002015480835291206003015490925060ff1615612808576000818152600180860160205260408083206003808201805460ff19908116909155878652838620820180548216905582548652928520018054909216909217905590829052549250612973565b6000818152600185016020526040902060020154830361282f5780925061282f8484612fa5565b50600082815260018085016020526040808320548084528184206003808201805460ff1990811690915582548752938620018054909316909317909155918290525461287c908590613122565b612973565b6000818152600180860160205260408083205483528083209091015480835291206003015490925060ff16156128ff576000818152600180860160205260408083206003808201805460ff19908116909155878652838620820180548216905582548652928520018054909216909217905590829052549250612973565b60008181526001808601602052604090912001548303612926578092506129268484613122565b50600082815260018085016020526040808320548084528184206003808201805460ff19908116909155825487529386200180549093169093179091559182905254612973908590612fa5565b50612736565b505080546000908152600190910160205260409020600301805460ff19169055565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610cf1576129cc81613202565b6129d7836020613214565b6040516020016129e8929190613869565b60408051601f198184030181529082905262461bcd60e51b8252610cde916004016138ea565b600081815260018401602052604080822054848352912081905580612a3557828455612a81565b60008181526001808601602052604090912001548203612a6a5760008181526001808601602052604090912001839055612a81565b600081815260018501602052604090206002018390555b50505050565b8015610cf1576000818152600183016020526040902060020154612aac9083906126a1565b6000828152600180850160205260409091200154612acb9084906126a1565b612ad59190613685565b6000918252600183016020526040909120600681019190915554612a87565b60005b82548214801590612b1c5750600082815260018401602052604090206003015460ff16155b15612eee5760008281526001808501602052604080832054808452922001548303612d175760008181526001850160205260408082206002015480835291206003015490925060ff1615612bbf576000828152600180860160205260408083206003908101805460ff19908116909155858552919093209092018054909216179055612ba88482612fa5565b600081815260018501602052604090206002015491505b60008281526001808601602052604080832090910154825290206003015460ff16158015612c0a5750600082815260018501602052604080822060020154825290206003015460ff16155b15612c3757600082815260018581016020526040909120600301805460ff19169091179055915081612ee8565b600082815260018501602052604080822060020154825290206003015460ff16612cb4576000828152600180860160205260408083208083015484529083206003908101805460ff1990811690915593869052018054909216179055612c9d8483613122565b600081815260018501602052604090206002015491505b600081815260018501602052604080822060039081018054868552838520808401805460ff909316151560ff199384161790558254821690925560029091015484529190922090910180549091169055612d0e8482612fa5565b83549250612ee8565b6000818152600180860160205260408083209091015480835291206003015490925060ff1615612d96576000828152600180860160205260408083206003908101805460ff19908116909155858552919093209092018054909216179055612d7f8482613122565b600081815260018086016020526040909120015491505b600082815260018501602052604080822060020154825290206003015460ff16158015612de1575060008281526001808601602052604080832090910154825290206003015460ff16155b15612e0e57600082815260018581016020526040909120600301805460ff19169091179055915081612ee8565b60008281526001808601602052604080832090910154825290206003015460ff16612e8d57600082815260018086016020526040808320600281015484529083206003908101805460ff1990811690915593869052018054909216179055612e768483612fa5565b600081815260018086016020526040909120015491505b60008181526001808601602052604080832060039081018054878652838620808401805460ff909316151560ff19938416179055825482169092559301548452922090910180549091169055612ee38482613122565b835492505b50612af7565b506000908152600190910160205260409020600301805460ff19169055565b600081612f1c5750600061083f565b82548203612f2c5750600161083f565b600082815260018401602052604090205415612f4a5750600161083f565b50600092915050565b60015460ff1661190c5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610cde565b600081815260018084016020526040808320600281018054915482865292852090930154938590529183905590918015612fed57600081815260018601602052604090208490555b600083815260018601602052604090208290558161300d57828555613059565b600082815260018087016020526040909120015484036130425760008281526001808701602052604090912001839055613059565b600082815260018601602052604090206002018390555b6000838152600180870160205260408083209091018690558582529020838155600201546130889086906126a1565b60008581526001808801602052604090912001546130a79087906126a1565b6130b19190613685565b60008581526001870160205260408082206006019290925584815220600201546130dc9086906126a1565b60008481526001808801602052604090912001546130fb9087906126a1565b6131059190613685565b600093845260019095016020525050604090206006019190915550565b6000818152600180840160205260408083209182018054925483855291842060020154938590528390559091801561316857600081815260018601602052604090208490555b6000838152600186016020526040902082905581613188578285556131d4565b600082815260018601602052604090206002015484036131bd57600082815260018601602052604090206002018390556131d4565b600082815260018087016020526040909120018390555b60008381526001860160205260408082206002908101879055868352912084815501546130889086906126a1565b606061083f6001600160a01b03831660145b6060600061322383600261366e565b61322e906002613685565b67ffffffffffffffff81111561324657613246613715565b6040519080825280601f01601f191660200182016040528015613270576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106132a7576132a76136ff565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106132f2576132f26136ff565b60200101906001600160f81b031916908160001a905350600061331684600261366e565b613321906001613685565b90505b60018111156133a6577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613362576133626136ff565b1a60f81b828281518110613378576133786136ff565b60200101906001600160f81b031916908160001a90535060049490941c9361339f8161391d565b9050613324565b508315611e225760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610cde565b50805460008255906000526020600020908101906120fa91905b80821115613423576000815560010161340f565b5090565b60006020828403121561343957600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611e2257600080fd5b80356001600160a01b038116811461260157600080fd5b803560ff8116811461260157600080fd5b80151581146120fa57600080fd5b803561260181613491565b60008060008060008060c087890312156134c357600080fd5b6134cc87613469565b9550602087013594506134e160408801613480565b93506134ef60608801613480565b92506080870135915060a087013561350681613491565b809150509295509295509295565b60006020828403121561352657600080fd5b813567ffffffffffffffff81168114611e2257600080fd5b60006020828403121561355057600080fd5b5035919050565b6000806040838503121561356a57600080fd5b8235915061357a60208401613469565b90509250929050565b6000806040838503121561359657600080fd5b8235915061357a60208401613480565b600080602083850312156135b957600080fd5b823567ffffffffffffffff808211156135d157600080fd5b818501915085601f8301126135e557600080fd5b8135818111156135f457600080fd5b86602060c08302850101111561360957600080fd5b60209290920196919550909350505050565b60006020828403121561362d57600080fd5b611e2282613469565b6000806040838503121561364957600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761083f5761083f613658565b8082018082111561083f5761083f613658565b6000602082840312156136aa57600080fd5b5051919050565b60ff828116828216039081111561083f5761083f613658565b6000826136e757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561083f5761083f613658565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060c0828403121561373d57600080fd5b60405160c0810181811067ffffffffffffffff8211171561376e57634e487b7160e01b600052604160045260246000fd5b6040528235815261378160208401613469565b602082015261379260408401613480565b60408201526137a360608401613480565b60608201526137b46080840161349f565b608082015260a083013560a08201528091505092915050565b6000600182016137df576137df613658565b5060010190565b6000602082840312156137f857600080fd5b8151611e2281613491565b67ffffffffffffffff81811683821602808216919082811461382757613827613658565b505092915050565b634e487b7160e01b600052603160045260246000fd5b60005b83811015613860578181015183820152602001613848565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516138a1816017850160208801613845565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516138de816028840160208801613845565b01602801949350505050565b6020815260008251806020840152613909816040850160208701613845565b601f01601f19169190910160400192915050565b60008161392c5761392c613658565b50600019019056fea2646970667358221220b8e989571a98a41404ede9329461cf1ff50f79df9ca172c5ded6755573d871c364736f6c63430008130033000000000000000000000000dbf3ea6f5bee45c02255b2c26a16f300502f68da0000000000000000000000000000000000000000000000000000000000000010
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102f45760003560e01c806381e508b911610191578063b998902f116100e3578063dd483cfb11610097578063ea612e1f11610071578063ea612e1f14610780578063f7b188a514610789578063f90ce5ba1461079157600080fd5b8063dd483cfb14610716578063df67438514610736578063e63ab1e91461075957600080fd5b8063d547741f116100c8578063d547741f146106c6578063d71ba7c4146106d9578063d968f44b146106ec57600080fd5b8063b998902f14610604578063c81e25ab1461062b57600080fd5b806391b7f5ed11610145578063a6471a1d1161011f578063a6471a1d146105b6578063a81064ee146105dd578063b67644b9146105f157600080fd5b806391b7f5ed1461056457806391d1485414610577578063a217fddf146105ae57600080fd5b80638a5e8e32116101765780638a5e8e321461054b5780638b82547f14610554578063906978421461055c57600080fd5b806381e508b91461051f5780638456cb591461054357600080fd5b8063420fc4db1161024a57806351b17cd0116101fe5780635c975abb116101d85780635c975abb146104f9578063628de87714610504578063711bfa2b1461051757600080fd5b806351b17cd0146104cb57806351cff8d9146104d35780635239af71146104e657600080fd5b806347aab79b1161022f57806347aab79b1461049c5780634ba2363a146104af5780634bb13e34146104b857600080fd5b8063420fc4db1461045a57806344beae8e1461047257600080fd5b80632182ddb1116102ac5780632f2ff15d116102865780632f2ff15d146103f857806332ac57dd1461040b57806336568abe1461044757600080fd5b80632182ddb11461037e578063248a9ca3146103bf57806324b570a9146103f057600080fd5b80631889b99b116102dd5780631889b99b1461034e57806318c8572f146103565780631a37b4851461036b57600080fd5b806301ffc9a7146102f9578063053f14da14610321575b600080fd5b61030c610307366004613427565b6107ac565b60405190151581526020015b60405180910390f35b6009546103359067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610318565b61030c610845565b6103696103643660046134aa565b610857565b005b610369610379366004613514565b610af1565b6103a761038c36600461353e565b6000908152600260205260409020546001600160a01b031690565b6040516001600160a01b039091168152602001610318565b6103e26103cd36600461353e565b60009081526020819052604090206001015490565b604051908152602001610318565b6103e2610b87565b610369610406366004613557565b610c3a565b61043561041936600461353e565b600090815260026020526040902054600160a81b900460ff1690565b60405160ff9091168152602001610318565b610369610455366004613557565b610c64565b6001546103a79061010090046001600160a01b031681565b61043561048036600461353e565b600090815260026020526040902054600160a01b900460ff1690565b6103696104aa366004613583565b610cf5565b6103e260075481565b6103696104c63660046135a6565b610fa8565b6103e2611131565b6103696104e136600461361b565b611189565b6103e26104f43660046134aa565b611306565b60015460ff1661030c565b61036961051236600461353e565b611664565b61030c611882565b6103e261052d36600461353e565b6000908152600260208190526040909120015490565b6103696118ab565b6103e260065481565b6103e261190e565b6103e2611964565b61036961057236600461353e565b61199c565b61030c610585366004613557565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6103e2600081565b6103e27f3e35b14a9f4fef84b59f9bdcd3044fc28783144b7e42bfb2cd075e6a02cb082881565b60015461043590600160a81b900460ff1681565b6103696105ff366004613636565b611aab565b6103e27f1337d7d57528a8879766fdf2d0456253114c66c4fc263c97168bfdb007c64c6681565b61068661063936600461353e565b60026020819052600091825260409091208054600182015491909201546001600160a01b0383169260ff600160a01b8204811693600160a81b8304821693600160b01b9093049091169186565b604080516001600160a01b0397909716875260ff9586166020880152939094169285019290925215156060840152608083015260a082015260c001610318565b6103696106d4366004613557565b611d3f565b6103e26106e736600461353e565b611d64565b61030c6106fa36600461353e565b600090815260026020526040902054600160b01b900460ff1690565b6009546103359068010000000000000000900467ffffffffffffffff1681565b6103e261074436600461353e565b60009081526002602052604090206001015490565b6103e27f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6103e260085481565b610369611e29565b60095461033590600160801b900467ffffffffffffffff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061083f57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006108516003611e8a565b15919050565b61085f611e9a565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff166108ae57604051635844c9e760e11b815260040160405180910390fd5b6001600160a01b0386166108d55760405163d92e233d60e01b815260040160405180910390fd5b60ff831615806108eb57508360ff168360ff1610155b1561090957604051630a0b2c3560e41b815260040160405180910390fd5b6000828152600260205260409020546001600160a01b03161561093f576040516311ab459f60e21b815260040160405180910390fd5b6000610951600160ff87161b8761366e565b905060008661095e611131565b6109689190613685565b90508060000361098b5760405163334ab3f560e11b815260040160405180910390fd5b610996600019611664565b8560ff166001901b600660008282546109af9190613685565b90915550506040805160c0810182526001600160a01b03808b16825260ff808a1660208085019182528a831685870190815289151560608701908152608087018981524360a0890190815260008e815260029586905299909920975188549551935192511515600160b01b0260ff60b01b19938816600160a81b029390931661ffff60a81b1994909716600160a01b0274ffffffffffffffffffffffffffffffffffffffffff19909616971696909617939093171692909217178355905160018301559151910155610a8360038583611eed565b60408051838152602081018390526001600160a01b038a168183015260ff88811660608301528716608082015284151560a0820152905185917f9b088e2c89b322a3c1d81515e1c88db3d386d022926f0e2d0b9b5813b7413d58919081900360c00190a25050505050505050565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16610b4057604051635844c9e760e11b815260040160405180910390fd5b6009805467ffffffffffffffff90921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055565b6000610b94600019611664565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f9190613698565b90508060075410610c305780610c34565b6007545b91505090565b600082815260208190526040902060010154610c55816120f0565b610c5f83836120fd565b505050565b6001600160a01b0381163314610ce75760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b610cf1828261219b565b5050565b610cfd611e9a565b600082815260026020818152604092839020835160c08101855281546001600160a01b03811680835260ff600160a01b8304811695840195909552600160a81b8204851696830196909652600160b01b900490921615156060830152600181015460808301529091015460a0820152903314610da5576040517fb72bcb2f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460ff808416600160a81b90920416108015610dcc57508160ff16816020015160ff16105b610e02576040517fd5fd03fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e0a611131565b816080015111610e2d576040516368aebbc560e01b815260040160405180910390fd5b6000816020015183610e3f91906136b1565b90506000600160ff83161b610e5386611d64565b610e5d91906136ca565b9050610e67611964565b811015610e8757604051631e9acf1760e31b815260040160405180910390fd5b610e92600019611664565b826020015160ff166001901b8460ff166001901b610eb091906136ec565b60066000828254610ec19190613685565b90915550506080830151610ed990600390879061221a565b600085815260026020819052604090912080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b60ff8816021781554391015580610f28611131565b610f329190613685565b6080840181815260008781526002602052604090206001019190915551610f5d906003908790611eed565b60808301516040805160ff87168152602081019290925286917faf27998ec15e9d3809edad41aec1b5551d8412e71bd07c91611a0237ead1dc8e910160405180910390a25050505050565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16610ff757604051635844c9e760e11b815260040160405180910390fd5b60005b81811015610c5f576000838383818110611016576110166136ff565b905060c0020180360381019061102c919061372b565b602081015160a082015160408084015160608501518551608087015193517f18c8572f0000000000000000000000000000000000000000000000000000000081526001600160a01b039096166004870152602486019490945260ff91821660448601521660648401526084830191909152151560a482015290915030906318c8572f9060c401600060405180830381600087803b1580156110cc57600080fd5b505af19250505080156110dd575060015b61111e5780516040805184815260208101929092527f7ded044f9ef68a0ffb6bdb48c80387f300787e7492659224ad140db77893950d910160405180910390a15b5080611129816137cd565b915050610ffa565b600954600090819061115490600160801b900467ffffffffffffffff16436136ec565b60095490915060009061117290839067ffffffffffffffff1661366e565b9050806005546111829190613685565b9250505090565b7f3e35b14a9f4fef84b59f9bdcd3044fc28783144b7e42bfb2cd075e6a02cb082860009081526020818152604080832033845290915290205460ff166111fb576040517f24876df800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611205610b87565b6001546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152602482018490529293506101009091049091169063a9059cbb906044016020604051808303816000875af115801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e91906137e6565b6112bb576040516312171d8360e31b815260040160405180910390fd5b604080516001600160a01b0384168152602081018390527ff5d8f9b1e7af440e1e7915f4693ccc004d1461a7dafd17ea7347d03decf298e1910160405180910390a150506000600755565b6000611310611e9a565b6001600160a01b0387166113375760405163d92e233d60e01b815260040160405180910390fd5b60ff84161580611356575060015460ff600160a81b9091048116908516105b8061136757508460ff168460ff1610155b1561138557604051630a0b2c3560e41b815260040160405180910390fd5b6040805133602082015290810184905260009060600160408051601f198184030181529181528151602092830120600081815260029093529120549091506001600160a01b0316156113ea576040516311ab459f60e21b815260040160405180910390fd5b6113f2611964565b87101561141257604051631e9acf1760e31b815260040160405180910390fd5b6000611424600160ff89161b8961366e565b6001546040516323b872dd60e01b81523360048201523060248201526044810183905291925061010090046001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611481573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a591906137e6565b6114c2576040516312171d8360e31b815260040160405180910390fd5b6000886114cd611131565b6114d79190613685565b9050806000036114fa5760405163334ab3f560e11b815260040160405180910390fd5b611505600019611664565b8760ff166001901b6006600082825461151e9190613685565b90915550506040805160c0810182526001600160a01b03808d16825260ff808c1660208085019182528c83168587019081528b151560608701908152608087018981524360a0890190815260008d815260029586905299909920975188549551935192511515600160b01b0260ff60b01b19938816600160a81b029390931661ffff60a81b1994909716600160a01b0274ffffffffffffffffffffffffffffffffffffffffff199096169716969096179390931716929092171783559051600183015591519101556115f260038483611eed565b60408051838152602081018390526001600160a01b038c168183015260ff8a811660608301528916608082015286151560a0820152905184917f9b088e2c89b322a3c1d81515e1c88db3d386d022926f0e2d0b9b5813b7413d58919081900360c00190a2509098975050505050505050565b60085460005b828110156118105761167a610845565b1561168f57611687611131565b600855611810565b600061169961190e565b905060006116a682611d64565b11156116bd576116b4611131565b60085550611810565b600081815260026020818152604092839020835160c08101855281546001600160a01b038116825260ff600160a01b82048116948301859052600160a81b8204811696830196909652600160b01b900490941615156060850152600180820154608086015292015460a084015260065491901b9081111561176a576040517f9b02220b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806006600082825461177c91906136ec565b909155505060808201516117919086906136ec565b61179b908261366e565b600760008282546117ac9190613685565b909155505060808201516117c490600390859061221a565b50506000908152600260208190526040822080547fffffffffffffffffff000000000000000000000000000000000000000000000016815560018082018490559101919091550161166a565b81600854101561184c576040517f530da97a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8160085461185a91906136ec565b600654611867919061366e565b600760008282546118789190613685565b9091555050505050565b600061188c610845565b156118975750600090565b60006118a46106e761190e565b1115905090565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60009081526020818152604080832033845290915290205460ff1661190457604051631d77d47760e21b815260040160405180910390fd5b61190c61256b565b565b60008061191b60036125bf565b905080600003611957576040517f46c83ec800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c346003826000612606565b60095460009061198d9067ffffffffffffffff8082169168010000000000000000900416613803565b67ffffffffffffffff16905090565b7f1337d7d57528a8879766fdf2d0456253114c66c4fc263c97168bfdb007c64c6660009081526020818152604080832033845290915290205460ff16611a0e576040517fea0f601b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60095467ffffffffffffffff1615611a2c57611a28611131565b6005555b600980544367ffffffffffffffff908116600160801b027fffffffffffffffff0000000000000000ffffffffffffffff0000000000000000909216908416171790556040517fae46785019700e30375a5d7b4f91e32f8060ef085111f896ebf889450aa2ab5a90611aa09083815260200190565b60405180910390a150565b611ab3611e9a565b600082815260026020818152604092839020835160c08101855281546001600160a01b03811680835260ff600160a01b8304811695840195909552600160a81b8204851696830196909652600160b01b900490921615156060830152600181015460808301529091015460a082015290611b4057604051634ee9bc0f60e01b815260040160405180910390fd5b611b48611131565b816080015111611b6b576040516368aebbc560e01b815260040160405180910390fd5b600154602082015160ff600160a81b9092048216911611611bb8576040517f7103b80500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611bc0611964565b82611bca85611d64565b611bd49190613685565b1015611bf357604051631e9acf1760e31b815260040160405180910390fd5b6000816020015160ff166001901b83611c0c919061366e565b6001546040516323b872dd60e01b81523360048201523060248201526044810183905291925061010090046001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8d91906137e6565b611caa576040516312171d8360e31b815260040160405180910390fd5b6080820151611cbd90600390869061221a565b828260800151611ccd9190613685565b60808301819052611ce2906003908690611eed565b60808201805160008681526002602090815260409182902060010192909255915182518481529182015285917faf5756c62d6c0722ef9be1f82bef97ab06ea5aea7f3eb8ad348422079f01d88d910160405180910390a250505050565b600082815260208190526040902060010154611d5a816120f0565b610c5f838361219b565b6000818152600260208181526040808420815160c08101835281546001600160a01b03811680835260ff600160a01b8304811696840196909652600160a81b8204861694830194909452600160b01b900490931615156060840152600181015460808401529092015460a082015290611df057604051634ee9bc0f60e01b815260040160405180910390fd5b611df8611131565b816080015111611e0b5750600092915050565b611e13611131565b8160800151611e2291906136ec565b9392505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60009081526020818152604080832033845290915290205460ff16611e8257604051631d77d47760e21b815260040160405180910390fd5b61190c612668565b600061083f8283600001546126a1565b60015460ff161561190c5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610cde565b80611f0b576040516363868c5560e11b815260040160405180910390fd5b611f168383836126cd565b15611f4d576040517f6082d5c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82546000905b80156120315780915080831015611f7d576000908152600180860160205260409091200154612008565b80831115611f9e576000908152600185016020526040902060020154612008565b808303612008576000818152600180870160209081526040832060040180548084018255818552918420909101879055918390529054611fde91906136ec565b60009182526001909501602090815260408083209583526005909501905292909220929092555050565b60008281526001860160205260408120600601805491612027836137cd565b9190505550611f53565b600083815260018087016020908152604083208581558083018490556002810184905560038101805460ff191684179055600481018054808501825581865292909420909101879055915461208691906136ec565b6000868152600583016020526040902055826120a4578386556120de565b828410156120c757600083815260018088016020526040909120018490556120de565b600083815260018701602052604090206002018490555b6120e88685612733565b505050505050565b6120fa813361299b565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610cf1576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556121573390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610cf1576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80612238576040516363868c5560e11b815260040160405180910390fd5b6122438383836126cd565b61226057604051635889b1c560e11b815260040160405180910390fd5b6000818152600180850160209081526040808420868552600581019092528320546004820180549294919391929091612298916136ec565b815481106122a8576122a86136ff565b90600052602060002001549050808360040183815481106122cb576122cb6136ff565b60009182526020808320909101929092558281526005850190915260409020829055600483018054806123005761230061382f565b6001900381819060005260206000200160009055905560008084600401805490506000036125615760008681526001808a0160205260409091200154158061235957506000868152600189016020526040902060020154155b156123655750846123ad565b5060008581526001880160205260409020600201545b60008181526001808a0160205260409091200154156123ad57600090815260018089016020526040909120015461237b565b60008181526001808a0160205260409091200154156123e15760008181526001808a016020526040909120015491506123f8565b600081815260018901602052604090206002015491505b600081815260018901602052604080822054848352912081905580156124685760008181526001808b0160205260409091200154820361244d5760008181526001808b0160205260409091200183905561246c565b600081815260018a016020526040902060020183905561246c565b8289555b600082815260018a01602052604090206003015460ff16158783146124ff576124968a848a612a0e565b600088815260018b8101602052604080832080830154878552828520938401819055845281842087905560028082015490840181905584529083208690556003908101549286905201805460ff191660ff90921615159190911790559196916124ff8a89612a87565b801561250f5761250f8a85612af4565b6125198a83612a87565b60008381526001808c01602052604082208281559081018290556002810182905560038101805460ff191690559061255460048301826133f5565b6006820160009055505050505b5050505050505050565b612573611e9a565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b8054806125ce57506000919050565b5b6000818152600180840160205260409091200154156126015760009081526001808301602052604090912001546125cf565b919050565b60006126128484612f0d565b61262f57604051635889b1c560e11b815260040160405180910390fd5b60008381526001850160205260409020600401805483908110612654576126546136ff565b906000526020600020015490509392505050565b612670612f53565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336125a2565b60008181526001830160205260408120600681015460048201546126c59190613685565b949350505050565b60006126d98483612f0d565b6126e557506000611e22565b60008281526001850160209081526040808320868452600581019092529091205460049091018054859290811061271e5761271e6136ff565b90600052602060002001541490509392505050565b60005b825482148015906127605750600082815260018401602052604080822054825290206003015460ff165b1561297957600082815260018085016020526040808320548084528184205484529220015481036128815760008181526001850160205260408082205482528082206002015480835291206003015490925060ff1615612808576000818152600180860160205260408083206003808201805460ff19908116909155878652838620820180548216905582548652928520018054909216909217905590829052549250612973565b6000818152600185016020526040902060020154830361282f5780925061282f8484612fa5565b50600082815260018085016020526040808320548084528184206003808201805460ff1990811690915582548752938620018054909316909317909155918290525461287c908590613122565b612973565b6000818152600180860160205260408083205483528083209091015480835291206003015490925060ff16156128ff576000818152600180860160205260408083206003808201805460ff19908116909155878652838620820180548216905582548652928520018054909216909217905590829052549250612973565b60008181526001808601602052604090912001548303612926578092506129268484613122565b50600082815260018085016020526040808320548084528184206003808201805460ff19908116909155825487529386200180549093169093179091559182905254612973908590612fa5565b50612736565b505080546000908152600190910160205260409020600301805460ff19169055565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610cf1576129cc81613202565b6129d7836020613214565b6040516020016129e8929190613869565b60408051601f198184030181529082905262461bcd60e51b8252610cde916004016138ea565b600081815260018401602052604080822054848352912081905580612a3557828455612a81565b60008181526001808601602052604090912001548203612a6a5760008181526001808601602052604090912001839055612a81565b600081815260018501602052604090206002018390555b50505050565b8015610cf1576000818152600183016020526040902060020154612aac9083906126a1565b6000828152600180850160205260409091200154612acb9084906126a1565b612ad59190613685565b6000918252600183016020526040909120600681019190915554612a87565b60005b82548214801590612b1c5750600082815260018401602052604090206003015460ff16155b15612eee5760008281526001808501602052604080832054808452922001548303612d175760008181526001850160205260408082206002015480835291206003015490925060ff1615612bbf576000828152600180860160205260408083206003908101805460ff19908116909155858552919093209092018054909216179055612ba88482612fa5565b600081815260018501602052604090206002015491505b60008281526001808601602052604080832090910154825290206003015460ff16158015612c0a5750600082815260018501602052604080822060020154825290206003015460ff16155b15612c3757600082815260018581016020526040909120600301805460ff19169091179055915081612ee8565b600082815260018501602052604080822060020154825290206003015460ff16612cb4576000828152600180860160205260408083208083015484529083206003908101805460ff1990811690915593869052018054909216179055612c9d8483613122565b600081815260018501602052604090206002015491505b600081815260018501602052604080822060039081018054868552838520808401805460ff909316151560ff199384161790558254821690925560029091015484529190922090910180549091169055612d0e8482612fa5565b83549250612ee8565b6000818152600180860160205260408083209091015480835291206003015490925060ff1615612d96576000828152600180860160205260408083206003908101805460ff19908116909155858552919093209092018054909216179055612d7f8482613122565b600081815260018086016020526040909120015491505b600082815260018501602052604080822060020154825290206003015460ff16158015612de1575060008281526001808601602052604080832090910154825290206003015460ff16155b15612e0e57600082815260018581016020526040909120600301805460ff19169091179055915081612ee8565b60008281526001808601602052604080832090910154825290206003015460ff16612e8d57600082815260018086016020526040808320600281015484529083206003908101805460ff1990811690915593869052018054909216179055612e768483612fa5565b600081815260018086016020526040909120015491505b60008181526001808601602052604080832060039081018054878652838620808401805460ff909316151560ff19938416179055825482169092559301548452922090910180549091169055612ee38482613122565b835492505b50612af7565b506000908152600190910160205260409020600301805460ff19169055565b600081612f1c5750600061083f565b82548203612f2c5750600161083f565b600082815260018401602052604090205415612f4a5750600161083f565b50600092915050565b60015460ff1661190c5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610cde565b600081815260018084016020526040808320600281018054915482865292852090930154938590529183905590918015612fed57600081815260018601602052604090208490555b600083815260018601602052604090208290558161300d57828555613059565b600082815260018087016020526040909120015484036130425760008281526001808701602052604090912001839055613059565b600082815260018601602052604090206002018390555b6000838152600180870160205260408083209091018690558582529020838155600201546130889086906126a1565b60008581526001808801602052604090912001546130a79087906126a1565b6130b19190613685565b60008581526001870160205260408082206006019290925584815220600201546130dc9086906126a1565b60008481526001808801602052604090912001546130fb9087906126a1565b6131059190613685565b600093845260019095016020525050604090206006019190915550565b6000818152600180840160205260408083209182018054925483855291842060020154938590528390559091801561316857600081815260018601602052604090208490555b6000838152600186016020526040902082905581613188578285556131d4565b600082815260018601602052604090206002015484036131bd57600082815260018601602052604090206002018390556131d4565b600082815260018087016020526040909120018390555b60008381526001860160205260408082206002908101879055868352912084815501546130889086906126a1565b606061083f6001600160a01b03831660145b6060600061322383600261366e565b61322e906002613685565b67ffffffffffffffff81111561324657613246613715565b6040519080825280601f01601f191660200182016040528015613270576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106132a7576132a76136ff565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106132f2576132f26136ff565b60200101906001600160f81b031916908160001a905350600061331684600261366e565b613321906001613685565b90505b60018111156133a6577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613362576133626136ff565b1a60f81b828281518110613378576133786136ff565b60200101906001600160f81b031916908160001a90535060049490941c9361339f8161391d565b9050613324565b508315611e225760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610cde565b50805460008255906000526020600020908101906120fa91905b80821115613423576000815560010161340f565b5090565b60006020828403121561343957600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611e2257600080fd5b80356001600160a01b038116811461260157600080fd5b803560ff8116811461260157600080fd5b80151581146120fa57600080fd5b803561260181613491565b60008060008060008060c087890312156134c357600080fd5b6134cc87613469565b9550602087013594506134e160408801613480565b93506134ef60608801613480565b92506080870135915060a087013561350681613491565b809150509295509295509295565b60006020828403121561352657600080fd5b813567ffffffffffffffff81168114611e2257600080fd5b60006020828403121561355057600080fd5b5035919050565b6000806040838503121561356a57600080fd5b8235915061357a60208401613469565b90509250929050565b6000806040838503121561359657600080fd5b8235915061357a60208401613480565b600080602083850312156135b957600080fd5b823567ffffffffffffffff808211156135d157600080fd5b818501915085601f8301126135e557600080fd5b8135818111156135f457600080fd5b86602060c08302850101111561360957600080fd5b60209290920196919550909350505050565b60006020828403121561362d57600080fd5b611e2282613469565b6000806040838503121561364957600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761083f5761083f613658565b8082018082111561083f5761083f613658565b6000602082840312156136aa57600080fd5b5051919050565b60ff828116828216039081111561083f5761083f613658565b6000826136e757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561083f5761083f613658565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060c0828403121561373d57600080fd5b60405160c0810181811067ffffffffffffffff8211171561376e57634e487b7160e01b600052604160045260246000fd5b6040528235815261378160208401613469565b602082015261379260408401613480565b60408201526137a360608401613480565b60608201526137b46080840161349f565b608082015260a083013560a08201528091505092915050565b6000600182016137df576137df613658565b5060010190565b6000602082840312156137f857600080fd5b8151611e2281613491565b67ffffffffffffffff81811683821602808216919082811461382757613827613658565b505092915050565b634e487b7160e01b600052603160045260246000fd5b60005b83811015613860578181015183820152602001613848565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516138a1816017850160208801613845565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516138de816028840160208801613845565b01602801949350505050565b6020815260008251806020840152613909816040850160208701613845565b601f01601f19169190910160400192915050565b60008161392c5761392c613658565b50600019019056fea2646970667358221220b8e989571a98a41404ede9329461cf1ff50f79df9ca172c5ded6755573d871c364736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000dbf3ea6f5bee45c02255b2c26a16f300502f68da0000000000000000000000000000000000000000000000000000000000000010
-----Decoded View---------------
Arg [0] : _bzzToken (address): 0xdBF3Ea6F5beE45c02255B2c26a16F300502F68da
Arg [1] : _minimumBucketDepth (uint8): 16
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000dbf3ea6f5bee45c02255b2c26a16f300502f68da
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000010
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
GNO | 100.00% | $0.265466 | 68,540.6681 | $18,195.22 |
[ 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.