Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- WithdrawalQueueERC721
- Optimization enabled
- true
- Compiler version
- v0.8.9+commit.e5eed63a
- Optimization runs
- 80
- EVM Version
- istanbul
- Verified at
- 2024-11-12T23:52:49.774293Z
Constructor Arguments
0x0000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d63000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b64000000000000000000000000000000000000000000000000000000000000001a4c69646f3a207374455448205769746864726177616c204e46540000000000000000000000000000000000000000000000000000000000000000000000000007756e737445544800000000000000000000000000000000000000000000000000
Arg [0] (address) : 0x5d7ee80d917e4592f9de217e2878d08132678d63
Arg [1] (string) : Lido: stETH Withdrawal NFT
Arg [2] (string) : unstETH
Arg [3] (address) : 0x30f2ea599708fe0725bb9a35a4294a3fb39a5b64
contracts/0.8.9/WithdrawalQueueERC721.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>, OpenZeppelin
// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import {IERC721} from "@openzeppelin/contracts-v4.4/token/ERC721/IERC721.sol";
import {IERC721Receiver} from "@openzeppelin/contracts-v4.4/token/ERC721/IERC721Receiver.sol";
import {IERC721Metadata} from "@openzeppelin/contracts-v4.4/token/ERC721/extensions/IERC721Metadata.sol";
import {IERC165} from "@openzeppelin/contracts-v4.4/utils/introspection/IERC165.sol";
import {IERC4906} from "./interfaces/IERC4906.sol";
import {EnumerableSet} from "@openzeppelin/contracts-v4.4/utils/structs/EnumerableSet.sol";
import {Address} from "@openzeppelin/contracts-v4.4/utils/Address.sol";
import {Strings} from "@openzeppelin/contracts-v4.4/utils/Strings.sol";
import {IWstETH, WithdrawalQueue} from "./WithdrawalQueue.sol";
import {AccessControlEnumerable} from "./utils/access/AccessControlEnumerable.sol";
import {UnstructuredRefStorage} from "./lib/UnstructuredRefStorage.sol";
import {UnstructuredStorage} from "./lib/UnstructuredStorage.sol";
/// @title Interface defining INFTDescriptor to generate ERC721 tokenURI
interface INFTDescriptor {
/// @notice Returns ERC721 tokenURI content
/// @param _requestId is an id for particular withdrawal request
function constructTokenURI(uint256 _requestId) external view returns (string memory);
}
/// @title NFT implementation on top of {WithdrawalQueue}
/// NFT is minted on every request and burned on claim
///
/// @author psirex, folkyatina
contract WithdrawalQueueERC721 is IERC721Metadata, IERC4906, WithdrawalQueue {
using Address for address;
using Strings for uint256;
using EnumerableSet for EnumerableSet.UintSet;
using UnstructuredRefStorage for bytes32;
using UnstructuredStorage for bytes32;
bytes32 internal constant TOKEN_APPROVALS_POSITION = keccak256("lido.WithdrawalQueueERC721.tokenApprovals");
bytes32 internal constant OPERATOR_APPROVALS_POSITION = keccak256("lido.WithdrawalQueueERC721.operatorApprovals");
bytes32 internal constant BASE_URI_POSITION = keccak256("lido.WithdrawalQueueERC721.baseUri");
bytes32 internal constant NFT_DESCRIPTOR_ADDRESS_POSITION =
keccak256("lido.WithdrawalQueueERC721.nftDescriptorAddress");
bytes32 public constant MANAGE_TOKEN_URI_ROLE = keccak256("MANAGE_TOKEN_URI_ROLE");
// @notion simple wrapper for base URI string
// Solidity does not allow to store string in UnstructuredStorage
struct BaseURI {
string value;
}
event BaseURISet(string baseURI);
event NftDescriptorAddressSet(address nftDescriptorAddress);
error ApprovalToOwner();
error ApproveToCaller();
error NotOwnerOrApprovedForAll(address sender);
error NotOwnerOrApproved(address sender);
error TransferFromIncorrectOwner(address from, address realOwner);
error TransferToZeroAddress();
error TransferFromZeroAddress();
error TransferToThemselves();
error TransferToNonIERC721Receiver(address);
error InvalidOwnerAddress(address);
error StringTooLong(string str);
error ZeroMetadata();
// short strings for ERC721 name and symbol
bytes32 private immutable NAME;
bytes32 private immutable SYMBOL;
/// @param _wstETH address of WstETH contract
/// @param _name IERC721Metadata name string. Should be shorter than 32 bytes
/// @param _symbol IERC721Metadata symbol string. Should be shorter than 32 bytes
constructor(address _wstETH, string memory _name, string memory _symbol, address _lidoAddress) WithdrawalQueue(IWstETH(_wstETH), _lidoAddress) {
if (bytes(_name).length == 0 || bytes(_symbol).length == 0) revert ZeroMetadata();
NAME = _toBytes32(_name);
SYMBOL = _toBytes32(_symbol);
}
receive() external payable {}
/// @dev See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(IERC165, AccessControlEnumerable)
returns (bool)
{
return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId
// 0x49064906 is magic number ERC4906 interfaceId as defined in the standard https://eips.ethereum.org/EIPS/eip-4906
|| interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
/// @dev See {IERC721Metadata-name}.
function name() external view override returns (string memory) {
return _toString(NAME);
}
/// @dev See {IERC721Metadata-symbol}.
function symbol() external view override returns (string memory) {
return _toString(SYMBOL);
}
/// @dev See {IERC721Metadata-tokenURI}.
/// @dev If NFTDescriptor address isn't set the `baseURI` would be used for generating erc721 tokenURI. In case
/// NFTDescriptor address is set it would be used as a first-priority method.
function tokenURI(uint256 _requestId) public view virtual override returns (string memory) {
if (!_existsAndNotClaimed(_requestId)) revert InvalidRequestId(_requestId);
address nftDescriptorAddress = NFT_DESCRIPTOR_ADDRESS_POSITION.getStorageAddress();
if (nftDescriptorAddress != address(0)) {
return INFTDescriptor(nftDescriptorAddress).constructTokenURI(_requestId);
} else {
return _constructTokenUri(_requestId);
}
}
/// @notice Base URI for computing {tokenURI}. If set, the resulting URI for each
/// token will be the concatenation of the `baseURI` and the `_requestId`.
function getBaseURI() external view returns (string memory) {
return _getBaseURI().value;
}
/// @notice Sets the Base URI for computing {tokenURI}. It does not expect the ending slash in provided string.
/// @dev If NFTDescriptor address isn't set the `baseURI` would be used for generating erc721 tokenURI. In case
/// NFTDescriptor address is set it would be used as a first-priority method.
function setBaseURI(string calldata _baseURI) external onlyRole(MANAGE_TOKEN_URI_ROLE) {
_getBaseURI().value = _baseURI;
emit BaseURISet(_baseURI);
}
/// @notice Address of NFTDescriptor contract that is responsible for tokenURI generation.
function getNFTDescriptorAddress() external view returns (address) {
return NFT_DESCRIPTOR_ADDRESS_POSITION.getStorageAddress();
}
/// @notice Sets the address of NFTDescriptor contract that is responsible for tokenURI generation.
/// @dev If NFTDescriptor address isn't set the `baseURI` would be used for generating erc721 tokenURI. In case
/// NFTDescriptor address is set it would be used as a first-priority method.
function setNFTDescriptorAddress(address _nftDescriptorAddress) external onlyRole(MANAGE_TOKEN_URI_ROLE) {
NFT_DESCRIPTOR_ADDRESS_POSITION.setStorageAddress(_nftDescriptorAddress);
emit NftDescriptorAddressSet(_nftDescriptorAddress);
}
/// @notice Finalize requests from last finalized one up to `_lastRequestIdToBeFinalized`
/// @dev ether to finalize all the requests should be calculated using `prefinalize()` and sent along
function finalize(uint256 _lastRequestIdToBeFinalized, uint256 _maxShareRate) external payable {
_checkResumed();
_checkRole(FINALIZE_ROLE, msg.sender);
uint256 firstFinalizedRequestId = getLastFinalizedRequestId() + 1;
_finalize(_lastRequestIdToBeFinalized, msg.value, _maxShareRate);
// ERC4906 metadata update event
// We are updating all unfinalized to make it look different as they move closer to finalization in the future
emit BatchMetadataUpdate(firstFinalizedRequestId, getLastRequestId());
}
/// @dev See {IERC721-balanceOf}.
function balanceOf(address _owner) external view override returns (uint256) {
if (_owner == address(0)) revert InvalidOwnerAddress(_owner);
return _getRequestsByOwner()[_owner].length();
}
/// @dev See {IERC721-ownerOf}.
function ownerOf(uint256 _requestId) public view override returns (address) {
if (_requestId == 0 || _requestId > getLastRequestId()) revert InvalidRequestId(_requestId);
WithdrawalRequest storage request = _getQueue()[_requestId];
if (request.claimed) revert RequestAlreadyClaimed(_requestId);
return request.owner;
}
/// @dev See {IERC721-approve}.
function approve(address _to, uint256 _requestId) external override {
address owner = ownerOf(_requestId);
if (_to == owner) revert ApprovalToOwner();
if (msg.sender != owner && !isApprovedForAll(owner, msg.sender)) revert NotOwnerOrApprovedForAll(msg.sender);
_approve(_to, _requestId);
}
/// @dev See {IERC721-getApproved}.
function getApproved(uint256 _requestId) external view override returns (address) {
if (!_existsAndNotClaimed(_requestId)) revert InvalidRequestId(_requestId);
return _getTokenApprovals()[_requestId];
}
/// @dev See {IERC721-setApprovalForAll}.
function setApprovalForAll(address _operator, bool _approved) external override {
_setApprovalForAll(msg.sender, _operator, _approved);
}
/// @dev See {IERC721-isApprovedForAll}.
function isApprovedForAll(address _owner, address _operator) public view override returns (bool) {
return _getOperatorApprovals()[_owner][_operator];
}
/// @dev See {IERC721-safeTransferFrom}.
function safeTransferFrom(address _from, address _to, uint256 _requestId) external override {
safeTransferFrom(_from, _to, _requestId, "");
}
/// @dev See {IERC721-safeTransferFrom}.
function safeTransferFrom(address _from, address _to, uint256 _requestId, bytes memory _data) public override {
_transfer(_from, _to, _requestId);
if (!_checkOnERC721Received(_from, _to, _requestId, _data)) {
revert TransferToNonIERC721Receiver(_to);
}
}
/// @dev See {IERC721-transferFrom}.
function transferFrom(address _from, address _to, uint256 _requestId) external override {
_transfer(_from, _to, _requestId);
}
/// @dev Transfers `_requestId` from `_from` to `_to`.
/// As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
///
/// Requirements:
///
/// - `_to` cannot be the zero address.
/// - `_requestId` request must not be claimed and be owned by `_from`.
/// - `msg.sender` should be approved, or approved for all, or owner
function _transfer(address _from, address _to, uint256 _requestId) internal {
if (_to == address(0)) revert TransferToZeroAddress();
if (_to == _from) revert TransferToThemselves();
if (_requestId == 0 || _requestId > getLastRequestId()) revert InvalidRequestId(_requestId);
WithdrawalRequest storage request = _getQueue()[_requestId];
if (request.claimed) revert RequestAlreadyClaimed(_requestId);
if (_from != request.owner) revert TransferFromIncorrectOwner(_from, request.owner);
// here and below we are sure that `_from` is the owner of the request
address msgSender = msg.sender;
if (
!(_from == msgSender || isApprovedForAll(_from, msgSender) || _getTokenApprovals()[_requestId] == msgSender)
) {
revert NotOwnerOrApproved(msgSender);
}
delete _getTokenApprovals()[_requestId];
request.owner = _to;
assert(_getRequestsByOwner()[_from].remove(_requestId));
assert(_getRequestsByOwner()[_to].add(_requestId));
_emitTransfer(_from, _to, _requestId);
}
/// @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
/// The call is not executed if the target address is not a contract.
///
/// @param _from address representing the previous owner of the given token ID
/// @param _to target address that will receive the tokens
/// @param _requestId uint256 ID of the token to be transferred
/// @param _data bytes optional data to send along with the call
/// @return bool whether the call correctly returned the expected magic value
function _checkOnERC721Received(address _from, address _to, uint256 _requestId, bytes memory _data)
private
returns (bool)
{
if (_to.isContract()) {
try IERC721Receiver(_to).onERC721Received(msg.sender, _from, _requestId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonIERC721Receiver(_to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
//
// Internal getters and setters
//
/// @dev a little crutch to emit { Transfer } on request and on claim like ERC721 states
function _emitTransfer(address _from, address _to, uint256 _requestId) internal override {
emit Transfer(_from, _to, _requestId);
}
/// @dev Returns whether `_requestId` exists and not claimed.
function _existsAndNotClaimed(uint256 _requestId) internal view returns (bool) {
return _requestId > 0 && _requestId <= getLastRequestId() && !_getQueue()[_requestId].claimed;
}
/// @dev Approve `_to` to operate on `_requestId`
/// Emits a { Approval } event.
function _approve(address _to, uint256 _requestId) internal {
_getTokenApprovals()[_requestId] = _to;
emit Approval(ownerOf(_requestId), _to, _requestId);
}
/// @dev Approve `operator` to operate on all of `owner` tokens
/// Emits a { ApprovalForAll } event.
function _setApprovalForAll(address _owner, address _operator, bool _approved) internal {
if (_owner == _operator) revert ApproveToCaller();
_getOperatorApprovals()[_owner][_operator] = _approved;
emit ApprovalForAll(_owner, _operator, _approved);
}
/// @dev Decode a `bytes32 to string
function _toString(bytes32 _sstr) internal pure returns (string memory) {
uint256 len = _length(_sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), _sstr)
}
return str;
}
/// @dev encodes string `_str` in bytes32. Reverts if the string length > 31
function _toBytes32(string memory _str) internal pure returns (bytes32) {
bytes memory bstr = bytes(_str);
if (bstr.length > 31) {
revert StringTooLong(_str);
}
return bytes32(uint256(bytes32(bstr)) | bstr.length);
}
/// @dev Return the length of a string encoded in bytes32
function _length(bytes32 _sstr) internal pure returns (uint256) {
return uint256(_sstr) & 0xFF;
}
function _getTokenApprovals() internal pure returns (mapping(uint256 => address) storage) {
return TOKEN_APPROVALS_POSITION.storageMapUint256Address();
}
function _getOperatorApprovals() internal pure returns (mapping(address => mapping(address => bool)) storage) {
return OPERATOR_APPROVALS_POSITION.storageMapAddressMapAddressBool();
}
function _getBaseURI() internal pure returns (BaseURI storage baseURI) {
bytes32 position = BASE_URI_POSITION;
assembly {
baseURI.slot := position
}
}
function _constructTokenUri(uint256 _requestId) internal view returns (string memory) {
string memory baseURI = _getBaseURI().value;
if (bytes(baseURI).length == 0) return "";
// ${baseUri}/${_requestId}?requested=${amount}&created_at=${timestamp}[&finalized=${claimableAmount}]
string memory uri = string(
// we have no string.concat in 0.8.9 yet, so we have to do it with bytes.concat
bytes.concat(
bytes(baseURI),
bytes("/"),
bytes(_requestId.toString()),
bytes("?requested="),
bytes(
uint256(_getQueue()[_requestId].cumulativeStETH - _getQueue()[_requestId - 1].cumulativeStETH)
.toString()
),
bytes("&created_at="),
bytes(uint256(_getQueue()[_requestId].timestamp).toString())
)
);
bool finalized = _requestId <= getLastFinalizedRequestId();
if (finalized) {
uri = string(
bytes.concat(
bytes(uri),
bytes("&finalized="),
bytes(
_getClaimableEther(_requestId, _findCheckpointHint(_requestId, 1, getLastCheckpointIndex()))
.toString()
)
)
);
}
return uri;
}
}
contracts/0.8.9/lib/UnstructuredRefStorage.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
library UnstructuredRefStorage {
function storageMapUint256Address(bytes32 _position) internal pure returns (
mapping(uint256 => address) storage result
) {
assembly { result.slot := _position }
}
function storageMapAddressMapAddressBool(bytes32 _position) internal pure returns (
mapping(address => mapping(address => bool)) storage result
) {
assembly { result.slot := _position }
}
}
@openzeppelin/contracts-v4.4/access/IAccessControl.sol
// 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;
}
@openzeppelin/contracts-v4.4/access/IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
@openzeppelin/contracts-v4.4/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}
@openzeppelin/contracts-v4.4/token/ERC20/extensions/draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
@openzeppelin/contracts-v4.4/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
@openzeppelin/contracts-v4.4/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
@openzeppelin/contracts-v4.4/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
@openzeppelin/contracts-v4.4/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
@openzeppelin/contracts-v4.4/utils/Context.sol
// 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;
}
}
@openzeppelin/contracts-v4.4/utils/Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
@openzeppelin/contracts-v4.4/utils/introspection/ERC165.sol
// 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;
}
}
@openzeppelin/contracts-v4.4/utils/introspection/IERC165.sol
// 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);
}
@openzeppelin/contracts-v4.4/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}
contracts/0.8.9/WithdrawalQueue.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>
// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import {WithdrawalQueueBase} from "./WithdrawalQueueBase.sol";
import {IERC20} from "@openzeppelin/contracts-v4.4/token/ERC20/IERC20.sol";
import {IERC20Permit} from "@openzeppelin/contracts-v4.4/token/ERC20/extensions/draft-IERC20Permit.sol";
import {EnumerableSet} from "@openzeppelin/contracts-v4.4/utils/structs/EnumerableSet.sol";
import {AccessControlEnumerable} from "./utils/access/AccessControlEnumerable.sol";
import {UnstructuredStorage} from "./lib/UnstructuredStorage.sol";
import {PausableUntil} from "./utils/PausableUntil.sol";
import {Versioned} from "./utils/Versioned.sol";
/// @notice Interface defining a Lido liquid staking pool
/// @dev see also [Lido liquid staking pool core contract](https://docs.lido.fi/contracts/lido)
interface IStETH is IERC20, IERC20Permit {
function getSharesByPooledEth(uint256 _pooledEthAmount) external view returns (uint256);
function balanceOf(address _account) external view returns (uint256);
}
/// @notice Interface defining a Lido liquid staking pool wrapper
/// @dev see WstETH.sol for full docs
interface IWstETH is IERC20, IERC20Permit {
function unwrap(uint256 _wstETHAmount) external returns (uint256);
function getStETHByWstETH(uint256 _wstETHAmount) external view returns (uint256);
function stETH() external view returns (IStETH);
function balanceOf(address _account) external view returns (uint256);
}
/// @title A contract for handling stETH withdrawal request queue within the Lido protocol
/// @author folkyatina
abstract contract WithdrawalQueue is AccessControlEnumerable, PausableUntil, WithdrawalQueueBase, Versioned {
using UnstructuredStorage for bytes32;
using EnumerableSet for EnumerableSet.UintSet;
/// Bunker mode activation timestamp
bytes32 internal constant BUNKER_MODE_SINCE_TIMESTAMP_POSITION =
keccak256("lido.WithdrawalQueue.bunkerModeSinceTimestamp");
/// Special value for timestamp when bunker mode is inactive (i.e., protocol in turbo mode)
uint256 public constant BUNKER_MODE_DISABLED_TIMESTAMP = type(uint256).max;
// ACL
bytes32 public constant PAUSE_ROLE = keccak256("PAUSE_ROLE");
bytes32 public constant RESUME_ROLE = keccak256("RESUME_ROLE");
bytes32 public constant FINALIZE_ROLE = keccak256("FINALIZE_ROLE");
bytes32 public constant ORACLE_ROLE = keccak256("ORACLE_ROLE");
/// @notice minimal amount of stETH that is possible to withdraw
uint256 public constant MIN_STETH_WITHDRAWAL_AMOUNT = 100;
/// @notice maximum amount of stETH that is possible to withdraw by a single request
/// Prevents accumulating too much funds per single request fulfillment in the future.
/// @dev To withdraw larger amounts, it's recommended to split it to several requests
uint256 public constant MAX_STETH_WITHDRAWAL_AMOUNT = 1000000000 * 1e18;
/// @notice Lido stETH token address
IStETH public immutable STETH;
/// @notice Lido wstETH token address
IWstETH public immutable WSTETH;
event InitializedV1(address _admin);
event BunkerModeEnabled(uint256 _sinceTimestamp);
event BunkerModeDisabled();
error AdminZeroAddress();
error RequestAmountTooSmall(uint256 _amountOfStETH);
error RequestAmountTooLarge(uint256 _amountOfStETH);
error InvalidReportTimestamp();
error RequestIdsNotSorted();
error ZeroRecipient();
error ArraysLengthMismatch(uint256 _firstArrayLength, uint256 _secondArrayLength);
/// @param _wstETH address of WstETH contract
constructor(IWstETH _wstETH, address _lidoAddress) WithdrawalQueueBase(_lidoAddress) {
// init immutables
WSTETH = _wstETH;
STETH = WSTETH.stETH();
}
/// @notice Initialize the contract storage explicitly.
/// @param _admin admin address that can change every role.
/// @dev Reverts if `_admin` equals to `address(0)`
/// @dev NB! It's initialized in paused state by default and should be resumed explicitly to start
/// @dev NB! Bunker mode is disabled by default
function initialize(address _admin) external {
if (_admin == address(0)) revert AdminZeroAddress();
_initialize(_admin);
}
/// @notice Resume withdrawal requests placement and finalization
/// Contract is deployed in paused state and should be resumed explicitly
function resume() external {
_checkRole(RESUME_ROLE, msg.sender);
_resume();
}
/// @notice Pause withdrawal requests placement and finalization. Claiming finalized requests will still be available
/// @param _duration pause duration in seconds (use `PAUSE_INFINITELY` for unlimited)
/// @dev Reverts if contract is already paused
/// @dev Reverts reason if sender has no `PAUSE_ROLE`
/// @dev Reverts if zero duration is passed
function pauseFor(uint256 _duration) external onlyRole(PAUSE_ROLE) {
_pauseFor(_duration);
}
/// @notice Pause withdrawal requests placement and finalization. Claiming finalized requests will still be available
/// @param _pauseUntilInclusive the last second to pause until inclusive
/// @dev Reverts if the timestamp is in the past
/// @dev Reverts if sender has no `PAUSE_ROLE`
/// @dev Reverts if contract is already paused
function pauseUntil(uint256 _pauseUntilInclusive) external onlyRole(PAUSE_ROLE) {
_pauseUntil(_pauseUntilInclusive);
}
/// @notice Request the batch of stETH for withdrawal. Approvals for the passed amounts should be done before.
/// @param _amounts an array of stETH amount values.
/// The standalone withdrawal request will be created for each item in the passed list.
/// @param _owner address that will be able to manage the created requests.
/// If `address(0)` is passed, `msg.sender` will be used as owner.
/// @return requestIds an array of the created withdrawal request ids
function requestWithdrawals(uint256[] calldata _amounts, address _owner)
public
returns (uint256[] memory requestIds)
{
_checkResumed();
if (_owner == address(0)) _owner = msg.sender;
requestIds = new uint256[](_amounts.length);
for (uint256 i = 0; i < _amounts.length; ++i) {
requestIds[i] = _requestWithdrawal(_amounts[i], _owner);
}
}
/// @notice Request the batch of wstETH for withdrawal. Approvals for the passed amounts should be done before.
/// @param _amounts an array of wstETH amount values.
/// The standalone withdrawal request will be created for each item in the passed list.
/// @param _owner address that will be able to manage the created requests.
/// If `address(0)` is passed, `msg.sender` will be used as an owner.
/// @return requestIds an array of the created withdrawal request ids
function requestWithdrawalsWstETH(uint256[] calldata _amounts, address _owner)
public
returns (uint256[] memory requestIds)
{
_checkResumed();
if (_owner == address(0)) _owner = msg.sender;
requestIds = new uint256[](_amounts.length);
for (uint256 i = 0; i < _amounts.length; ++i) {
requestIds[i] = _requestWithdrawalWstETH(_amounts[i], _owner);
}
}
struct PermitInput {
uint256 value;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}
/// @notice Request the batch of stETH for withdrawal using EIP-2612 Permit
/// @param _amounts an array of stETH amount values
/// The standalone withdrawal request will be created for each item in the passed list.
/// @param _owner address that will be able to manage the created requests.
/// If `address(0)` is passed, `msg.sender` will be used as an owner.
/// @param _permit data required for the stETH.permit() method to set the allowance
/// @return requestIds an array of the created withdrawal request ids
function requestWithdrawalsWithPermit(uint256[] calldata _amounts, address _owner, PermitInput calldata _permit)
external
returns (uint256[] memory requestIds)
{
require(STETH.balanceOf(_owner) >= _permit.value, "INVALID AMOUNT");
STETH.permit(msg.sender, address(this), _permit.value, _permit.deadline, _permit.v, _permit.r, _permit.s);
return requestWithdrawals(_amounts, _owner);
}
/// @notice Request the batch of wstETH for withdrawal using EIP-2612 Permit
/// @param _amounts an array of wstETH amount values
/// The standalone withdrawal request will be created for each item in the passed list.
/// @param _owner address that will be able to manage the created requests.
/// If `address(0)` is passed, `msg.sender` will be used as an owner.
/// @param _permit data required for the wtETH.permit() method to set the allowance
/// @return requestIds an array of the created withdrawal request ids
function requestWithdrawalsWstETHWithPermit(
uint256[] calldata _amounts,
address _owner,
PermitInput calldata _permit
) external returns (uint256[] memory requestIds) {
require(WSTETH.balanceOf(_owner) >= _permit.value, "INVALID AMOUNT");
WSTETH.permit(msg.sender, address(this), _permit.value, _permit.deadline, _permit.v, _permit.r, _permit.s);
return requestWithdrawalsWstETH(_amounts, _owner);
}
/// @notice Returns all withdrawal requests that belongs to the `_owner` address
///
/// WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
/// to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
/// this function has an unbounded cost, and using it as part of a state-changing function may render the function
/// uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
function getWithdrawalRequests(address _owner) external view returns (uint256[] memory requestsIds) {
return _getRequestsByOwner()[_owner].values();
}
/// @notice Returns status for requests with provided ids
/// @param _requestIds array of withdrawal request ids
function getWithdrawalStatus(uint256[] calldata _requestIds)
external
view
returns (WithdrawalRequestStatus[] memory statuses)
{
statuses = new WithdrawalRequestStatus[](_requestIds.length);
for (uint256 i = 0; i < _requestIds.length; ++i) {
statuses[i] = _getStatus(_requestIds[i]);
}
}
/// @notice Returns amount of ether available for claim for each provided request id
/// @param _requestIds array of request ids
/// @param _hints checkpoint hints. can be found with `findCheckpointHints(_requestIds, 1, getLastCheckpointIndex())`
/// @return claimableEthValues amount of claimable ether for each request, amount is equal to 0 if request
/// is not finalized or already claimed
function getClaimableEther(uint256[] calldata _requestIds, uint256[] calldata _hints)
external
view
returns (uint256[] memory claimableEthValues)
{
claimableEthValues = new uint256[](_requestIds.length);
for (uint256 i = 0; i < _requestIds.length; ++i) {
claimableEthValues[i] = _getClaimableEther(_requestIds[i], _hints[i]);
}
}
/// @notice Claim a batch of withdrawal requests if they are finalized sending ether to `_recipient`
/// @param _requestIds array of request ids to claim
/// @param _hints checkpoint hint for each id. Can be obtained with `findCheckpointHints()`
/// @param _recipient address where claimed ether will be sent to
/// @dev
/// Reverts if recipient is equal to zero
/// Reverts if requestIds and hints arrays length differs
/// Reverts if any requestId or hint in arguments are not valid
/// Reverts if any request is not finalized or already claimed
/// Reverts if msg sender is not an owner of the requests
function claimWithdrawalsTo(uint256[] calldata _requestIds, uint256[] calldata _hints, address _recipient)
external
{
if (_recipient == address(0)) revert ZeroRecipient();
if (_requestIds.length != _hints.length) {
revert ArraysLengthMismatch(_requestIds.length, _hints.length);
}
for (uint256 i = 0; i < _requestIds.length; ++i) {
_claim(_requestIds[i], _hints[i], _recipient);
_emitTransfer(msg.sender, address(0), _requestIds[i]);
}
}
/// @notice Claim a batch of withdrawal requests if they are finalized sending locked ether to the owner
/// @param _requestIds array of request ids to claim
/// @param _hints checkpoint hint for each id. Can be obtained with `findCheckpointHints()`
/// @dev
/// Reverts if requestIds and hints arrays length differs
/// Reverts if any requestId or hint in arguments are not valid
/// Reverts if any request is not finalized or already claimed
/// Reverts if msg sender is not an owner of the requests
function claimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external {
if (_requestIds.length != _hints.length) {
revert ArraysLengthMismatch(_requestIds.length, _hints.length);
}
for (uint256 i = 0; i < _requestIds.length; ++i) {
_claim(_requestIds[i], _hints[i], msg.sender);
_emitTransfer(msg.sender, address(0), _requestIds[i]);
}
}
/// @notice Claim one`_requestId` request once finalized sending locked ether to the owner
/// @param _requestId request id to claim
/// @dev use unbounded loop to find a hint, which can lead to OOG
/// @dev
/// Reverts if requestId or hint are not valid
/// Reverts if request is not finalized or already claimed
/// Reverts if msg sender is not an owner of request
function claimWithdrawal(uint256 _requestId) external {
_claim(_requestId, _findCheckpointHint(_requestId, 1, getLastCheckpointIndex()), msg.sender);
_emitTransfer(msg.sender, address(0), _requestId);
}
/// @notice Finds the list of hints for the given `_requestIds` searching among the checkpoints with indices
/// in the range `[_firstIndex, _lastIndex]`.
/// NB! Array of request ids should be sorted
/// NB! `_firstIndex` should be greater than 0, because checkpoint list is 1-based array
/// Usage: findCheckpointHints(_requestIds, 1, getLastCheckpointIndex())
/// @param _requestIds ids of the requests sorted in the ascending order to get hints for
/// @param _firstIndex left boundary of the search range. Should be greater than 0
/// @param _lastIndex right boundary of the search range. Should be less than or equal to getLastCheckpointIndex()
/// @return hintIds array of hints used to find required checkpoint for the request
function findCheckpointHints(uint256[] calldata _requestIds, uint256 _firstIndex, uint256 _lastIndex)
external
view
returns (uint256[] memory hintIds)
{
hintIds = new uint256[](_requestIds.length);
uint256 prevRequestId = 0;
for (uint256 i = 0; i < _requestIds.length; ++i) {
if (_requestIds[i] < prevRequestId) revert RequestIdsNotSorted();
hintIds[i] = _findCheckpointHint(_requestIds[i], _firstIndex, _lastIndex);
_firstIndex = hintIds[i];
prevRequestId = _requestIds[i];
}
}
/// @notice Update bunker mode state and last report timestamp on oracle report
/// @dev should be called by oracle
///
/// @param _isBunkerModeNow is bunker mode reported by oracle
/// @param _bunkerStartTimestamp timestamp of start of the bunker mode
/// @param _currentReportTimestamp timestamp of the current report ref slot
function onOracleReport(bool _isBunkerModeNow, uint256 _bunkerStartTimestamp, uint256 _currentReportTimestamp)
external
{
_checkRole(ORACLE_ROLE, msg.sender);
if (_bunkerStartTimestamp >= block.timestamp) revert InvalidReportTimestamp();
if (_currentReportTimestamp >= block.timestamp) revert InvalidReportTimestamp();
_setLastReportTimestamp(_currentReportTimestamp);
bool isBunkerModeWasSetBefore = isBunkerModeActive();
// on bunker mode state change
if (_isBunkerModeNow != isBunkerModeWasSetBefore) {
// write previous timestamp to enable bunker or max uint to disable
if (_isBunkerModeNow) {
BUNKER_MODE_SINCE_TIMESTAMP_POSITION.setStorageUint256(_bunkerStartTimestamp);
} else {
BUNKER_MODE_SINCE_TIMESTAMP_POSITION.setStorageUint256(BUNKER_MODE_DISABLED_TIMESTAMP);
}
}
}
/// @notice Check if bunker mode is active
function isBunkerModeActive() public view returns (bool) {
return bunkerModeSinceTimestamp() < BUNKER_MODE_DISABLED_TIMESTAMP;
}
/// @notice Get bunker mode activation timestamp
/// @dev returns `BUNKER_MODE_DISABLED_TIMESTAMP` if bunker mode is disable (i.e., protocol in turbo mode)
function bunkerModeSinceTimestamp() public view returns (uint256) {
return BUNKER_MODE_SINCE_TIMESTAMP_POSITION.getStorageUint256();
}
/// @notice Should emit ERC721 Transfer event in the inheriting contract
function _emitTransfer(address from, address to, uint256 _requestId) internal virtual;
/// @dev internal initialization helper. Doesn't check provided addresses intentionally
function _initialize(address _admin) internal {
_initializeQueue();
// _pauseFor(PAUSE_INFINITELY); // @todo: make sure if it right
_initializeContractVersionTo(1);
_grantRole(DEFAULT_ADMIN_ROLE, _admin);
BUNKER_MODE_SINCE_TIMESTAMP_POSITION.setStorageUint256(BUNKER_MODE_DISABLED_TIMESTAMP);
emit InitializedV1(_admin);
}
function _requestWithdrawal(uint256 _amountOfStETH, address _owner) internal returns (uint256 requestId) {
STETH.transferFrom(msg.sender, address(this), _amountOfStETH);
uint256 amountOfShares = STETH.getSharesByPooledEth(_amountOfStETH);
requestId = _enqueue(uint128(_amountOfStETH), uint128(amountOfShares), _owner);
_emitTransfer(address(0), _owner, requestId);
}
function _requestWithdrawalWstETH(uint256 _amountOfWstETH, address _owner) internal returns (uint256 requestId) {
WSTETH.transferFrom(msg.sender, address(this), _amountOfWstETH);
uint256 amountOfStETH = WSTETH.unwrap(_amountOfWstETH);
uint256 amountOfShares = STETH.getSharesByPooledEth(amountOfStETH);
requestId = _enqueue(uint128(amountOfStETH), uint128(amountOfShares), _owner);
_emitTransfer(address(0), _owner, requestId);
}
/// @notice returns claimable ether under the request. Returns 0 if request is not finalized or claimed
function _getClaimableEther(uint256 _requestId, uint256 _hint) internal view returns (uint256) {
if (_requestId == 0 || _requestId > getLastRequestId()) revert InvalidRequestId(_requestId);
if (_requestId > getLastFinalizedRequestId()) return 0;
WithdrawalRequest storage request = _getQueue()[_requestId];
if (request.claimed) return 0;
return _calculateClaimableEther(request, _requestId, _hint);
}
}
contracts/0.8.9/WithdrawalQueueBase.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>
// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import "@openzeppelin/contracts-v4.4/utils/structs/EnumerableSet.sol";
import {UnstructuredStorage} from "./lib/UnstructuredStorage.sol";
interface ILido {
function getWithdrawFee() external view returns (uint256);
function getTreasury() external view returns (address);
function getStakingTime(address) external view returns (uint256);
}
/// @title Queue to store and manage WithdrawalRequests.
/// @dev Use an optimizations to store max share rates for finalized requests heavily inspired
/// by Aragon MiniMe token https://github.com/aragon/aragon-minime/blob/master/contracts/MiniMeToken.sol
///
/// @author folkyatina
abstract contract WithdrawalQueueBase {
using EnumerableSet for EnumerableSet.UintSet;
using UnstructuredStorage for bytes32;
/// @dev maximal length of the batch array provided for prefinalization. See `prefinalize()`
uint256 public constant MAX_BATCHES_LENGTH = 36;
uint256 public rewardPercent = 9;
/// @notice precision base for share rate
uint256 internal constant E27_PRECISION_BASE = 1e27;
/// @dev return value for the `find...` methods in case of no result
uint256 internal constant NOT_FOUND = 0;
/// @dev queue for withdrawal requests, indexes (requestId) start from 1
bytes32 internal constant QUEUE_POSITION = keccak256("lido.WithdrawalQueue.queue");
/// @dev last index in request queue
bytes32 internal constant LAST_REQUEST_ID_POSITION = keccak256("lido.WithdrawalQueue.lastRequestId");
/// @dev last index of finalized request in the queue
bytes32 internal constant LAST_FINALIZED_REQUEST_ID_POSITION =
keccak256("lido.WithdrawalQueue.lastFinalizedRequestId");
/// @dev finalization rate history, indexes start from 1
bytes32 internal constant CHECKPOINTS_POSITION = keccak256("lido.WithdrawalQueue.checkpoints");
/// @dev last index in checkpoints array
bytes32 internal constant LAST_CHECKPOINT_INDEX_POSITION = keccak256("lido.WithdrawalQueue.lastCheckpointIndex");
/// @dev amount of eth locked on contract for further claiming
bytes32 internal constant LOCKED_ETHER_AMOUNT_POSITION = keccak256("lido.WithdrawalQueue.lockedEtherAmount");
/// @dev withdrawal requests mapped to the owners
bytes32 internal constant REQUEST_BY_OWNER_POSITION = keccak256("lido.WithdrawalQueue.requestsByOwner");
/// @dev timestamp of the last oracle report
bytes32 internal constant LAST_REPORT_TIMESTAMP_POSITION = keccak256("lido.WithdrawalQueue.lastReportTimestamp");
address private immutable _lido;
/// @notice structure representing a request for withdrawal
struct WithdrawalRequest {
/// @notice sum of the all stETH submitted for withdrawals including this request
uint128 cumulativeStETH;
/// @notice sum of the all shares locked for withdrawal including this request
uint128 cumulativeShares;
/// @notice address that can claim or transfer the request
address owner;
/// @notice block.timestamp when the request was created
uint40 timestamp;
/// @notice flag if the request was claimed
bool claimed;
/// @notice timestamp of last oracle report for this request
uint40 reportTimestamp;
}
/// @notice structure to store discounts for requests that are affected by negative rebase
struct Checkpoint {
uint256 fromRequestId;
uint256 maxShareRate;
}
/// @notice output format struct for `_getWithdrawalStatus()` method
struct WithdrawalRequestStatus {
/// @notice stETH token amount that was locked on withdrawal queue for this request
uint256 amountOfStETH;
/// @notice amount of stETH shares locked on withdrawal queue for this request
uint256 amountOfShares;
/// @notice address that can claim or transfer this request
address owner;
/// @notice timestamp of when the request was created, in seconds
uint256 timestamp;
/// @notice true, if request is finalized
bool isFinalized;
/// @notice true, if request is claimed. Request is claimable if (isFinalized && !isClaimed)
bool isClaimed;
}
/// @dev Contains both stETH token amount and its corresponding shares amount
event WithdrawalRequested(
uint256 indexed requestId,
address indexed requestor,
address indexed owner,
uint256 amountOfStETH,
uint256 amountOfShares
);
event WithdrawalsFinalized(
uint256 indexed from, uint256 indexed to, uint256 amountOfETHLocked, uint256 sharesToBurn, uint256 timestamp
);
event WithdrawalClaimed(
uint256 indexed requestId, address indexed owner, address indexed receiver, uint256 amountOfETH
);
error ZeroAddress(string field);
error ZeroAmountOfETH();
error ZeroShareRate();
error ZeroTimestamp();
error TooMuchEtherToFinalize(uint256 sent, uint256 maxExpected);
error NotOwner(address _sender, address _owner);
error InvalidRequestId(uint256 _requestId);
error InvalidRequestIdRange(uint256 startId, uint256 endId);
error InvalidState();
error BatchesAreNotSorted();
error EmptyBatches();
error RequestNotFoundOrNotFinalized(uint256 _requestId);
error NotEnoughEther();
error RequestAlreadyClaimed(uint256 _requestId);
error InvalidHint(uint256 _hint);
error CantSendValueRecipientMayHaveReverted();
constructor(address lidoAddress_){
if (lidoAddress_ == address(0)) revert ZeroAddress("_lido");
_lido = lidoAddress_;
}
/// @notice id of the last request
/// NB! requests are indexed from 1, so it returns 0 if there is no requests in the queue
function getLastRequestId() public view returns (uint256) {
return LAST_REQUEST_ID_POSITION.getStorageUint256();
}
/// @notice id of the last finalized request
/// NB! requests are indexed from 1, so it returns 0 if there is no finalized requests in the queue
function getLastFinalizedRequestId() public view returns (uint256) {
return LAST_FINALIZED_REQUEST_ID_POSITION.getStorageUint256();
}
/// @notice amount of ETH on this contract balance that is locked for withdrawal and available to claim
function getLockedEtherAmount() public view returns (uint256) {
return LOCKED_ETHER_AMOUNT_POSITION.getStorageUint256();
}
/// @notice length of the checkpoint array. Last possible value for the hint.
/// NB! checkpoints are indexed from 1, so it returns 0 if there is no checkpoints
function getLastCheckpointIndex() public view returns (uint256) {
return LAST_CHECKPOINT_INDEX_POSITION.getStorageUint256();
}
/// @notice return the number of unfinalized requests in the queue
function unfinalizedRequestNumber() external view returns (uint256) {
return getLastRequestId() - getLastFinalizedRequestId();
}
/// @notice Returns the amount of stETH in the queue yet to be finalized
function unfinalizedStETH() external view returns (uint256) {
return
_getQueue()[getLastRequestId()].cumulativeStETH - _getQueue()[getLastFinalizedRequestId()].cumulativeStETH;
}
//
// FINALIZATION FLOW
//
// Process when protocol is fixing the withdrawal request value and lock the required amount of ETH.
// The value of a request after finalization can be:
// - nominal (when the amount of eth locked for this request are equal to the request's stETH)
// - discounted (when the amount of eth will be lower, because the protocol share rate dropped
// before request is finalized, so it will be equal to `request's shares` * `protocol share rate`)
// The parameters that are required for finalization are:
// - current share rate of the protocol
// - id of the last request that can be finalized
// - the amount of eth that must be locked for these requests
// To calculate the eth amount we'll need to know which requests in the queue will be finalized as nominal
// and which as discounted and the exact value of the discount. It's impossible to calculate without the unbounded
// loop over the unfinalized part of the queue. So, we need to extract a part of the algorithm off-chain, bring the
// result with oracle report and check it later and check the result later.
// So, we came to this solution:
// Off-chain
// 1. Oracle iterates over the queue off-chain and calculate the id of the latest finalizable request
// in the queue. Then it splits all the requests that will be finalized into batches the way,
// that requests in a batch are all nominal or all discounted.
// And passes them in the report as the array of the ending ids of these batches. So it can be reconstructed like
// `[lastFinalizedRequestId+1, batches[0]], [batches[0]+1, batches[1]] ... [batches[n-2], batches[n-1]]`
// 2. Contract checks the validity of the batches on-chain and calculate the amount of eth required to
// finalize them. It can be done without unbounded loop using partial sums that are calculated on request enqueueing.
// 3. Contract marks the request's as finalized and locks the eth for claiming. It also,
// set's the discount checkpoint for these request's if required that will be applied on claim for each request's
// individually depending on request's share rate.
/// @notice transient state that is used to pass intermediate results between several `calculateFinalizationBatches`
// invocations
struct BatchesCalculationState {
/// @notice amount of ether available in the protocol that can be used to finalize withdrawal requests
/// Will decrease on each call and will be equal to the remainder when calculation is finished
/// Should be set before the first call
uint256 remainingEthBudget;
/// @notice flag that is set to `true` if returned state is final and `false` if more calls are required
bool finished;
/// @notice static array to store last request id in each batch
uint256[MAX_BATCHES_LENGTH] batches;
/// @notice length of the filled part of `batches` array
uint256 batchesLength;
}
/// @notice Offchain view for the oracle daemon that calculates how many requests can be finalized within
/// the given budget, time period and share rate limits. Returned requests are split into batches.
/// Each batch consist of the requests that all have the share rate below the `_maxShareRate` or above it.
/// Below you can see an example how 14 requests with different share rates will be split into 5 batches by
/// this method
///
/// ^ share rate
/// |
/// | • •
/// | • • • • •
/// |----------------------•------ _maxShareRate
/// | • • • • •
/// | •
/// +-------------------------------> requestId
/// | 1st| 2nd |3| 4th | 5th |
///
/// @param _maxShareRate current share rate of the protocol (1e27 precision)
/// @param _maxTimestamp max timestamp of the request that can be finalized
/// @param _maxRequestsPerCall max request number that can be processed per call.
/// @param _state structure that accumulates the state across multiple invocations to overcome gas limits.
/// To start calculation you should pass `state.remainingEthBudget` and `state.finished == false` and then invoke
/// the function with returned `state` until it returns a state with `finished` flag set
/// @return state that is changing on each call and should be passed to the next call until `state.finished` is true
function calculateFinalizationBatches(
uint256 _maxShareRate,
uint256 _maxTimestamp,
uint256 _maxRequestsPerCall,
BatchesCalculationState memory _state
) external view returns (BatchesCalculationState memory) {
if (_state.finished || _state.remainingEthBudget == 0) revert InvalidState();
uint256 currentId;
WithdrawalRequest memory prevRequest;
uint256 prevRequestShareRate;
if (_state.batchesLength == 0) {
currentId = getLastFinalizedRequestId() + 1;
prevRequest = _getQueue()[currentId - 1];
} else {
uint256 lastHandledRequestId = _state.batches[_state.batchesLength - 1];
currentId = lastHandledRequestId + 1;
prevRequest = _getQueue()[lastHandledRequestId];
(prevRequestShareRate,,) = _calcBatch(_getQueue()[lastHandledRequestId - 1], prevRequest);
}
uint256 nextCallRequestId = currentId + _maxRequestsPerCall;
uint256 queueLength = getLastRequestId() + 1;
while (currentId < queueLength && currentId < nextCallRequestId) {
WithdrawalRequest memory request = _getQueue()[currentId];
if (request.timestamp > _maxTimestamp) break; // max timestamp break
(uint256 requestShareRate, uint256 ethToFinalize, uint256 shares) = _calcBatch(prevRequest, request);
if (requestShareRate > _maxShareRate) {
// discounted
ethToFinalize = (shares * _maxShareRate) / E27_PRECISION_BASE;
}
if (ethToFinalize > _state.remainingEthBudget) break; // budget break
_state.remainingEthBudget -= ethToFinalize;
if (_state.batchesLength != 0 && (
// share rate of requests in the same batch can differ by 1-2 wei because of the rounding error
// (issue: https://github.com/lidofinance/lido-dao/issues/442 )
// so we're taking requests that are placed during the same report
// as equal even if their actual share rate are different
prevRequest.reportTimestamp == request.reportTimestamp ||
// both requests are below the line
prevRequestShareRate <= _maxShareRate && requestShareRate <= _maxShareRate ||
// both requests are above the line
prevRequestShareRate > _maxShareRate && requestShareRate > _maxShareRate
)) {
_state.batches[_state.batchesLength - 1] = currentId; // extend the last batch
} else {
// to be able to check batches on-chain we need array to have limited length
if (_state.batchesLength == MAX_BATCHES_LENGTH) break;
// create a new batch
_state.batches[_state.batchesLength] = currentId;
++_state.batchesLength;
}
prevRequestShareRate = requestShareRate;
prevRequest = request;
unchecked{ ++currentId; }
}
_state.finished = currentId == queueLength || currentId < nextCallRequestId;
return _state;
}
/// @notice Checks finalization batches, calculates required ether and the amount of shares to burn
/// @param _batches finalization batches calculated offchain using `calculateFinalizationBatches()`
/// @param _maxShareRate max share rate that will be used for request finalization (1e27 precision)
/// @return ethToLock amount of ether that should be sent with `finalize()` method
/// @return sharesToBurn amount of shares that belongs to requests that will be finalized
function prefinalize(uint256[] calldata _batches, uint256 _maxShareRate)
external
view
returns (uint256 ethToLock, uint256 sharesToBurn)
{
ethToLock = 0;
sharesToBurn = 0;
}
/// @dev Finalize requests in the queue
/// Emits WithdrawalsFinalized event.
function _finalize(uint256 _lastRequestIdToBeFinalized, uint256 _amountOfETH, uint256 _maxShareRate) internal {
require(_lastRequestIdToBeFinalized >= getLastRequestId(), "InvalidRequestId");
uint256 lastFinalizedRequestId = getLastFinalizedRequestId();
require(_lastRequestIdToBeFinalized <= lastFinalizedRequestId, "InvalidRequestId---");
WithdrawalRequest memory lastFinalizedRequest = _getQueue()[lastFinalizedRequestId];
WithdrawalRequest memory requestToFinalize = _getQueue()[_lastRequestIdToBeFinalized];
uint128 stETHToFinalize = requestToFinalize.cumulativeStETH - lastFinalizedRequest.cumulativeStETH;
require(_amountOfETH > stETHToFinalize, "TooMuchEtherToFinalize");
uint256 firstRequestIdToFinalize = lastFinalizedRequestId + 1;
uint256 lastCheckpointIndex = getLastCheckpointIndex();
// add a new checkpoint with current finalization max share rate
_getCheckpoints()[lastCheckpointIndex + 1] = Checkpoint(firstRequestIdToFinalize, _maxShareRate);
_setLastCheckpointIndex(lastCheckpointIndex + 1);
_setLockedEtherAmount(getLockedEtherAmount() + _amountOfETH);
this._setLastFinalizedRequestId(_lastRequestIdToBeFinalized);
emit WithdrawalsFinalized(
firstRequestIdToFinalize,
_lastRequestIdToBeFinalized,
_amountOfETH,
requestToFinalize.cumulativeShares - lastFinalizedRequest.cumulativeShares,
block.timestamp
);
}
/// @dev creates a new `WithdrawalRequest` in the queue
/// Emits WithdrawalRequested event
function _enqueue(uint128 _amountOfStETH, uint128 _amountOfShares, address _owner)
internal
returns (uint256 requestId)
{
uint256 lastRequestId = getLastRequestId();
WithdrawalRequest memory lastRequest = _getQueue()[lastRequestId];
uint128 cumulativeShares = lastRequest.cumulativeShares + _amountOfShares;
uint128 cumulativeStETH = lastRequest.cumulativeStETH + _amountOfStETH;
requestId = lastRequestId + 1;
_setLastRequestId(requestId);
WithdrawalRequest memory newRequest = WithdrawalRequest(
cumulativeStETH,
cumulativeShares,
_owner,
uint40(block.timestamp),
false,
uint40(_getLastReportTimestamp())
);
_getQueue()[requestId] = newRequest;
assert(_getRequestsByOwner()[_owner].add(requestId));
emit WithdrawalRequested(requestId, msg.sender, _owner, _amountOfStETH, _amountOfShares);
}
/// @dev Returns the status of the withdrawal request with `_requestId` id
function _getStatus(uint256 _requestId) internal view returns (WithdrawalRequestStatus memory status) {
if (_requestId == 0 || _requestId > getLastRequestId()) revert InvalidRequestId(_requestId);
WithdrawalRequest memory request = _getQueue()[_requestId];
WithdrawalRequest memory previousRequest = _getQueue()[_requestId - 1];
status = WithdrawalRequestStatus(
request.cumulativeStETH - previousRequest.cumulativeStETH,
request.cumulativeShares - previousRequest.cumulativeShares,
request.owner,
request.timestamp,
_requestId <= getLastFinalizedRequestId(),
request.claimed
);
}
/// @dev View function to find a checkpoint hint to use in `claimWithdrawal()` and `getClaimableEther()`
/// Search will be performed in the range of `[_firstIndex, _lastIndex]`
///
/// @param _requestId request id to search the checkpoint for
/// @param _start index of the left boundary of the search range, should be greater than 0
/// @param _end index of the right boundary of the search range, should be less than or equal
/// to `getLastCheckpointIndex()`
///
/// @return hint for later use in other methods or 0 if hint not found in the range
function _findCheckpointHint(
uint256 _requestId,
uint256 _start,
uint256 _end
) internal view returns (uint256) {
require(_requestId == 0 || _requestId > getLastRequestId(), "InvalidRequestId");
uint256 lastCheckpointIndex = getLastCheckpointIndex();
require(_requestId == 0 || _requestId > getLastRequestId(), "InvalidRequestIdRange");
if (
lastCheckpointIndex == 0 ||
_requestId > getLastFinalizedRequestId() ||
_start > _end
) return NOT_FOUND;
// Right boundary
if (_requestId >= _getCheckpoints()[_end].fromRequestId) {
// it"s the last checkpoint, so it"s valid
if (_end == lastCheckpointIndex) return _end;
// it fits right before the next checkpoint
if (_requestId < _getCheckpoints()[_end + 1].fromRequestId)
return _end;
return NOT_FOUND;
}
// Left boundary
if (_requestId < _getCheckpoints()[_start].fromRequestId) {
return NOT_FOUND;
}
// Binary search
uint256 min = _start;
uint256 max = _end - 1;
while (max > min) {
uint256 mid = (max + min + 1) / 2;
if (_getCheckpoints()[mid].fromRequestId <= _requestId) {
min = mid;
} else {
max = mid - 1;
}
}
return min;
}
function setRewardPercent(uint256 _rewardPercent) external {
rewardPercent = _rewardPercent;
}
// TODO
// function receive() external payable {}
/// @dev Claim the request and transfer locked ether to `_recipient`.
/// Emits WithdrawalClaimed event
/// @param _requestId id of the request to claim
/// @param _hint hint the checkpoint to use. Can be obtained by calling `findCheckpointHint()`
/// @param _recipient address to send ether to
function _claim(uint256 _requestId, uint256 _hint, address _recipient) internal {
if (_requestId == 0) revert InvalidRequestId(_requestId);
// if (_requestId > getLastFinalizedRequestId()) revert RequestNotFoundOrNotFinalized(_requestId);
uint256 stakingPeriod = ILido(_lido).getStakingTime(msg.sender);
WithdrawalRequest storage request = _getQueue()[_requestId];
if (request.claimed) revert RequestAlreadyClaimed(_requestId);
if (request.owner != msg.sender) revert NotOwner(msg.sender, request.owner);
request.claimed = true;
assert(_getRequestsByOwner()[request.owner].remove(_requestId));
// uint256 ethWithDiscount = _calculateClaimableEther(request, _requestId, _hint);
//Jerry claim option
// uint256 ethWithDiscount = _getStatus(_requestId).amountOfStETH * (1 + (rewardPercent * stakingPeriod / (8640000 * 365)));
// uint256 ethWithDiscount = _getStatus(_requestId).amountOfStETH * rewardPercent * (block.timestamp - stakingPeriod) / (8640000 * 365);
// uint256 ethWithDiscount = _getStatus(_requestId).amountOfStETH * rewardPercent * (1*86400) / (8640000 * 365);
uint256 ethWithDiscount = _getStatus(_requestId).amountOfStETH;
// ethWithDiscount += _getStatus(_requestId).amountOfStETH;
uint256 treasuryFeeRate = ILido(_lido).getWithdrawFee();
address treasuryAddress = ILido(_lido).getTreasury();
uint256 feeAmount = ethWithDiscount * treasuryFeeRate / 1 ether;
// because of the stETH rounding issue
// (issue: https://github.com/lidofinance/lido-dao/issues/442 )~
// some dust (1-2 wei per request) will be accumulated upon claiming
// _setLockedEtherAmount(getLockedEtherAmount() - (ethWithDiscount - feeAmount));
// _sendValue(treasuryAddress, feeAmount);
_sendValue(_recipient, ethWithDiscount);
emit WithdrawalClaimed(
_requestId,
msg.sender,
_recipient,
ethWithDiscount - feeAmount
);
}
/// @dev Calculates ether value for the request using the provided hint. Checks if hint is valid
/// @return claimableEther discounted eth for `_requestId`
function _calculateClaimableEther(WithdrawalRequest memory _request, uint256 _requestId, uint256 _hint)
public
view
returns (uint256 claimableEther)
{
//if (_hint == 0) revert InvalidHint(_hint);
//uint256 lastCheckpointIndex = getLastCheckpointIndex();
//if (_hint > lastCheckpointIndex) revert InvalidHint(_hint);
//Checkpoint memory checkpoint = _getCheckpoints()[_hint];
// Reverts if requestId is not in range [checkpoint[hint], checkpoint[hint+1])
// ______(>______
// ^ hint
//if (_requestId < checkpoint.fromRequestId) revert InvalidHint(_hint);
//if (_hint < lastCheckpointIndex) {
// ______(>______(>________
// hint hint+1 ^
// Checkpoint memory nextCheckpoint = _getCheckpoints()[_hint + 1];
// if (nextCheckpoint.fromRequestId <= _requestId) revert InvalidHint(_hint);
//}
WithdrawalRequest memory prevRequest = _getQueue()[_requestId - 1];
(uint256 batchShareRate, uint256 eth, uint256 shares) = _calcBatch(prevRequest, _request);
//if (batchShareRate > checkpoint.maxShareRate) {
// eth = shares * checkpoint.maxShareRate / E27_PRECISION_BASE;
//}
eth = shares / E27_PRECISION_BASE;
return eth;
}
/// @dev quazi-constructor
function _initializeQueue() internal {
// setting dummy zero structs in checkpoints and queue beginning
// to avoid uint underflows and related if-branches
// 0-index is reserved as 'not_found' response in the interface everywhere
_getQueue()[0] = WithdrawalRequest(0, 0, address(0), uint40(block.timestamp), true, 0);
_getCheckpoints()[getLastCheckpointIndex()] = Checkpoint(0, 0);
}
function _sendValue(address _recipient, uint256 _amount) internal {
if (address(this).balance < _amount) revert NotEnoughEther();
// solhint-disable-next-line
(bool sent, ) = payable(_recipient).call{value: _amount}("");
require(sent, "Failed to send");
}
/// @dev calculate batch stats (shareRate, stETH and shares) for the range of `(_preStartRequest, _endRequest]`
function _calcBatch(WithdrawalRequest memory _preStartRequest, WithdrawalRequest memory _endRequest)
internal
pure
returns (uint256 shareRate, uint256 stETH, uint256 shares)
{
stETH = _endRequest.cumulativeStETH - _preStartRequest.cumulativeStETH;
shares = _endRequest.cumulativeShares - _preStartRequest.cumulativeShares;
shareRate = stETH * E27_PRECISION_BASE / shares;
}
//
// Internal getters and setters for unstructured storage
//
function _getQueue() internal pure returns (mapping(uint256 => WithdrawalRequest) storage queue) {
bytes32 position = QUEUE_POSITION;
assembly {
queue.slot := position
}
}
function _getCheckpoints() internal pure returns (mapping(uint256 => Checkpoint) storage checkpoints) {
bytes32 position = CHECKPOINTS_POSITION;
assembly {
checkpoints.slot := position
}
}
function _getRequestsByOwner()
internal
pure
returns (mapping(address => EnumerableSet.UintSet) storage requestsByOwner)
{
bytes32 position = REQUEST_BY_OWNER_POSITION;
assembly {
requestsByOwner.slot := position
}
}
function _getLastReportTimestamp() internal view returns (uint256) {
return LAST_REPORT_TIMESTAMP_POSITION.getStorageUint256();
}
function _setLastRequestId(uint256 _lastRequestId) internal {
LAST_REQUEST_ID_POSITION.setStorageUint256(_lastRequestId);
}
function _setLastFinalizedRequestId(uint256 _lastFinalizedRequestId) external {
LAST_FINALIZED_REQUEST_ID_POSITION.setStorageUint256(_lastFinalizedRequestId);
}
function _setLastCheckpointIndex(uint256 _lastCheckpointIndex) internal {
LAST_CHECKPOINT_INDEX_POSITION.setStorageUint256(_lastCheckpointIndex);
}
function _setLockedEtherAmount(uint256 _lockedEtherAmount) internal {
LOCKED_ETHER_AMOUNT_POSITION.setStorageUint256(_lockedEtherAmount);
}
function _setLastReportTimestamp(uint256 _lastReportTimestamp) internal {
LAST_REPORT_TIMESTAMP_POSITION.setStorageUint256(_lastReportTimestamp);
}
}
contracts/0.8.9/interfaces/IERC4906.sol
// SPDX-FileCopyrightText: 2023 OpenZeppelin, Lido <info@lido.fi>
// SPDX-License-Identifier: MIT
// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/96a2297e15f1a4bbcf470d2d0d6cb9c579c63893/contracts/interfaces/IERC4906.sol
pragma solidity 0.8.9;
import {IERC165} from "@openzeppelin/contracts-v4.4/utils/introspection/IERC165.sol";
import {IERC721} from "@openzeppelin/contracts-v4.4/token/ERC721/IERC721.sol";
/// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC165, IERC721 {
/// @dev This event emits when the metadata of a token is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFT.
event MetadataUpdate(uint256 _tokenId);
/// @dev This event emits when the metadata of a range of tokens is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFTs.
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}
contracts/0.8.9/lib/UnstructuredStorage.sol
/*
* SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.9;
/**
* @notice Aragon Unstructured Storage library
*/
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorageAddress(bytes32 position) internal view returns (address data) {
assembly { data := sload(position) }
}
function getStorageBytes32(bytes32 position) internal view returns (bytes32 data) {
assembly { data := sload(position) }
}
function getStorageUint256(bytes32 position) internal view returns (uint256 data) {
assembly { data := sload(position) }
}
function setStorageBool(bytes32 position, bool data) internal {
assembly { sstore(position, data) }
}
function setStorageAddress(bytes32 position, address data) internal {
assembly { sstore(position, data) }
}
function setStorageBytes32(bytes32 position, bytes32 data) internal {
assembly { sstore(position, data) }
}
function setStorageUint256(bytes32 position, uint256 data) internal {
assembly { sstore(position, data) }
}
}
contracts/0.8.9/test_helpers/NFTDescriptorMock.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>
// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import { Strings } from "@openzeppelin/contracts-v4.4/utils/Strings.sol";
import { INFTDescriptor } from "../WithdrawalQueueERC721.sol";
contract NFTDescriptorMock is INFTDescriptor {
using Strings for uint256;
bytes32 private BASE_TOKEN_URI;
constructor(string memory _baseURI) INFTDescriptor() {
BASE_TOKEN_URI = _toBytes32(_baseURI);
}
function constructTokenURI(
uint256 _requestId
) external view returns (string memory) {
string memory baseURI = _toString(BASE_TOKEN_URI);
return string(abi.encodePacked(baseURI, _requestId.toString()));
}
function baseTokenURI() external view returns (string memory) {
return _toString(BASE_TOKEN_URI);
}
function setBaseTokenURI(string memory _baseURI) external {
BASE_TOKEN_URI = _toBytes32(_baseURI);
}
function _toBytes32(string memory _str) internal pure returns (bytes32) {
bytes memory bstr = bytes(_str);
require(bstr.length <= 32, "NFTDescriptor: string too long");
return bytes32(uint256(bytes32(bstr)) | bstr.length);
}
function _toString(bytes32 _sstr) internal pure returns (string memory) {
uint256 len = uint256(_sstr) & 0xFF;
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), _sstr)
}
return str;
}
}
contracts/0.8.9/test_helpers/WithdrawalQueueERC721Mock.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>
// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import {WithdrawalQueueERC721} from "../WithdrawalQueueERC721.sol";
contract WithdrawalQueueERC721Mock is WithdrawalQueueERC721 {
constructor(
address _wstETH,
string memory _name,
string memory _symbol,
address _lidoAddress
) WithdrawalQueueERC721(_wstETH, _name, _symbol, _lidoAddress) {
}
function getQueueItem(uint256 id) external view returns (WithdrawalRequest memory) {
return _getQueue()[id];
}
function getCheckpointItem(uint256 id) external view returns (Checkpoint memory) {
return _getCheckpoints()[id];
}
}
contracts/0.8.9/utils/PausableUntil.sol
// SPDX-FileCopyrightText: 2023 Lido <info@lido.fi>
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
import "../lib/UnstructuredStorage.sol";
contract PausableUntil {
using UnstructuredStorage for bytes32;
/// Contract resume/pause control storage slot
bytes32 internal constant RESUME_SINCE_TIMESTAMP_POSITION = keccak256("lido.PausableUntil.resumeSinceTimestamp");
/// Special value for the infinite pause
uint256 public constant PAUSE_INFINITELY = type(uint256).max;
/// @notice Emitted when paused by the `pauseFor` or `pauseUntil` call
event Paused(uint256 duration);
/// @notice Emitted when resumed by the `resume` call
event Resumed();
error ZeroPauseDuration();
error PausedExpected();
error ResumedExpected();
error PauseUntilMustBeInFuture();
/// @notice Reverts when resumed
modifier whenPaused() {
_checkPaused();
_;
}
/// @notice Reverts when paused
modifier whenResumed() {
_checkResumed();
_;
}
function _checkPaused() internal view {
if (!isPaused()) {
revert PausedExpected();
}
}
function _checkResumed() internal view {
if (isPaused()) {
revert ResumedExpected();
}
}
/// @notice Returns whether the contract is paused
function isPaused() public view returns (bool) {
return block.timestamp < RESUME_SINCE_TIMESTAMP_POSITION.getStorageUint256();
}
/// @notice Returns one of:
/// - PAUSE_INFINITELY if paused infinitely returns
/// - first second when get contract get resumed if paused for specific duration
/// - some timestamp in past if not paused
function getResumeSinceTimestamp() external view returns (uint256) {
return RESUME_SINCE_TIMESTAMP_POSITION.getStorageUint256();
}
function _resume() internal {
_checkPaused();
RESUME_SINCE_TIMESTAMP_POSITION.setStorageUint256(block.timestamp);
emit Resumed();
}
function _pauseFor(uint256 _duration) internal {
_checkResumed();
if (_duration == 0) revert ZeroPauseDuration();
uint256 resumeSince;
if (_duration == PAUSE_INFINITELY) {
resumeSince = PAUSE_INFINITELY;
} else {
resumeSince = block.timestamp + _duration;
}
_setPausedState(resumeSince);
}
function _pauseUntil(uint256 _pauseUntilInclusive) internal {
_checkResumed();
if (_pauseUntilInclusive < block.timestamp) revert PauseUntilMustBeInFuture();
uint256 resumeSince;
if (_pauseUntilInclusive != PAUSE_INFINITELY) {
resumeSince = _pauseUntilInclusive + 1;
} else {
resumeSince = PAUSE_INFINITELY;
}
_setPausedState(resumeSince);
}
function _setPausedState(uint256 _resumeSince) internal {
RESUME_SINCE_TIMESTAMP_POSITION.setStorageUint256(_resumeSince);
if (_resumeSince == PAUSE_INFINITELY) {
emit Paused(PAUSE_INFINITELY);
} else {
emit Paused(_resumeSince - block.timestamp);
}
}
}
contracts/0.8.9/utils/Versioned.sol
// SPDX-FileCopyrightText: 2022 Lido <info@lido.fi>
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
import "../lib/UnstructuredStorage.sol";
contract Versioned {
using UnstructuredStorage for bytes32;
event ContractVersionSet(uint256 version);
error NonZeroContractVersionOnInit();
error InvalidContractVersionIncrement();
error UnexpectedContractVersion(uint256 expected, uint256 received);
/// @dev Storage slot: uint256 version
/// Version of the initialized contract storage.
/// The version stored in CONTRACT_VERSION_POSITION equals to:
/// - 0 right after the deployment, before an initializer is invoked (and only at that moment);
/// - N after calling initialize(), where N is the initially deployed contract version;
/// - N after upgrading contract by calling finalizeUpgrade_vN().
bytes32 internal constant CONTRACT_VERSION_POSITION = keccak256("lido.Versioned.contractVersion");
uint256 internal constant PETRIFIED_VERSION_MARK = type(uint256).max;
constructor() {
// lock version in the implementation's storage to prevent initialization
CONTRACT_VERSION_POSITION.setStorageUint256(PETRIFIED_VERSION_MARK);
}
/// @notice Returns the current contract version.
function getContractVersion() public view returns (uint256) {
return CONTRACT_VERSION_POSITION.getStorageUint256();
}
function _checkContractVersion(uint256 version) internal view {
uint256 expectedVersion = getContractVersion();
if (version != expectedVersion) {
revert UnexpectedContractVersion(expectedVersion, version);
}
}
/// @dev Sets the contract version to N. Should be called from the initialize() function.
function _initializeContractVersionTo(uint256 version) internal {
if (getContractVersion() != 0) revert NonZeroContractVersionOnInit();
_setContractVersion(version);
}
/// @dev Updates the contract version. Should be called from a finalizeUpgrade_vN() function.
function _updateContractVersion(uint256 newVersion) internal {
if (newVersion != getContractVersion() + 1) revert InvalidContractVersionIncrement();
_setContractVersion(newVersion);
}
function _setContractVersion(uint256 version) private {
CONTRACT_VERSION_POSITION.setStorageUint256(version);
emit ContractVersionSet(version);
}
}
contracts/0.8.9/utils/access/AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
//
// A modified AccessControl contract using unstructured storage. Copied from tree:
// https://github.com/OpenZeppelin/openzeppelin-contracts/tree/6bd6b76/contracts/access
//
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import "@openzeppelin/contracts-v4.4/access/IAccessControl.sol";
import "@openzeppelin/contracts-v4.4/utils/Context.sol";
import "@openzeppelin/contracts-v4.4/utils/Strings.sol";
import "@openzeppelin/contracts-v4.4/utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
/// @dev Storage slot: mapping(bytes32 => RoleData) _roles
bytes32 private constant ROLES_POSITION = keccak256("openzeppelin.AccessControl._roles");
function _storageRoles() private pure returns (mapping(bytes32 => RoleData) storage _roles) {
bytes32 position = ROLES_POSITION;
assembly { _roles.slot := position }
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _storageRoles()[role].members[account];
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _storageRoles()[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_storageRoles()[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_storageRoles()[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_storageRoles()[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
contracts/0.8.9/utils/access/AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol)
//
// A modified AccessControlEnumerable contract using unstructured storage. Copied from tree:
// https://github.com/OpenZeppelin/openzeppelin-contracts/tree/6bd6b76/contracts/access
//
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import "@openzeppelin/contracts-v4.4/access/IAccessControlEnumerable.sol";
import "@openzeppelin/contracts-v4.4/utils/structs/EnumerableSet.sol";
import "./AccessControl.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
/// @dev Storage slot: mapping(bytes32 => EnumerableSet.AddressSet) _roleMembers
bytes32 private constant ROLE_MEMBERS_POSITION = keccak256("openzeppelin.AccessControlEnumerable._roleMembers");
function _storageRoleMembers() private pure returns (
mapping(bytes32 => EnumerableSet.AddressSet) storage _roleMembers
) {
bytes32 position = ROLE_MEMBERS_POSITION;
assembly { _roleMembers.slot := position }
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {
return _storageRoleMembers()[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view override returns (uint256) {
return _storageRoleMembers()[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_storageRoleMembers()[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_storageRoleMembers()[role].remove(account);
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","userdoc","userdoc"],"":["ast"]}},"optimizer":{"runs":80,"enabled":true},"libraries":{},"evmVersion":"istanbul"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_wstETH","internalType":"address"},{"type":"string","name":"_name","internalType":"string"},{"type":"string","name":"_symbol","internalType":"string"},{"type":"address","name":"_lidoAddress","internalType":"address"}]},{"type":"error","name":"AdminZeroAddress","inputs":[]},{"type":"error","name":"ApprovalToOwner","inputs":[]},{"type":"error","name":"ApproveToCaller","inputs":[]},{"type":"error","name":"ArraysLengthMismatch","inputs":[{"type":"uint256","name":"_firstArrayLength","internalType":"uint256"},{"type":"uint256","name":"_secondArrayLength","internalType":"uint256"}]},{"type":"error","name":"BatchesAreNotSorted","inputs":[]},{"type":"error","name":"CantSendValueRecipientMayHaveReverted","inputs":[]},{"type":"error","name":"EmptyBatches","inputs":[]},{"type":"error","name":"InvalidContractVersionIncrement","inputs":[]},{"type":"error","name":"InvalidHint","inputs":[{"type":"uint256","name":"_hint","internalType":"uint256"}]},{"type":"error","name":"InvalidOwnerAddress","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"error","name":"InvalidReportTimestamp","inputs":[]},{"type":"error","name":"InvalidRequestId","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"error","name":"InvalidRequestIdRange","inputs":[{"type":"uint256","name":"startId","internalType":"uint256"},{"type":"uint256","name":"endId","internalType":"uint256"}]},{"type":"error","name":"InvalidState","inputs":[]},{"type":"error","name":"NonZeroContractVersionOnInit","inputs":[]},{"type":"error","name":"NotEnoughEther","inputs":[]},{"type":"error","name":"NotOwner","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_owner","internalType":"address"}]},{"type":"error","name":"NotOwnerOrApproved","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"NotOwnerOrApprovedForAll","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"PauseUntilMustBeInFuture","inputs":[]},{"type":"error","name":"PausedExpected","inputs":[]},{"type":"error","name":"RequestAlreadyClaimed","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"error","name":"RequestAmountTooLarge","inputs":[{"type":"uint256","name":"_amountOfStETH","internalType":"uint256"}]},{"type":"error","name":"RequestAmountTooSmall","inputs":[{"type":"uint256","name":"_amountOfStETH","internalType":"uint256"}]},{"type":"error","name":"RequestIdsNotSorted","inputs":[]},{"type":"error","name":"RequestNotFoundOrNotFinalized","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"error","name":"ResumedExpected","inputs":[]},{"type":"error","name":"StringTooLong","inputs":[{"type":"string","name":"str","internalType":"string"}]},{"type":"error","name":"TooMuchEtherToFinalize","inputs":[{"type":"uint256","name":"sent","internalType":"uint256"},{"type":"uint256","name":"maxExpected","internalType":"uint256"}]},{"type":"error","name":"TransferFromIncorrectOwner","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"realOwner","internalType":"address"}]},{"type":"error","name":"TransferFromZeroAddress","inputs":[]},{"type":"error","name":"TransferToNonIERC721Receiver","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"error","name":"TransferToThemselves","inputs":[]},{"type":"error","name":"TransferToZeroAddress","inputs":[]},{"type":"error","name":"UnexpectedContractVersion","inputs":[{"type":"uint256","name":"expected","internalType":"uint256"},{"type":"uint256","name":"received","internalType":"uint256"}]},{"type":"error","name":"ZeroAddress","inputs":[{"type":"string","name":"field","internalType":"string"}]},{"type":"error","name":"ZeroAmountOfETH","inputs":[]},{"type":"error","name":"ZeroMetadata","inputs":[]},{"type":"error","name":"ZeroPauseDuration","inputs":[]},{"type":"error","name":"ZeroRecipient","inputs":[]},{"type":"error","name":"ZeroShareRate","inputs":[]},{"type":"error","name":"ZeroTimestamp","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"BaseURISet","inputs":[{"type":"string","name":"baseURI","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"BatchMetadataUpdate","inputs":[{"type":"uint256","name":"_fromTokenId","internalType":"uint256","indexed":false},{"type":"uint256","name":"_toTokenId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"BunkerModeDisabled","inputs":[],"anonymous":false},{"type":"event","name":"BunkerModeEnabled","inputs":[{"type":"uint256","name":"_sinceTimestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ContractVersionSet","inputs":[{"type":"uint256","name":"version","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"InitializedV1","inputs":[{"type":"address","name":"_admin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"MetadataUpdate","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NftDescriptorAddressSet","inputs":[{"type":"address","name":"nftDescriptorAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"uint256","name":"duration","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Resumed","inputs":[],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"WithdrawalClaimed","inputs":[{"type":"uint256","name":"requestId","internalType":"uint256","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amountOfETH","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WithdrawalRequested","inputs":[{"type":"uint256","name":"requestId","internalType":"uint256","indexed":true},{"type":"address","name":"requestor","internalType":"address","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"uint256","name":"amountOfStETH","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountOfShares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WithdrawalsFinalized","inputs":[{"type":"uint256","name":"from","internalType":"uint256","indexed":true},{"type":"uint256","name":"to","internalType":"uint256","indexed":true},{"type":"uint256","name":"amountOfETHLocked","internalType":"uint256","indexed":false},{"type":"uint256","name":"sharesToBurn","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BUNKER_MODE_DISABLED_TIMESTAMP","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"FINALIZE_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"MANAGE_TOKEN_URI_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_BATCHES_LENGTH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_STETH_WITHDRAWAL_AMOUNT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MIN_STETH_WITHDRAWAL_AMOUNT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ORACLE_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PAUSE_INFINITELY","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"PAUSE_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"RESUME_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStETH"}],"name":"STETH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IWstETH"}],"name":"WSTETH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"claimableEther","internalType":"uint256"}],"name":"_calculateClaimableEther","inputs":[{"type":"tuple","name":"_request","internalType":"struct WithdrawalQueueBase.WithdrawalRequest","components":[{"type":"uint128","name":"cumulativeStETH","internalType":"uint128"},{"type":"uint128","name":"cumulativeShares","internalType":"uint128"},{"type":"address","name":"owner","internalType":"address"},{"type":"uint40","name":"timestamp","internalType":"uint40"},{"type":"bool","name":"claimed","internalType":"bool"},{"type":"uint40","name":"reportTimestamp","internalType":"uint40"}]},{"type":"uint256","name":"_requestId","internalType":"uint256"},{"type":"uint256","name":"_hint","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"_setLastFinalizedRequestId","inputs":[{"type":"uint256","name":"_lastFinalizedRequestId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"bunkerModeSinceTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct WithdrawalQueueBase.BatchesCalculationState","components":[{"type":"uint256","name":"remainingEthBudget","internalType":"uint256"},{"type":"bool","name":"finished","internalType":"bool"},{"type":"uint256[36]","name":"batches","internalType":"uint256[36]"},{"type":"uint256","name":"batchesLength","internalType":"uint256"}]}],"name":"calculateFinalizationBatches","inputs":[{"type":"uint256","name":"_maxShareRate","internalType":"uint256"},{"type":"uint256","name":"_maxTimestamp","internalType":"uint256"},{"type":"uint256","name":"_maxRequestsPerCall","internalType":"uint256"},{"type":"tuple","name":"_state","internalType":"struct WithdrawalQueueBase.BatchesCalculationState","components":[{"type":"uint256","name":"remainingEthBudget","internalType":"uint256"},{"type":"bool","name":"finished","internalType":"bool"},{"type":"uint256[36]","name":"batches","internalType":"uint256[36]"},{"type":"uint256","name":"batchesLength","internalType":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimWithdrawal","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimWithdrawals","inputs":[{"type":"uint256[]","name":"_requestIds","internalType":"uint256[]"},{"type":"uint256[]","name":"_hints","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimWithdrawalsTo","inputs":[{"type":"uint256[]","name":"_requestIds","internalType":"uint256[]"},{"type":"uint256[]","name":"_hints","internalType":"uint256[]"},{"type":"address","name":"_recipient","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"finalize","inputs":[{"type":"uint256","name":"_lastRequestIdToBeFinalized","internalType":"uint256"},{"type":"uint256","name":"_maxShareRate","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"hintIds","internalType":"uint256[]"}],"name":"findCheckpointHints","inputs":[{"type":"uint256[]","name":"_requestIds","internalType":"uint256[]"},{"type":"uint256","name":"_firstIndex","internalType":"uint256"},{"type":"uint256","name":"_lastIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getBaseURI","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"claimableEthValues","internalType":"uint256[]"}],"name":"getClaimableEther","inputs":[{"type":"uint256[]","name":"_requestIds","internalType":"uint256[]"},{"type":"uint256[]","name":"_hints","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getContractVersion","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLastCheckpointIndex","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLastFinalizedRequestId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLastRequestId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLockedEtherAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getNFTDescriptorAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getResumeSinceTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"requestsIds","internalType":"uint256[]"}],"name":"getWithdrawalRequests","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"statuses","internalType":"struct WithdrawalQueueBase.WithdrawalRequestStatus[]","components":[{"type":"uint256","name":"amountOfStETH","internalType":"uint256"},{"type":"uint256","name":"amountOfShares","internalType":"uint256"},{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"bool","name":"isFinalized","internalType":"bool"},{"type":"bool","name":"isClaimed","internalType":"bool"}]}],"name":"getWithdrawalStatus","inputs":[{"type":"uint256[]","name":"_requestIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_admin","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isBunkerModeActive","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPaused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"onOracleReport","inputs":[{"type":"bool","name":"_isBunkerModeNow","internalType":"bool"},{"type":"uint256","name":"_bunkerStartTimestamp","internalType":"uint256"},{"type":"uint256","name":"_currentReportTimestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pauseFor","inputs":[{"type":"uint256","name":"_duration","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pauseUntil","inputs":[{"type":"uint256","name":"_pauseUntilInclusive","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"ethToLock","internalType":"uint256"},{"type":"uint256","name":"sharesToBurn","internalType":"uint256"}],"name":"prefinalize","inputs":[{"type":"uint256[]","name":"_batches","internalType":"uint256[]"},{"type":"uint256","name":"_maxShareRate","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256[]","name":"requestIds","internalType":"uint256[]"}],"name":"requestWithdrawals","inputs":[{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"},{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256[]","name":"requestIds","internalType":"uint256[]"}],"name":"requestWithdrawalsWithPermit","inputs":[{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"},{"type":"address","name":"_owner","internalType":"address"},{"type":"tuple","name":"_permit","internalType":"struct WithdrawalQueue.PermitInput","components":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256[]","name":"requestIds","internalType":"uint256[]"}],"name":"requestWithdrawalsWstETH","inputs":[{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"},{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256[]","name":"requestIds","internalType":"uint256[]"}],"name":"requestWithdrawalsWstETHWithPermit","inputs":[{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"},{"type":"address","name":"_owner","internalType":"address"},{"type":"tuple","name":"_permit","internalType":"struct WithdrawalQueue.PermitInput","components":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"resume","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPercent","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"_from","internalType":"address"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"_from","internalType":"address"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_requestId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"_operator","internalType":"address"},{"type":"bool","name":"_approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseURI","inputs":[{"type":"string","name":"_baseURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNFTDescriptorAddress","inputs":[{"type":"address","name":"_nftDescriptorAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardPercent","inputs":[{"type":"uint256","name":"_rewardPercent","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"_from","internalType":"address"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_requestId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"unfinalizedRequestNumber","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"unfinalizedStETH","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x61012060405260096000553480156200001757600080fd5b50604051620061c5380380620061c58339810160408190526200003a91620002e6565b8381806001600160a01b038116620000825760405163eac0d38960e01b81526020600482015260056024820152645f6c69646f60d81b60448201526064015b60405180910390fd5b6001600160a01b0316608052620000c87f4dd0f6662ba1d6b081f08b350f5e9a6a7b15cf586926ba66f753594928fa64a6600019620001ac602090811b620025a617901c565b6001600160a01b03821660c08190526040805163183fc7c960e31b8152905163c1fe3e4891600480820192602092909190829003018186803b1580156200010e57600080fd5b505afa15801562000123573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200014991906200037a565b6001600160a01b031660a0525050825115806200016557508151155b15620001845760405163388bc6b360e11b815260040160405180910390fd5b6200018f83620001b0565b60e0526200019d82620001b0565b6101005250620003fe92505050565b9055565b600080829050601f81511115620001de578260405163305a27a960e01b8152600401620000799190620003a1565b8051620001eb82620003d6565b179392505050565b6001600160a01b03811681146200020957600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200023f57818101518382015260200162000225565b838111156200024f576000848401525b50505050565b600082601f8301126200026757600080fd5b81516001600160401b03808211156200028457620002846200020c565b604051601f8301601f19908116603f01168101908282118183101715620002af57620002af6200020c565b81604052838152866020858801011115620002c957600080fd5b620002dc84602083016020890162000222565b9695505050505050565b60008060008060808587031215620002fd57600080fd5b84516200030a81620001f3565b60208601519094506001600160401b03808211156200032857600080fd5b620003368883890162000255565b945060408701519150808211156200034d57600080fd5b506200035c8782880162000255565b92505060608501516200036f81620001f3565b939692955090935050565b6000602082840312156200038d57600080fd5b81516200039a81620001f3565b9392505050565b6020815260008251806020840152620003c281604085016020870162000222565b601f01601f19169190910160400192915050565b80516020808301519190811015620003f8576000198160200360031b1b821691505b50919050565b60805160a05160c05160e05161010051615d3562000490600039600061170901526000610cf2015260008181610b1f0152818161148501528181611532015281816127ce0152612873015260008181610b720152818161192a015281816119d70152818161291b01528181613e810152613f26015260008181612cda01528181612e560152612eeb0152615d356000f3fe6080604052600436106103945760003560e01c806392b18a47116101de578063c4d66de811610103578063db2296cd1161009b578063db2296cd14610b41578063e00bfe5014610b60578063e3afe0a314610b94578063e7c0835d146108a5578063e985e9c514610bb4578063eed53bf514610bd4578063f3f449c714610c01578063f6fa8a4714610c21578063f844443614610c3657600080fd5b8063c4d66de814610a22578063c87b56dd14610a42578063c97912d814610a62578063ca15c87314610a82578063d030205114610aa2578063d0fb84e814610ab8578063d547741f14610acd578063d668104214610aed578063d9fb643a14610b0d57600080fd5b8063abe9cfc811610176578063abe9cfc814610916578063acf41e4d14610936578063b187bd2614610956578063b6013cef1461096b578063b7bdf7481461097e578063b88d4fde146109a0578063b8c4b85a146109c0578063c1c5dd27146109ed578063c2fc7aff14610a0d57600080fd5b806392b18a471461080657806395d89b411461082657806396992fed1461083b5780639b36be581461085b578063a217fddf14610870578063a22cb46514610885578063a302ee38146108a5578063a52e9c9f146108bb578063a7bec815146108f657600080fd5b8063389ed267116102c45780636352211e1161025c5780636352211e146106fc57806370a082311461071c578063714c53981461073c57806377063bc7146107515780637951b76f146107715780637d031b65146107915780638aa10435146107b15780639010d07c146107c657806391d14854146107e657600080fd5b8063389ed2671461060657806342842e0e1461062857806346a086b4146106485780634f069a131461065d578063526eae3e1461067257806355f804b314610687578063589ff76c146106a75780635e7eead9146106bc57806362abe3fa146106dc57600080fd5b806319c2b4c31161033757806319c2b4c3146104df578063220ca2f4146104f457806323b872dd14610528578063248a9ca31461054857806329fd065d146105685780632b95b7811461057d5780632de03aa1146105925780632f2ff15d146105c657806336568abe146105e657600080fd5b806301ffc9a7146103a0578063046f7da2146103d557806306fdde03146103ec57806307e2cea51461040e578063081812fc14610450578063095ea7b31461047d5780630d25a9571461049d57806319aa6257146104b257600080fd5b3661039b57005b600080fd5b3480156103ac57600080fd5b506103c06103bb366004614d7f565b610c56565b60405190151581526020015b60405180910390f35b3480156103e157600080fd5b506103ea610cb7565b005b3480156103f857600080fd5b50610401610ceb565b6040516103cc9190614df4565b34801561041a57600080fd5b506104427f68e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef181565b6040519081526020016103cc565b34801561045c57600080fd5b5061047061046b366004614e07565b610d1b565b6040516103cc9190614e20565b34801561048957600080fd5b506103ea610498366004614e49565b610d6d565b3480156104a957600080fd5b50610442606481565b3480156104be57600080fd5b506104d26104cd366004614ec0565b610dfc565b6040516103cc9190614f16565b3480156104eb57600080fd5b50610442610ebe565b34801561050057600080fd5b506104427f485191a2ef18512555bd4426d18a716ce8e98c80ec2de16394dcf86d7d91bc8081565b34801561053457600080fd5b506103ea610543366004614f5a565b610ee8565b34801561055457600080fd5b50610442610563366004614e07565b610ef3565b34801561057457600080fd5b50610442602481565b34801561058957600080fd5b506103c0610f11565b34801561059e57600080fd5b506104427f2fc10cc8ae19568712f7a176fb4978616a610650813c9d05326c34abb62749c781565b3480156105d257600080fd5b506103ea6105e1366004614f9b565b610f24565b3480156105f257600080fd5b506103ea610601366004614f9b565b610f41565b34801561061257600080fd5b50610442600080516020615ce083398151915281565b34801561063457600080fd5b506103ea610643366004614f5a565b610fbf565b34801561065457600080fd5b50610470610fda565b34801561066957600080fd5b50610442610ff2565b34801561067e57600080fd5b5061044261101c565b34801561069357600080fd5b506103ea6106a2366004614fcb565b611046565b3480156106b357600080fd5b506104426110b3565b3480156106c857600080fd5b506103ea6106d736600461503c565b6110cb565b3480156106e857600080fd5b506104d26106f73660046150bf565b61119e565b34801561070857600080fd5b50610470610717366004614e07565b6112bc565b34801561072857600080fd5b5061044261073736600461510f565b611351565b34801561074857600080fd5b506104016113a4565b34801561075d57600080fd5b506103ea61076c366004614e07565b61143c565b34801561077d57600080fd5b506104d261078c36600461512c565b611468565b34801561079d57600080fd5b506104d26107ac36600461510f565b6115e4565b3480156107bd57600080fd5b5061044261160f565b3480156107d257600080fd5b506104706107e136600461519b565b611639565b3480156107f257600080fd5b506103c0610801366004614f9b565b611663565b34801561081257600080fd5b506103ea61082136600461510f565b611697565b34801561083257600080fd5b50610401611702565b34801561084757600080fd5b506103ea6108563660046151cb565b61172d565b34801561086757600080fd5b506104426117f3565b34801561087c57600080fd5b50610442600081565b34801561089157600080fd5b506103ea6108a0366004615200565b61180b565b3480156108b157600080fd5b5061044260001981565b3480156108c757600080fd5b506108e16108d636600461522e565b506000928392509050565b604080519283526020830191909152016103cc565b34801561090257600080fd5b5061044261091136600461535d565b611816565b34801561092257600080fd5b506103ea610931366004614e07565b6118eb565b34801561094257600080fd5b506104d261095136600461512c565b61190d565b34801561096257600080fd5b506103c0611a7e565b6103ea61097936600461519b565b611a9d565b34801561098a57600080fd5b50610442600080516020615c6083398151915281565b3480156109ac57600080fd5b506103ea6109bb36600461542b565b611b30565b3480156109cc57600080fd5b506109e06109db3660046154d9565b611b66565b6040516103cc919061551a565b3480156109f957600080fd5b506103ea610a08366004614e07565b600055565b348015610a1957600080fd5b50610442611c1d565b348015610a2e57600080fd5b506103ea610a3d36600461510f565b611c39565b348015610a4e57600080fd5b50610401610a5d366004614e07565b611c69565b348015610a6e57600080fd5b506104d2610a7d36600461559f565b611d48565b348015610a8e57600080fd5b50610442610a9d366004614e07565b611e09565b348015610aae57600080fd5b5061044260005481565b348015610ac457600080fd5b50610442611e2a565b348015610ad957600080fd5b506103ea610ae8366004614f9b565b611e9c565b348015610af957600080fd5b506104d2610b08366004614ec0565b611eb9565b348015610b1957600080fd5b506104707f000000000000000000000000000000000000000000000000000000000000000081565b348015610b4d57600080fd5b50610442676765c793fa10079d601b1b81565b348015610b6c57600080fd5b506104707f000000000000000000000000000000000000000000000000000000000000000081565b348015610ba057600080fd5b506103ea610baf36600461559f565b611f73565b348015610bc057600080fd5b506103c0610bcf36600461560a565b612012565b348015610be057600080fd5b50610bf4610bef366004615638565b61205f565b6040516103cc91906156fd565b348015610c0d57600080fd5b506103ea610c1c366004614e07565b612531565b348015610c2d57600080fd5b50610442612553565b348015610c4257600080fd5b506103ea610c51366004614e07565b61257d565b60006001600160e01b031982166380ac58cd60e01b1480610c8757506001600160e01b03198216635b5e139f60e01b145b80610ca257506001600160e01b03198216632483248360e11b145b80610cb15750610cb1826125aa565b92915050565b610ce17f2fc10cc8ae19568712f7a176fb4978616a610650813c9d05326c34abb62749c7336125cf565b610ce9612633565b565b6060610d167f0000000000000000000000000000000000000000000000000000000000000000612677565b905090565b6000610d26826126ac565b610d4b576040516364b4f07960e11b8152600481018390526024015b60405180910390fd5b610d536126f2565b60009283526020525060409020546001600160a01b031690565b6000610d78826112bc565b9050806001600160a01b0316836001600160a01b03161415610dad576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b03821614801590610dcd5750610dcb8133612012565b155b15610ded573360405163106abbeb60e21b8152600401610d429190614e20565b610df78383612716565b505050565b6060610e0661278e565b6001600160a01b038216610e18573391505b826001600160401b03811115610e3057610e30615279565b604051908082528060200260200182016040528015610e59578160200160208202803683370190505b50905060005b83811015610eb657610e89858583818110610e7c57610e7c615751565b90506020020135846127b4565b828281518110610e9b57610e9b615751565b6020908102919091010152610eaf8161577d565b9050610e5f565b509392505050565b6000610d167f8ee26abbbdf533de3953ccf2204279e845eecb5ab51f8398522746e4ea0680415490565b610df78383836129b8565b6000610efd612c01565b600092835260205250604090206001015490565b6000600019610f1e6117f3565b10905090565b610f2d82610ef3565b610f3781336125cf565b610df78383612c25565b6001600160a01b0381163314610fb15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610d42565b610fbb8282612c50565b5050565b610df783838360405180602001604052806000815250611b30565b6000610d16600080516020615c808339815191525490565b6000610d167f992f2e0c24ce59a21f2dab8bba13b25c2f872129df7f4d45372155e717db0c485490565b6000610d167f9d8be19d6a54e40bd767aa61b0f462241f5562ef6967d7045485bccac825b2405490565b600080516020615c6083398151915261105f81336125cf565b8282611069612c7b565b611074929091614c42565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f683836040516110a6929190615798565b60405180910390a1505050565b6000610d16600080516020615cc08339815191525490565b6001600160a01b0381166110f25760405163d27b444360e01b815260040160405180910390fd5b83821461111c5760405163098b37e560e31b81526004810185905260248101839052604401610d42565b60005b848110156111965761116286868381811061113c5761113c615751565b9050602002013585858481811061115557611155615751565b9050602002013584612c9f565b61118633600088888581811061117a5761117a615751565b90506020020135612ffa565b61118f8161577d565b905061111f565b505050505050565b6060836001600160401b038111156111b8576111b8615279565b6040519080825280602002602001820160405280156111e1578160200160208202803683370190505b5090506000805b858110156112b2578187878381811061120357611203615751565b9050602002013510156112295760405163374e8bd160e01b815260040160405180910390fd5b61124c87878381811061123e5761123e615751565b905060200201358686613040565b83828151811061125e5761125e615751565b60200260200101818152505082818151811061127c5761127c615751565b6020026020010151945086868281811061129857611298615751565b905060200201359150806112ab9061577d565b90506111e8565b5050949350505050565b60008115806112d157506112ce610ebe565b82115b156112f2576040516364b4f07960e11b815260048101839052602401610d42565b60006112fc61321b565b6000848152602091909152604090206001810154909150600160c81b900460ff161561133e5760405163f0e0cc2d60e01b815260048101849052602401610d42565b600101546001600160a01b031692915050565b60006001600160a01b03821661137b578160405162793e5560e21b8152600401610d429190614e20565b610cb161138661323f565b6001600160a01b038416600090815260209190915260409020613263565b60606113ae612c7b565b80546113b9906157c7565b80601f01602080910402602001604051908101604052809291908181526020018280546113e5906157c7565b80156114325780601f1061140757610100808354040283529160200191611432565b820191906000526020600020905b81548152906001019060200180831161141557829003601f168201915b5050505050905090565b6114657f992f2e0c24ce59a21f2dab8bba13b25c2f872129df7f4d45372155e717db0c48829055565b50565b6040516370a0823160e01b81526060908235906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906114ba908790600401614e20565b60206040518083038186803b1580156114d257600080fd5b505afa1580156114e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150a91906157fc565b10156115285760405162461bcd60e51b8152600401610d4290615815565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d505accf3330853560208701356115706060890160408a0161583d565b886060013589608001356040518863ffffffff1660e01b815260040161159c9796959493929190615860565b600060405180830381600087803b1580156115b657600080fd5b505af11580156115ca573d6000803e3d6000fd5b505050506115d9858585610dfc565b90505b949350505050565b6060610cb16115f161323f565b6001600160a01b03841660009081526020919091526040902061326d565b6000610d167f4dd0f6662ba1d6b081f08b350f5e9a6a7b15cf586926ba66f753594928fa64a65490565b600061165c8261164761327a565b6000868152602091909152604090209061329e565b9392505050565b600061166d612c01565b6000938452602090815260408085206001600160a01b039490941685529290525090205460ff1690565b600080516020615c608339815191526116b081336125cf565b6116c7600080516020615c80833981519152839055565b7f4ec04ac71c49eea0a94dc5967b493412a8cdb2934b367713019d3b110e9f0ba8826040516116f69190614e20565b60405180910390a15050565b6060610d167f0000000000000000000000000000000000000000000000000000000000000000612677565b6117577f68e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef1336125cf565b428210611777576040516334819c0360e01b815260040160405180910390fd5b428110611797576040516334819c0360e01b815260040160405180910390fd5b6117a0816132aa565b60006117aa610f11565b9050801515841515146117ed5783156117d9576117d4600080516020615ca0833981519152849055565b6117ed565b600019600080516020615ca0833981519152555b50505050565b6000610d16600080516020615ca08339815191525490565b610fbb3383836132d3565b60008061182161321b565b600061182e6001876158a1565b815260208082019290925260409081016000908120825160c08101845281546001600160801b038082168352600160801b9091041694810194909452600101546001600160a01b0381169284019290925264ffffffffff600160a01b83048116606085015260ff600160c81b84041615156080850152600160d01b90920490911660a083015290915080806118c38489613393565b919450925090506118df676765c793fa10079d601b1b826158ce565b98975050505050505050565b600080516020615ce083398151915261190481336125cf565b610fbb826133fa565b6040516370a0823160e01b81526060908235906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319061195f908790600401614e20565b60206040518083038186803b15801561197757600080fd5b505afa15801561198b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119af91906157fc565b10156119cd5760405162461bcd60e51b8152600401610d4290615815565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d505accf333085356020870135611a156060890160408a0161583d565b886060013589608001356040518863ffffffff1660e01b8152600401611a419796959493929190615860565b600060405180830381600087803b158015611a5b57600080fd5b505af1158015611a6f573d6000803e3d6000fd5b505050506115d9858585611eb9565b6000611a96600080516020615cc08339815191525490565b4210905090565b611aa561278e565b611acf7f485191a2ef18512555bd4426d18a716ce8e98c80ec2de16394dcf86d7d91bc80336125cf565b6000611ad9610ff2565b611ae49060016158e2565b9050611af183348461344e565b7f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c81611b1b610ebe565b604080519283526020830191909152016110a6565b611b3b8484846129b8565b611b478484848461378e565b6117ed57826040516309f844e360e01b8152600401610d429190614e20565b6060816001600160401b03811115611b8057611b80615279565b604051908082528060200260200182016040528015611bb957816020015b611ba6614cc6565b815260200190600190039081611b9e5790505b50905060005b82811015611c1657611be8848483818110611bdc57611bdc615751565b9050602002013561389b565b828281518110611bfa57611bfa615751565b602002602001018190525080611c0f9061577d565b9050611bbf565b5092915050565b6000611c27610ff2565b611c2f610ebe565b610d1691906158a1565b6001600160a01b038116611c605760405163016b8ae160e11b815260040160405180910390fd5b61146581613a8d565b6060611c74826126ac565b611c94576040516364b4f07960e11b815260048101839052602401610d42565b6000611cac600080516020615c808339815191525490565b90506001600160a01b03811615611d39576040516344a5a61760e11b8152600481018490526001600160a01b0382169063894b4c2e9060240160006040518083038186803b158015611cfd57600080fd5b505afa158015611d11573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261165c91908101906158fa565b61165c83613af7565b50919050565b6060836001600160401b03811115611d6257611d62615279565b604051908082528060200260200182016040528015611d8b578160200160208202803683370190505b50905060005b84811015611e0057611dd3868683818110611dae57611dae615751565b90506020020135858584818110611dc757611dc7615751565b90506020020135613d63565b828281518110611de557611de5615751565b6020908102919091010152611df98161577d565b9050611d91565b50949350505050565b6000610cb1611e1661327a565b600084815260209190915260409020613263565b6000611e3461321b565b6000611e3e610ff2565b81526020810191909152604001600020546001600160801b0316611e6061321b565b6000611e6a610ebe565b8152602081019190915260400160002054611e8e91906001600160801b0316615970565b6001600160801b0316905090565b611ea582610ef3565b611eaf81336125cf565b610df78383612c50565b6060611ec361278e565b6001600160a01b038216611ed5573391505b826001600160401b03811115611eed57611eed615279565b604051908082528060200260200182016040528015611f16578160200160208202803683370190505b50905060005b83811015610eb657611f46858583818110611f3957611f39615751565b9050602002013584613e67565b828281518110611f5857611f58615751565b6020908102919091010152611f6c8161577d565b9050611f1c565b828114611f9d5760405163098b37e560e31b81526004810184905260248101829052604401610d42565b60005b8381101561200b57611fe3858583818110611fbd57611fbd615751565b90506020020135848484818110611fd657611fd6615751565b9050602002013533612c9f565b611ffb33600087878581811061117a5761117a615751565b6120048161577d565b9050611fa0565b5050505050565b6001600160a01b0391821660009081527fe6a0e71d546599dab4b90490502c456cf7c806a5710690dde406c1a77d7f25e76020908152604080832093909416825291909152205460ff1690565b612067614d09565b81602001518061207657508151155b156120945760405163baf3f0f760e01b815260040160405180910390fd5b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081018290526000846060015160001415612187576120dc610ff2565b6120e79060016158e2565b92506120f161321b565b60006120fe6001866158a1565b81526020808201929092526040908101600020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a082015291506122f3565b600085604001516001876060015161219f91906158a1565b602481106121af576121af615751565b602002015190506121c18160016158e2565b93506121cb61321b565b60008281526020918252604090819020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a082015292506122ec61225761321b565b60006122646001856158a1565b81526020808201929092526040908101600020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a082015284613393565b5090925050505b60006122ff87856158e2565b9050600061230b610ebe565b6123169060016158e2565b90505b808510801561232757508185105b1561250f57600061233661321b565b60008781526020918252604090819020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b820481166060840181905260ff600160c81b84041615156080850152600160d01b9092041660a08301529091508a10156123c7575061250f565b60008060006123d68885613393565b9250925092508d83111561240757676765c793fa10079d601b1b6123fa8f83615998565b61240491906158ce565b91505b8a51821115612419575050505061250f565b818b60000181815161242b91906158a1565b90525060608b01511580159061247f57508360a0015164ffffffffff168860a0015164ffffffffff16148061246b57508d871115801561246b57508d8311155b8061247f57508d8711801561247f57508d83115b156124b557888b6040015160018d6060015161249b91906158a1565b602481106124ab576124ab615751565b60200201526124fd565b60248b6060015114156124cb575050505061250f565b888b604001518c60600151602481106124e6576124e6615751565b602002015260608b0180516124fa9061577d565b90525b50506001909601959094509250612319565b8085148061251c57508185105b15156020880152509498975050505050505050565b600080516020615ce083398151915261254a81336125cf565b610fbb82613fc3565b6000610d167f0e27eaa2e71c8572ab988fef0b54cd45bbd1740de1e22343fb6cda7536edc12f5490565b61259a8161259483600161258f61101c565b613040565b33612c9f565b61146533600083612ffa565b9055565b60006001600160e01b03198216635a05180f60e01b1480610cb15750610cb182614013565b6125d98282611663565b610fbb576125f1816001600160a01b03166014614048565b6125fc836020614048565b60405160200161260d9291906159b7565b60408051601f198184030181529082905262461bcd60e51b8252610d4291600401614df4565b61263b6141e3565b42600080516020615cc0833981519152556040517f62451d457bc659158be6e6247f56ec1df424a5c7597f71c20c2bc44e0965c8f990600090a1565b60408051602080825281830190925260609160ff84169160009180820181803683375050509182525060208101929092525090565b600080821180156126c457506126c0610ebe565b8211155b8015610cb157506126d361321b565b6000928352602052506040902060010154600160c81b900460ff161590565b7f528f2b9d45274be04589d1a9e644321ee1435a867d38a1359d022af391cf7d7590565b8161271f6126f2565b60008381526020919091526040902080546001600160a01b0319166001600160a01b0392831617905581908316612755826112bc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612796611a7e565b15610ce957604051630286f07360e31b815260040160405180910390fd5b6040516323b872dd60e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd9061280790339030908890600401615a26565b602060405180830381600087803b15801561282157600080fd5b505af1158015612835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128599190615a4a565b50604051636f074d1f60e11b8152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063de0e9a3e90602401602060405180830381600087803b1580156128bf57600080fd5b505af11580156128d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f791906157fc565b604051631920845160e01b8152600481018290529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063192084519060240160206040518083038186803b15801561295d57600080fd5b505afa158015612971573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299591906157fc565b90506129a2828286614208565b92506129b060008585612ffa565b505092915050565b6001600160a01b0382166129df57604051633a954ecd60e21b815260040160405180910390fd5b826001600160a01b0316826001600160a01b03161415612a12576040516352ce6f2160e01b815260040160405180910390fd5b801580612a255750612a22610ebe565b81115b15612a46576040516364b4f07960e11b815260048101829052602401610d42565b6000612a5061321b565b6000838152602091909152604090206001810154909150600160c81b900460ff1615612a925760405163f0e0cc2d60e01b815260048101839052602401610d42565b60018101546001600160a01b03858116911614612adb57600181015460405163c0eeaa6160e01b81526001600160a01b0380871660048301529091166024820152604401610d42565b336001600160a01b038516811480612af85750612af88582612012565b80612b2b5750806001600160a01b0316612b106126f2565b600085815260209190915260409020546001600160a01b0316145b612b4a578060405163aee697e760e01b8152600401610d429190614e20565b612b526126f2565b60008481526020919091526040902080546001600160a01b03199081169091556001830180549091166001600160a01b038616179055612bb383612b9461323f565b6001600160a01b0388166000908152602091909152604090209061448b565b612bbf57612bbf615a67565b612bea83612bcb61323f565b6001600160a01b03871660009081526020919091526040902090614497565b612bf657612bf6615a67565b61200b858585612ffa565b7f9a627a5d4aa7c17f87ff26e3fe9a42c2b6c559e8b41a42282d0ecebb17c0e4d390565b612c2f82826144a3565b610df781612c3b61327a565b6000858152602091909152604090209061451a565b612c5a828261452f565b610df781612c6661327a565b600085815260209190915260409020906145a7565b7f5ed9590a548c88ba856b4395a6a115927662fde6fc45814f1c0fa2b07869394390565b82612cc0576040516364b4f07960e11b815260048101849052602401610d42565b60405163c312238160e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c312238190612d0f903390600401614e20565b60206040518083038186803b158015612d2757600080fd5b505afa158015612d3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d5f91906157fc565b90506000612d6b61321b565b6000868152602091909152604090206001810154909150600160c81b900460ff1615612dad5760405163f0e0cc2d60e01b815260048101869052602401610d42565b60018101546001600160a01b03163314612df1576001810154604051631194af8760e11b81523360048201526001600160a01b039091166024820152604401610d42565b60018101805460ff60c81b1916600160c81b179055612e3585612e1261323f565b60018401546001600160a01b03166000908152602091909152604090209061448b565b612e4157612e41615a67565b6000612e4c8661389b565b60000151905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631540aa896040518163ffffffff1660e01b815260040160206040518083038186803b158015612ead57600080fd5b505afa158015612ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee591906157fc565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b19e84a6040518163ffffffff1660e01b815260040160206040518083038186803b158015612f4257600080fd5b505afa158015612f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f7a9190615a7d565b90506000670de0b6b3a7640000612f918486615998565b612f9b91906158ce565b9050612fa787856145bc565b6001600160a01b038716338a7f6ad26c5e238e7d002799f9a5db07e81ef14e37386ae03496d7a7ef04713e145b612fde85896158a1565b60405190815260200160405180910390a4505050505050505050565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008315806130555750613052610ebe565b84115b6130715760405162461bcd60e51b8152600401610d4290615a9a565b600061307b61101c565b9050841580613090575061308d610ebe565b85115b6130d45760405162461bcd60e51b8152602060048201526015602482015274496e76616c696452657175657374496452616e676560581b6044820152606401610d42565b8015806130e757506130e4610ff2565b85115b806130f157508284115b1561310057600091505061165c565b613108614671565b600084815260209190915260409020548510613170578083141561312f578291505061165c565b613137614671565b60006131448560016158e2565b815260200190815260200160002060000154851015613166578291505061165c565b600091505061165c565b613178614671565b6000858152602091909152604090205485101561319957600091505061165c565b8360006131a76001866158a1565b90505b8181111561321157600060026131c084846158e2565b6131cb9060016158e2565b6131d591906158ce565b9050876131e0614671565b60008381526020919091526040902054116131fd5780925061320b565b6132086001826158a1565b91505b506131aa565b5095945050505050565b7fe21b95c4eb1b99fd548b219e3b5c175a8efb31f910cb76456b20e14eba8cfe4390565b7f4b9bfe0774f05ab288bd50bd23f74ae80a797f1d0c82d419d43ebda4fdc2fe1f90565b6000610cb1825490565b6060600061165c83614695565b7f8f8c450dae5029cd48cd91dd9db65da48fb742893edfc7941250f6721d93cbbe90565b600061165c83836146f1565b6114657f6825d6bead7081b4d1ac062bbb771f0e4ade13182688453e79955a721d58c4dd829055565b816001600160a01b0316836001600160a01b031614156133065760405163b06307db60e01b815260040160405180910390fd5b6001600160a01b0383811660008181527fe6a0e71d546599dab4b90490502c456cf7c806a5710690dde406c1a77d7f25e76020908152604080832094871680845294825291829020805460ff1916861515908117909155825190815291517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319281900390910190a3505050565b81518151600091829182916133a791615970565b6001600160801b03169150846020015184602001516133c69190615970565b6001600160801b03169050806133e7676765c793fa10079d601b1b84615998565b6133f191906158ce565b92509250925092565b61340261278e565b42811015613423576040516339e2ec5360e11b815260040160405180910390fd5b60006000198214613440576134398260016158e2565b9050613445565b506000195b610fbb8161471b565b613456610ebe565b8310156134755760405162461bcd60e51b8152600401610d4290615a9a565b600061347f610ff2565b9050808411156134c75760405162461bcd60e51b8152602060048201526013602482015272496e76616c69645265717565737449642d2d2d60681b6044820152606401610d42565b60006134d161321b565b600083815260209182526040808220815160c08101835281546001600160801b038082168352600160801b9091041694810194909452600101546001600160a01b0381169184019190915264ffffffffff600160a01b82048116606085015260ff600160c81b83041615156080850152600160d01b9091041660a083015290915061355a61321b565b600087815260209182526040808220815160c08101835281546001600160801b03808216808452600160801b90920416958201959095526001909101546001600160a01b0381169282019290925264ffffffffff600160a01b83048116606083015260ff600160c81b84041615156080830152600160d01b90920490911660a0820152845190935090916135ee9190615970565b9050806001600160801b031686116136415760405162461bcd60e51b8152602060048201526016602482015275546f6f4d7563684574686572546f46696e616c697a6560501b6044820152606401610d42565b600061364e8560016158e2565b9050600061365a61101c565b9050604051806040016040528083815260200188815250613679614671565b60006136868460016158e2565b8152602080820192909252604001600020825181559101516001918201556136b8906136b39083906158e2565b6147a7565b6136d3886136c4612553565b6136ce91906158e2565b6147d0565b6040516377063bc760e01b8152600481018a905230906377063bc790602401600060405180830381600087803b15801561370c57600080fd5b505af1158015613720573d6000803e3d6000fd5b5050505088827f197874c72af6a06fb0aa4fab45fd39c7cb61ac0992159872dc3295207da7e9eb8a8860200151886020015161375c9190615970565b604080519283526001600160801b039091166020830152429082015260600160405180910390a3505050505050505050565b60006001600160a01b0384163b1561389357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906137d2903390899088908890600401615ac4565b602060405180830381600087803b1580156137ec57600080fd5b505af192505050801561381c575060408051601f3d908101601f1916820190925261381991810190615b01565b60015b613879573d80801561384a576040519150601f19603f3d011682016040523d82523d6000602084013e61384f565b606091505b50805161387157846040516309f844e360e01b8152600401610d429190614e20565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506115dc565b5060016115dc565b6138a3614cc6565b8115806138b657506138b3610ebe565b82115b156138d7576040516364b4f07960e11b815260048101839052602401610d42565b60006138e161321b565b600084815260209182526040808220815160c08101835281546001600160801b038082168352600160801b9091041694810194909452600101546001600160a01b0381169184019190915264ffffffffff600160a01b82048116606085015260ff600160c81b83041615156080850152600160d01b9091041660a083015290915061396a61321b565b60006139776001876158a1565b81526020808201929092526040908101600020815160c0808201845282546001600160801b038082168452600160801b90910416948201949094526001909101546001600160a01b0381168284015264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a08201528151928301909152805184519193508291613a149190615970565b6001600160801b0316815260200182602001518460200151613a369190615970565b6001600160801b0316815260200183604001516001600160a01b03168152602001836060015164ffffffffff168152602001613a70610ff2565b861115151581526020018360800151151581525092505050919050565b613a956147f9565b613a9f6001614928565b613aaa600082612c25565b600019600080516020615ca0833981519152557f20b34d2aaaf6acb4fbbc9c4846858bb824053ab11ff44a59dfba1e22ceb8a50981604051613aec9190614e20565b60405180910390a150565b60606000613b03612c7b565b8054613b0e906157c7565b80601f0160208091040260200160405190810160405280929190818152602001828054613b3a906157c7565b8015613b875780601f10613b5c57610100808354040283529160200191613b87565b820191906000526020600020905b815481529060010190602001808311613b6a57829003601f168201915b50505050509050805160001415613bae575050604080516020810190915260008152919050565b600081604051806040016040528060018152602001602f60f81b815250613bd486614957565b6040518060400160405280600b81526020016a3f7265717565737465643d60a81b815250613c63613c0361321b565b6000613c1060018c6158a1565b81526020810191909152604001600020546001600160801b0316613c3261321b565b60008b81526020919091526040902054613c5591906001600160801b0316615970565b6001600160801b0316614957565b6040518060400160405280600c81526020016b26637265617465645f61743d60a01b815250613cb9613c9361321b565b60008c81526020919091526040902060010154600160a01b900464ffffffffff16614957565b604051602001613ccf9796959493929190615b1e565b60405160208183030381529060405290506000613cea610ff2565b851180159150610eb657816040518060400160405280600b81526020016a2666696e616c697a65643d60a81b815250613d38613d3388613d2e8a600161258f61101c565b613d63565b614957565b604051602001613d4a93929190615bb0565b6040516020818303038152906040529150509392505050565b6000821580613d785750613d75610ebe565b83115b15613d99576040516364b4f07960e11b815260048101849052602401610d42565b613da1610ff2565b831115613db057506000610cb1565b6000613dba61321b565b6000858152602091909152604090206001810154909150600160c81b900460ff1615613dea576000915050610cb1565b6040805160c08101825282546001600160801b038082168352600160801b90910416602082015260018301546001600160a01b0381169282019290925264ffffffffff600160a01b83048116606083015260ff600160c81b84041615156080830152600160d01b90920490911660a08201526115dc908585611816565b6040516323b872dd60e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90613eba90339030908890600401615a26565b602060405180830381600087803b158015613ed457600080fd5b505af1158015613ee8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f0c9190615a4a565b50604051631920845160e01b8152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063192084519060240160206040518083038186803b158015613f7057600080fd5b505afa158015613f84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fa891906157fc565b9050613fb5848285614208565b9150611c1660008484612ffa565b613fcb61278e565b80613fe95760405163ad58bfc760e01b815260040160405180910390fd5b6000600019821415613ffe5750600019613445565b61400882426158e2565b9050610fbb8161471b565b60006001600160e01b03198216637965db0b60e01b1480610cb157506301ffc9a760e01b6001600160e01b0319831614610cb1565b60606000614057836002615998565b6140629060026158e2565b6001600160401b0381111561407957614079615279565b6040519080825280601f01601f1916602001820160405280156140a3576020820181803683370190505b509050600360fc1b816000815181106140be576140be615751565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106140ed576140ed615751565b60200101906001600160f81b031916908160001a9053506000614111846002615998565b61411c9060016158e2565b90505b6001811115614194576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061415057614150615751565b1a60f81b82828151811061416657614166615751565b60200101906001600160f81b031916908160001a90535060049490941c9361418d81615bf3565b905061411f565b50831561165c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d42565b6141eb611a7e565b610ce95760405163b047186b60e01b815260040160405180910390fd5b600080614213610ebe565b9050600061421f61321b565b600083815260209182526040808220815160c08101835281546001600160801b038082168352600160801b909104169481018590526001909101546001600160a01b0381169282019290925264ffffffffff600160a01b83048116606083015260ff600160c81b84041615156080830152600160d01b90920490911660a08201529250906142ae908790615c0a565b905060008783600001516142c29190615c0a565b90506142cf8460016158e2565b94506142da85614a54565b60006040518060c00160405280836001600160801b03168152602001846001600160801b03168152602001886001600160a01b031681526020014264ffffffffff168152602001600015158152602001614332614a7d565b64ffffffffff16905290508061434661321b565b600088815260209182526040908190208351928401516001600160801b03938416600160801b9490911693909302929092178255820151600190910180546060840151608085015160a0909501516001600160a01b039094166001600160c81b031990921691909117600160a01b64ffffffffff928316021765ffffffffffff60c81b1916600160c81b9415159490940264ffffffffff60d01b191693909317600160d01b93909216929092021790556144218661440261323f565b6001600160a01b038a1660009081526020919091526040902090614497565b61442d5761442d615a67565b604080516001600160801b03808c1682528a1660208201526001600160a01b03891691339189917ff0cb471f23fb74ea44b8252eb1881a2dca546288d9f6e90d1a0e82fe0ed342ab910160405180910390a450505050509392505050565b600061165c8383614aa7565b600061165c8383614b9a565b6144ad8282611663565b610fbb5760016144bb612c01565b6000848152602091825260408082206001600160a01b0386168084529352808220805460ff1916941515949094179093559151339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600061165c836001600160a01b038416614b9a565b6145398282611663565b15610fbb576000614548612c01565b6000848152602091825260408082206001600160a01b0386168084529352808220805460ff1916941515949094179093559151339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061165c836001600160a01b038416614aa7565b804710156145dd57604051638a0d377960e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461462a576040519150601f19603f3d011682016040523d82523d6000602084013e61462f565b606091505b5050905080610df75760405162461bcd60e51b815260206004820152600e60248201526d11985a5b1959081d1bc81cd95b9960921b6044820152606401610d42565b7f445f3cbbc114a35d080f2a1953516d74e74d5106860bc2317840ba265f03b51a90565b6060816000018054806020026020016040519081016040528092919081815260200182805480156146e557602002820191906000526020600020905b8154815260200190600101908083116146d1575b50505050509050919050565b600082600001828154811061470857614708615751565b9060005260206000200154905092915050565b614732600080516020615cc0833981519152829055565b60001981141561476e5760405160001981527f32fb7c9891bc4f963c7de9f1186d2a7755c7d6e9f4604dabe1d8bb3027c2f49e90602001613aec565b7f32fb7c9891bc4f963c7de9f1186d2a7755c7d6e9f4604dabe1d8bb3027c2f49e61479942836158a1565b604051908152602001613aec565b6114657f9d8be19d6a54e40bd767aa61b0f462241f5562ef6967d7045485bccac825b240829055565b6114657f0e27eaa2e71c8572ab988fef0b54cd45bbd1740de1e22343fb6cda7536edc12f829055565b6040805160c08101825260008082526020820181905291810182905264ffffffffff421660608201526001608082015260a081019190915261483961321b565b6000808052602091825260408082208451858501516001600160801b03918216600160801b929091169190910217815584820151600190910180546060870151608088015160a0909801516001600160a01b039094166001600160c81b031990921691909117600160a01b64ffffffffff928316021765ffffffffffff60c81b1916600160c81b9715159790970264ffffffffff60d01b191696909617600160d01b9690921695909502179093558251808401909352808352908201526148fe614671565b600061490861101c565b815260208082019290925260400160002082518155910151600190910155565b61493061160f565b1561494e5760405163184e52a160e21b815260040160405180910390fd5b61146581614be9565b60608161497b5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156149a5578061498f8161577d565b915061499e9050600a836158ce565b915061497f565b6000816001600160401b038111156149bf576149bf615279565b6040519080825280601f01601f1916602001820160405280156149e9576020820181803683370190505b5090505b84156115dc576149fe6001836158a1565b9150614a0b600a86615c35565b614a169060306158e2565b60f81b818381518110614a2b57614a2b615751565b60200101906001600160f81b031916908160001a905350614a4d600a866158ce565b94506149ed565b6114657f8ee26abbbdf533de3953ccf2204279e845eecb5ab51f8398522746e4ea068041829055565b6000610d167f6825d6bead7081b4d1ac062bbb771f0e4ade13182688453e79955a721d58c4dd5490565b60008181526001830160205260408120548015614b90576000614acb6001836158a1565b8554909150600090614adf906001906158a1565b9050818114614b44576000866000018281548110614aff57614aff615751565b9060005260206000200154905080876000018481548110614b2257614b22615751565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b5557614b55615c49565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cb1565b6000915050610cb1565b6000818152600183016020526040812054614be157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cb1565b506000610cb1565b614c127f4dd0f6662ba1d6b081f08b350f5e9a6a7b15cf586926ba66f753594928fa64a6829055565b6040518181527ffddcded6b4f4730c226821172046b48372d3cd963c159701ae1b7c3bcac541bb90602001613aec565b828054614c4e906157c7565b90600052602060002090601f016020900481019282614c705760008555614cb6565b82601f10614c895782800160ff19823516178555614cb6565b82800160010185558215614cb6579182015b82811115614cb6578235825591602001919060010190614c9b565b50614cc2929150614d35565b5090565b6040518060c00160405280600081526020016000815260200160006001600160a01b03168152602001600081526020016000151581526020016000151581525090565b6040805160808101825260008082526020820152908101614d28614d4a565b8152602001600081525090565b5b80821115614cc25760008155600101614d36565b6040518061048001604052806024906020820280368337509192915050565b6001600160e01b03198116811461146557600080fd5b600060208284031215614d9157600080fd5b813561165c81614d69565b60005b83811015614db7578181015183820152602001614d9f565b838111156117ed5750506000910152565b60008151808452614de0816020860160208601614d9c565b601f01601f19169290920160200192915050565b60208152600061165c6020830184614dc8565b600060208284031215614e1957600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b038116811461146557600080fd5b60008060408385031215614e5c57600080fd5b8235614e6781614e34565b946020939093013593505050565b60008083601f840112614e8757600080fd5b5081356001600160401b03811115614e9e57600080fd5b6020830191508360208260051b8501011115614eb957600080fd5b9250929050565b600080600060408486031215614ed557600080fd5b83356001600160401b03811115614eeb57600080fd5b614ef786828701614e75565b9094509250506020840135614f0b81614e34565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b81811015614f4e57835183529284019291840191600101614f32565b50909695505050505050565b600080600060608486031215614f6f57600080fd5b8335614f7a81614e34565b92506020840135614f8a81614e34565b929592945050506040919091013590565b60008060408385031215614fae57600080fd5b823591506020830135614fc081614e34565b809150509250929050565b60008060208385031215614fde57600080fd5b82356001600160401b0380821115614ff557600080fd5b818501915085601f83011261500957600080fd5b81358181111561501857600080fd5b86602082850101111561502a57600080fd5b60209290920196919550909350505050565b60008060008060006060868803121561505457600080fd5b85356001600160401b038082111561506b57600080fd5b61507789838a01614e75565b9097509550602088013591508082111561509057600080fd5b5061509d88828901614e75565b90945092505060408601356150b181614e34565b809150509295509295909350565b600080600080606085870312156150d557600080fd5b84356001600160401b038111156150eb57600080fd5b6150f787828801614e75565b90989097506020870135966040013595509350505050565b60006020828403121561512157600080fd5b813561165c81614e34565b60008060008084860360e081121561514357600080fd5b85356001600160401b0381111561515957600080fd5b61516588828901614e75565b909650945050602086013561517981614e34565b925060a0603f198201121561518d57600080fd5b509295919450926040019150565b600080604083850312156151ae57600080fd5b50508035926020909101359150565b801515811461146557600080fd5b6000806000606084860312156151e057600080fd5b83356151eb816151bd565b95602085013595506040909401359392505050565b6000806040838503121561521357600080fd5b823561521e81614e34565b91506020830135614fc0816151bd565b60008060006040848603121561524357600080fd5b83356001600160401b0381111561525957600080fd5b61526586828701614e75565b909790965060209590950135949350505050565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156152b1576152b1615279565b60405290565b604051608081016001600160401b03811182821017156152b1576152b1615279565b60405161048081016001600160401b03811182821017156152b1576152b1615279565b604051601f8201601f191681016001600160401b038111828210171561532457615324615279565b604052919050565b80356001600160801b038116811461534357600080fd5b919050565b803564ffffffffff8116811461534357600080fd5b600080600083850361010081121561537457600080fd5b60c081121561538257600080fd5b5061538b61528f565b6153948561532c565b81526153a26020860161532c565b602082015260408501356153b581614e34565b60408201526153c660608601615348565b606082015260808501356153d9816151bd565b60808201526153ea60a08601615348565b60a08201529560c0850135955060e0909401359392505050565b60006001600160401b0382111561541d5761541d615279565b50601f01601f191660200190565b6000806000806080858703121561544157600080fd5b843561544c81614e34565b9350602085013561545c81614e34565b92506040850135915060608501356001600160401b0381111561547e57600080fd5b8501601f8101871361548f57600080fd5b80356154a261549d82615404565b6152fc565b8181528860208385010111156154b757600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080602083850312156154ec57600080fd5b82356001600160401b0381111561550257600080fd5b61550e85828601614e75565b90969095509350505050565b602080825282518282018190526000919060409081850190868401855b82811015615592578151805185528681015187860152858101516001600160a01b0316868601526060808201519086015260808082015115159086015260a09081015115159085015260c09093019290850190600101615537565b5091979650505050505050565b600080600080604085870312156155b557600080fd5b84356001600160401b03808211156155cc57600080fd5b6155d888838901614e75565b909650945060208701359150808211156155f157600080fd5b506155fe87828801614e75565b95989497509550505050565b6000806040838503121561561d57600080fd5b823561562881614e34565b91506020830135614fc081614e34565b60008060008084860361054081121561565057600080fd5b853594506020808701359450604087013593506104e0605f198301121561567657600080fd5b61567e6152b7565b9150606087013582526080870135615695816151bd565b8282015260bf870188136156a857600080fd5b6156b06152d9565b8061052089018a8111156156c357600080fd5b60a08a015b818110156156df57803584529284019284016156c8565b50604085019190915235606084015250949793965091945090925050565b815181526020808301511515818301526040808401516104e084019291840160005b602481101561573c5782518252918301919083019060010161571f565b5050505060608301516104c083015292915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561579157615791615767565b5060010190565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600181811c908216806157db57607f821691505b60208210811415611d4257634e487b7160e01b600052602260045260246000fd5b60006020828403121561580e57600080fd5b5051919050565b6020808252600e908201526d1253959053125108105353d5539560921b604082015260600190565b60006020828403121561584f57600080fd5b813560ff8116811461165c57600080fd5b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6000828210156158b3576158b3615767565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826158dd576158dd6158b8565b500490565b600082198211156158f5576158f5615767565b500190565b60006020828403121561590c57600080fd5b81516001600160401b0381111561592257600080fd5b8201601f8101841361593357600080fd5b805161594161549d82615404565b81815285602083850101111561595657600080fd5b615967826020830160208601614d9c565b95945050505050565b60006001600160801b038381169083168181101561599057615990615767565b039392505050565b60008160001904831182151516156159b2576159b2615767565b500290565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516159e9816017850160208801614d9c565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a1a816028840160208801614d9c565b01602801949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215615a5c57600080fd5b815161165c816151bd565b634e487b7160e01b600052600160045260246000fd5b600060208284031215615a8f57600080fd5b815161165c81614e34565b60208082526010908201526f125b9d985b1a5914995c5d595cdd125960821b604082015260600190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615af790830184614dc8565b9695505050505050565b600060208284031215615b1357600080fd5b815161165c81614d69565b600088516020615b318285838e01614d9c565b895191840191615b448184848e01614d9c565b8951920191615b568184848d01614d9c565b8851920191615b688184848c01614d9c565b8751920191615b7a8184848b01614d9c565b8651920191615b8c8184848a01614d9c565b8551920191615b9e8184848901614d9c565b919091019a9950505050505050505050565b60008451615bc2818460208901614d9c565b845190830190615bd6818360208901614d9c565b8451910190615be9818360208801614d9c565b0195945050505050565b600081615c0257615c02615767565b506000190190565b60006001600160801b03828116848216808303821115615c2c57615c2c615767565b01949350505050565b600082615c4457615c446158b8565b500690565b634e487b7160e01b600052603160045260246000fdfebe882725f03f148e7c5a5e63ec45f182f7dcdb6bb8b92311ade5a6d138e0ee0f2a81836f39b1062c2144ef0b520c964f50c3af430524cc6f585ff0aa7dd48c721450eb8d0693284079f6627b2c1c6bb2e076066e44df1b18ba6ea7cc507e9bcbe8b012900cb200ee5dfc3b895a32791b67d12891b09f117814f167a237783a02139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46da26469706673582212202f643e18e9f2f9427c1a3f18c2655c8f785325f33ba0d2a3e2dce3d99fe6e9ed64736f6c634300080900330000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d63000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b64000000000000000000000000000000000000000000000000000000000000001a4c69646f3a207374455448205769746864726177616c204e46540000000000000000000000000000000000000000000000000000000000000000000000000007756e737445544800000000000000000000000000000000000000000000000000
Deployed ByteCode
0x6080604052600436106103945760003560e01c806392b18a47116101de578063c4d66de811610103578063db2296cd1161009b578063db2296cd14610b41578063e00bfe5014610b60578063e3afe0a314610b94578063e7c0835d146108a5578063e985e9c514610bb4578063eed53bf514610bd4578063f3f449c714610c01578063f6fa8a4714610c21578063f844443614610c3657600080fd5b8063c4d66de814610a22578063c87b56dd14610a42578063c97912d814610a62578063ca15c87314610a82578063d030205114610aa2578063d0fb84e814610ab8578063d547741f14610acd578063d668104214610aed578063d9fb643a14610b0d57600080fd5b8063abe9cfc811610176578063abe9cfc814610916578063acf41e4d14610936578063b187bd2614610956578063b6013cef1461096b578063b7bdf7481461097e578063b88d4fde146109a0578063b8c4b85a146109c0578063c1c5dd27146109ed578063c2fc7aff14610a0d57600080fd5b806392b18a471461080657806395d89b411461082657806396992fed1461083b5780639b36be581461085b578063a217fddf14610870578063a22cb46514610885578063a302ee38146108a5578063a52e9c9f146108bb578063a7bec815146108f657600080fd5b8063389ed267116102c45780636352211e1161025c5780636352211e146106fc57806370a082311461071c578063714c53981461073c57806377063bc7146107515780637951b76f146107715780637d031b65146107915780638aa10435146107b15780639010d07c146107c657806391d14854146107e657600080fd5b8063389ed2671461060657806342842e0e1461062857806346a086b4146106485780634f069a131461065d578063526eae3e1461067257806355f804b314610687578063589ff76c146106a75780635e7eead9146106bc57806362abe3fa146106dc57600080fd5b806319c2b4c31161033757806319c2b4c3146104df578063220ca2f4146104f457806323b872dd14610528578063248a9ca31461054857806329fd065d146105685780632b95b7811461057d5780632de03aa1146105925780632f2ff15d146105c657806336568abe146105e657600080fd5b806301ffc9a7146103a0578063046f7da2146103d557806306fdde03146103ec57806307e2cea51461040e578063081812fc14610450578063095ea7b31461047d5780630d25a9571461049d57806319aa6257146104b257600080fd5b3661039b57005b600080fd5b3480156103ac57600080fd5b506103c06103bb366004614d7f565b610c56565b60405190151581526020015b60405180910390f35b3480156103e157600080fd5b506103ea610cb7565b005b3480156103f857600080fd5b50610401610ceb565b6040516103cc9190614df4565b34801561041a57600080fd5b506104427f68e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef181565b6040519081526020016103cc565b34801561045c57600080fd5b5061047061046b366004614e07565b610d1b565b6040516103cc9190614e20565b34801561048957600080fd5b506103ea610498366004614e49565b610d6d565b3480156104a957600080fd5b50610442606481565b3480156104be57600080fd5b506104d26104cd366004614ec0565b610dfc565b6040516103cc9190614f16565b3480156104eb57600080fd5b50610442610ebe565b34801561050057600080fd5b506104427f485191a2ef18512555bd4426d18a716ce8e98c80ec2de16394dcf86d7d91bc8081565b34801561053457600080fd5b506103ea610543366004614f5a565b610ee8565b34801561055457600080fd5b50610442610563366004614e07565b610ef3565b34801561057457600080fd5b50610442602481565b34801561058957600080fd5b506103c0610f11565b34801561059e57600080fd5b506104427f2fc10cc8ae19568712f7a176fb4978616a610650813c9d05326c34abb62749c781565b3480156105d257600080fd5b506103ea6105e1366004614f9b565b610f24565b3480156105f257600080fd5b506103ea610601366004614f9b565b610f41565b34801561061257600080fd5b50610442600080516020615ce083398151915281565b34801561063457600080fd5b506103ea610643366004614f5a565b610fbf565b34801561065457600080fd5b50610470610fda565b34801561066957600080fd5b50610442610ff2565b34801561067e57600080fd5b5061044261101c565b34801561069357600080fd5b506103ea6106a2366004614fcb565b611046565b3480156106b357600080fd5b506104426110b3565b3480156106c857600080fd5b506103ea6106d736600461503c565b6110cb565b3480156106e857600080fd5b506104d26106f73660046150bf565b61119e565b34801561070857600080fd5b50610470610717366004614e07565b6112bc565b34801561072857600080fd5b5061044261073736600461510f565b611351565b34801561074857600080fd5b506104016113a4565b34801561075d57600080fd5b506103ea61076c366004614e07565b61143c565b34801561077d57600080fd5b506104d261078c36600461512c565b611468565b34801561079d57600080fd5b506104d26107ac36600461510f565b6115e4565b3480156107bd57600080fd5b5061044261160f565b3480156107d257600080fd5b506104706107e136600461519b565b611639565b3480156107f257600080fd5b506103c0610801366004614f9b565b611663565b34801561081257600080fd5b506103ea61082136600461510f565b611697565b34801561083257600080fd5b50610401611702565b34801561084757600080fd5b506103ea6108563660046151cb565b61172d565b34801561086757600080fd5b506104426117f3565b34801561087c57600080fd5b50610442600081565b34801561089157600080fd5b506103ea6108a0366004615200565b61180b565b3480156108b157600080fd5b5061044260001981565b3480156108c757600080fd5b506108e16108d636600461522e565b506000928392509050565b604080519283526020830191909152016103cc565b34801561090257600080fd5b5061044261091136600461535d565b611816565b34801561092257600080fd5b506103ea610931366004614e07565b6118eb565b34801561094257600080fd5b506104d261095136600461512c565b61190d565b34801561096257600080fd5b506103c0611a7e565b6103ea61097936600461519b565b611a9d565b34801561098a57600080fd5b50610442600080516020615c6083398151915281565b3480156109ac57600080fd5b506103ea6109bb36600461542b565b611b30565b3480156109cc57600080fd5b506109e06109db3660046154d9565b611b66565b6040516103cc919061551a565b3480156109f957600080fd5b506103ea610a08366004614e07565b600055565b348015610a1957600080fd5b50610442611c1d565b348015610a2e57600080fd5b506103ea610a3d36600461510f565b611c39565b348015610a4e57600080fd5b50610401610a5d366004614e07565b611c69565b348015610a6e57600080fd5b506104d2610a7d36600461559f565b611d48565b348015610a8e57600080fd5b50610442610a9d366004614e07565b611e09565b348015610aae57600080fd5b5061044260005481565b348015610ac457600080fd5b50610442611e2a565b348015610ad957600080fd5b506103ea610ae8366004614f9b565b611e9c565b348015610af957600080fd5b506104d2610b08366004614ec0565b611eb9565b348015610b1957600080fd5b506104707f0000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d6381565b348015610b4d57600080fd5b50610442676765c793fa10079d601b1b81565b348015610b6c57600080fd5b506104707f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b6481565b348015610ba057600080fd5b506103ea610baf36600461559f565b611f73565b348015610bc057600080fd5b506103c0610bcf36600461560a565b612012565b348015610be057600080fd5b50610bf4610bef366004615638565b61205f565b6040516103cc91906156fd565b348015610c0d57600080fd5b506103ea610c1c366004614e07565b612531565b348015610c2d57600080fd5b50610442612553565b348015610c4257600080fd5b506103ea610c51366004614e07565b61257d565b60006001600160e01b031982166380ac58cd60e01b1480610c8757506001600160e01b03198216635b5e139f60e01b145b80610ca257506001600160e01b03198216632483248360e11b145b80610cb15750610cb1826125aa565b92915050565b610ce17f2fc10cc8ae19568712f7a176fb4978616a610650813c9d05326c34abb62749c7336125cf565b610ce9612633565b565b6060610d167f4c69646f3a207374455448205769746864726177616c204e465400000000001a612677565b905090565b6000610d26826126ac565b610d4b576040516364b4f07960e11b8152600481018390526024015b60405180910390fd5b610d536126f2565b60009283526020525060409020546001600160a01b031690565b6000610d78826112bc565b9050806001600160a01b0316836001600160a01b03161415610dad576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b03821614801590610dcd5750610dcb8133612012565b155b15610ded573360405163106abbeb60e21b8152600401610d429190614e20565b610df78383612716565b505050565b6060610e0661278e565b6001600160a01b038216610e18573391505b826001600160401b03811115610e3057610e30615279565b604051908082528060200260200182016040528015610e59578160200160208202803683370190505b50905060005b83811015610eb657610e89858583818110610e7c57610e7c615751565b90506020020135846127b4565b828281518110610e9b57610e9b615751565b6020908102919091010152610eaf8161577d565b9050610e5f565b509392505050565b6000610d167f8ee26abbbdf533de3953ccf2204279e845eecb5ab51f8398522746e4ea0680415490565b610df78383836129b8565b6000610efd612c01565b600092835260205250604090206001015490565b6000600019610f1e6117f3565b10905090565b610f2d82610ef3565b610f3781336125cf565b610df78383612c25565b6001600160a01b0381163314610fb15760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610d42565b610fbb8282612c50565b5050565b610df783838360405180602001604052806000815250611b30565b6000610d16600080516020615c808339815191525490565b6000610d167f992f2e0c24ce59a21f2dab8bba13b25c2f872129df7f4d45372155e717db0c485490565b6000610d167f9d8be19d6a54e40bd767aa61b0f462241f5562ef6967d7045485bccac825b2405490565b600080516020615c6083398151915261105f81336125cf565b8282611069612c7b565b611074929091614c42565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f683836040516110a6929190615798565b60405180910390a1505050565b6000610d16600080516020615cc08339815191525490565b6001600160a01b0381166110f25760405163d27b444360e01b815260040160405180910390fd5b83821461111c5760405163098b37e560e31b81526004810185905260248101839052604401610d42565b60005b848110156111965761116286868381811061113c5761113c615751565b9050602002013585858481811061115557611155615751565b9050602002013584612c9f565b61118633600088888581811061117a5761117a615751565b90506020020135612ffa565b61118f8161577d565b905061111f565b505050505050565b6060836001600160401b038111156111b8576111b8615279565b6040519080825280602002602001820160405280156111e1578160200160208202803683370190505b5090506000805b858110156112b2578187878381811061120357611203615751565b9050602002013510156112295760405163374e8bd160e01b815260040160405180910390fd5b61124c87878381811061123e5761123e615751565b905060200201358686613040565b83828151811061125e5761125e615751565b60200260200101818152505082818151811061127c5761127c615751565b6020026020010151945086868281811061129857611298615751565b905060200201359150806112ab9061577d565b90506111e8565b5050949350505050565b60008115806112d157506112ce610ebe565b82115b156112f2576040516364b4f07960e11b815260048101839052602401610d42565b60006112fc61321b565b6000848152602091909152604090206001810154909150600160c81b900460ff161561133e5760405163f0e0cc2d60e01b815260048101849052602401610d42565b600101546001600160a01b031692915050565b60006001600160a01b03821661137b578160405162793e5560e21b8152600401610d429190614e20565b610cb161138661323f565b6001600160a01b038416600090815260209190915260409020613263565b60606113ae612c7b565b80546113b9906157c7565b80601f01602080910402602001604051908101604052809291908181526020018280546113e5906157c7565b80156114325780601f1061140757610100808354040283529160200191611432565b820191906000526020600020905b81548152906001019060200180831161141557829003601f168201915b5050505050905090565b6114657f992f2e0c24ce59a21f2dab8bba13b25c2f872129df7f4d45372155e717db0c48829055565b50565b6040516370a0823160e01b81526060908235906001600160a01b037f0000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d6316906370a08231906114ba908790600401614e20565b60206040518083038186803b1580156114d257600080fd5b505afa1580156114e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150a91906157fc565b10156115285760405162461bcd60e51b8152600401610d4290615815565b6001600160a01b037f0000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d631663d505accf3330853560208701356115706060890160408a0161583d565b886060013589608001356040518863ffffffff1660e01b815260040161159c9796959493929190615860565b600060405180830381600087803b1580156115b657600080fd5b505af11580156115ca573d6000803e3d6000fd5b505050506115d9858585610dfc565b90505b949350505050565b6060610cb16115f161323f565b6001600160a01b03841660009081526020919091526040902061326d565b6000610d167f4dd0f6662ba1d6b081f08b350f5e9a6a7b15cf586926ba66f753594928fa64a65490565b600061165c8261164761327a565b6000868152602091909152604090209061329e565b9392505050565b600061166d612c01565b6000938452602090815260408085206001600160a01b039490941685529290525090205460ff1690565b600080516020615c608339815191526116b081336125cf565b6116c7600080516020615c80833981519152839055565b7f4ec04ac71c49eea0a94dc5967b493412a8cdb2934b367713019d3b110e9f0ba8826040516116f69190614e20565b60405180910390a15050565b6060610d167f756e737445544800000000000000000000000000000000000000000000000007612677565b6117577f68e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef1336125cf565b428210611777576040516334819c0360e01b815260040160405180910390fd5b428110611797576040516334819c0360e01b815260040160405180910390fd5b6117a0816132aa565b60006117aa610f11565b9050801515841515146117ed5783156117d9576117d4600080516020615ca0833981519152849055565b6117ed565b600019600080516020615ca0833981519152555b50505050565b6000610d16600080516020615ca08339815191525490565b610fbb3383836132d3565b60008061182161321b565b600061182e6001876158a1565b815260208082019290925260409081016000908120825160c08101845281546001600160801b038082168352600160801b9091041694810194909452600101546001600160a01b0381169284019290925264ffffffffff600160a01b83048116606085015260ff600160c81b84041615156080850152600160d01b90920490911660a083015290915080806118c38489613393565b919450925090506118df676765c793fa10079d601b1b826158ce565b98975050505050505050565b600080516020615ce083398151915261190481336125cf565b610fbb826133fa565b6040516370a0823160e01b81526060908235906001600160a01b037f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b6416906370a082319061195f908790600401614e20565b60206040518083038186803b15801561197757600080fd5b505afa15801561198b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119af91906157fc565b10156119cd5760405162461bcd60e51b8152600401610d4290615815565b6001600160a01b037f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b641663d505accf333085356020870135611a156060890160408a0161583d565b886060013589608001356040518863ffffffff1660e01b8152600401611a419796959493929190615860565b600060405180830381600087803b158015611a5b57600080fd5b505af1158015611a6f573d6000803e3d6000fd5b505050506115d9858585611eb9565b6000611a96600080516020615cc08339815191525490565b4210905090565b611aa561278e565b611acf7f485191a2ef18512555bd4426d18a716ce8e98c80ec2de16394dcf86d7d91bc80336125cf565b6000611ad9610ff2565b611ae49060016158e2565b9050611af183348461344e565b7f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c81611b1b610ebe565b604080519283526020830191909152016110a6565b611b3b8484846129b8565b611b478484848461378e565b6117ed57826040516309f844e360e01b8152600401610d429190614e20565b6060816001600160401b03811115611b8057611b80615279565b604051908082528060200260200182016040528015611bb957816020015b611ba6614cc6565b815260200190600190039081611b9e5790505b50905060005b82811015611c1657611be8848483818110611bdc57611bdc615751565b9050602002013561389b565b828281518110611bfa57611bfa615751565b602002602001018190525080611c0f9061577d565b9050611bbf565b5092915050565b6000611c27610ff2565b611c2f610ebe565b610d1691906158a1565b6001600160a01b038116611c605760405163016b8ae160e11b815260040160405180910390fd5b61146581613a8d565b6060611c74826126ac565b611c94576040516364b4f07960e11b815260048101839052602401610d42565b6000611cac600080516020615c808339815191525490565b90506001600160a01b03811615611d39576040516344a5a61760e11b8152600481018490526001600160a01b0382169063894b4c2e9060240160006040518083038186803b158015611cfd57600080fd5b505afa158015611d11573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261165c91908101906158fa565b61165c83613af7565b50919050565b6060836001600160401b03811115611d6257611d62615279565b604051908082528060200260200182016040528015611d8b578160200160208202803683370190505b50905060005b84811015611e0057611dd3868683818110611dae57611dae615751565b90506020020135858584818110611dc757611dc7615751565b90506020020135613d63565b828281518110611de557611de5615751565b6020908102919091010152611df98161577d565b9050611d91565b50949350505050565b6000610cb1611e1661327a565b600084815260209190915260409020613263565b6000611e3461321b565b6000611e3e610ff2565b81526020810191909152604001600020546001600160801b0316611e6061321b565b6000611e6a610ebe565b8152602081019190915260400160002054611e8e91906001600160801b0316615970565b6001600160801b0316905090565b611ea582610ef3565b611eaf81336125cf565b610df78383612c50565b6060611ec361278e565b6001600160a01b038216611ed5573391505b826001600160401b03811115611eed57611eed615279565b604051908082528060200260200182016040528015611f16578160200160208202803683370190505b50905060005b83811015610eb657611f46858583818110611f3957611f39615751565b9050602002013584613e67565b828281518110611f5857611f58615751565b6020908102919091010152611f6c8161577d565b9050611f1c565b828114611f9d5760405163098b37e560e31b81526004810184905260248101829052604401610d42565b60005b8381101561200b57611fe3858583818110611fbd57611fbd615751565b90506020020135848484818110611fd657611fd6615751565b9050602002013533612c9f565b611ffb33600087878581811061117a5761117a615751565b6120048161577d565b9050611fa0565b5050505050565b6001600160a01b0391821660009081527fe6a0e71d546599dab4b90490502c456cf7c806a5710690dde406c1a77d7f25e76020908152604080832093909416825291909152205460ff1690565b612067614d09565b81602001518061207657508151155b156120945760405163baf3f0f760e01b815260040160405180910390fd5b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081018290526000846060015160001415612187576120dc610ff2565b6120e79060016158e2565b92506120f161321b565b60006120fe6001866158a1565b81526020808201929092526040908101600020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a082015291506122f3565b600085604001516001876060015161219f91906158a1565b602481106121af576121af615751565b602002015190506121c18160016158e2565b93506121cb61321b565b60008281526020918252604090819020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a082015292506122ec61225761321b565b60006122646001856158a1565b81526020808201929092526040908101600020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a082015284613393565b5090925050505b60006122ff87856158e2565b9050600061230b610ebe565b6123169060016158e2565b90505b808510801561232757508185105b1561250f57600061233661321b565b60008781526020918252604090819020815160c08101835281546001600160801b038082168352600160801b9091041693810193909352600101546001600160a01b0381169183019190915264ffffffffff600160a01b820481166060840181905260ff600160c81b84041615156080850152600160d01b9092041660a08301529091508a10156123c7575061250f565b60008060006123d68885613393565b9250925092508d83111561240757676765c793fa10079d601b1b6123fa8f83615998565b61240491906158ce565b91505b8a51821115612419575050505061250f565b818b60000181815161242b91906158a1565b90525060608b01511580159061247f57508360a0015164ffffffffff168860a0015164ffffffffff16148061246b57508d871115801561246b57508d8311155b8061247f57508d8711801561247f57508d83115b156124b557888b6040015160018d6060015161249b91906158a1565b602481106124ab576124ab615751565b60200201526124fd565b60248b6060015114156124cb575050505061250f565b888b604001518c60600151602481106124e6576124e6615751565b602002015260608b0180516124fa9061577d565b90525b50506001909601959094509250612319565b8085148061251c57508185105b15156020880152509498975050505050505050565b600080516020615ce083398151915261254a81336125cf565b610fbb82613fc3565b6000610d167f0e27eaa2e71c8572ab988fef0b54cd45bbd1740de1e22343fb6cda7536edc12f5490565b61259a8161259483600161258f61101c565b613040565b33612c9f565b61146533600083612ffa565b9055565b60006001600160e01b03198216635a05180f60e01b1480610cb15750610cb182614013565b6125d98282611663565b610fbb576125f1816001600160a01b03166014614048565b6125fc836020614048565b60405160200161260d9291906159b7565b60408051601f198184030181529082905262461bcd60e51b8252610d4291600401614df4565b61263b6141e3565b42600080516020615cc0833981519152556040517f62451d457bc659158be6e6247f56ec1df424a5c7597f71c20c2bc44e0965c8f990600090a1565b60408051602080825281830190925260609160ff84169160009180820181803683375050509182525060208101929092525090565b600080821180156126c457506126c0610ebe565b8211155b8015610cb157506126d361321b565b6000928352602052506040902060010154600160c81b900460ff161590565b7f528f2b9d45274be04589d1a9e644321ee1435a867d38a1359d022af391cf7d7590565b8161271f6126f2565b60008381526020919091526040902080546001600160a01b0319166001600160a01b0392831617905581908316612755826112bc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612796611a7e565b15610ce957604051630286f07360e31b815260040160405180910390fd5b6040516323b872dd60e01b81526000906001600160a01b037f0000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d6316906323b872dd9061280790339030908890600401615a26565b602060405180830381600087803b15801561282157600080fd5b505af1158015612835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128599190615a4a565b50604051636f074d1f60e11b8152600481018490526000907f0000000000000000000000005d7ee80d917e4592f9de217e2878d08132678d636001600160a01b03169063de0e9a3e90602401602060405180830381600087803b1580156128bf57600080fd5b505af11580156128d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f791906157fc565b604051631920845160e01b8152600481018290529091506000906001600160a01b037f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b64169063192084519060240160206040518083038186803b15801561295d57600080fd5b505afa158015612971573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299591906157fc565b90506129a2828286614208565b92506129b060008585612ffa565b505092915050565b6001600160a01b0382166129df57604051633a954ecd60e21b815260040160405180910390fd5b826001600160a01b0316826001600160a01b03161415612a12576040516352ce6f2160e01b815260040160405180910390fd5b801580612a255750612a22610ebe565b81115b15612a46576040516364b4f07960e11b815260048101829052602401610d42565b6000612a5061321b565b6000838152602091909152604090206001810154909150600160c81b900460ff1615612a925760405163f0e0cc2d60e01b815260048101839052602401610d42565b60018101546001600160a01b03858116911614612adb57600181015460405163c0eeaa6160e01b81526001600160a01b0380871660048301529091166024820152604401610d42565b336001600160a01b038516811480612af85750612af88582612012565b80612b2b5750806001600160a01b0316612b106126f2565b600085815260209190915260409020546001600160a01b0316145b612b4a578060405163aee697e760e01b8152600401610d429190614e20565b612b526126f2565b60008481526020919091526040902080546001600160a01b03199081169091556001830180549091166001600160a01b038616179055612bb383612b9461323f565b6001600160a01b0388166000908152602091909152604090209061448b565b612bbf57612bbf615a67565b612bea83612bcb61323f565b6001600160a01b03871660009081526020919091526040902090614497565b612bf657612bf6615a67565b61200b858585612ffa565b7f9a627a5d4aa7c17f87ff26e3fe9a42c2b6c559e8b41a42282d0ecebb17c0e4d390565b612c2f82826144a3565b610df781612c3b61327a565b6000858152602091909152604090209061451a565b612c5a828261452f565b610df781612c6661327a565b600085815260209190915260409020906145a7565b7f5ed9590a548c88ba856b4395a6a115927662fde6fc45814f1c0fa2b07869394390565b82612cc0576040516364b4f07960e11b815260048101849052602401610d42565b60405163c312238160e01b81526000906001600160a01b037f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b64169063c312238190612d0f903390600401614e20565b60206040518083038186803b158015612d2757600080fd5b505afa158015612d3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d5f91906157fc565b90506000612d6b61321b565b6000868152602091909152604090206001810154909150600160c81b900460ff1615612dad5760405163f0e0cc2d60e01b815260048101869052602401610d42565b60018101546001600160a01b03163314612df1576001810154604051631194af8760e11b81523360048201526001600160a01b039091166024820152604401610d42565b60018101805460ff60c81b1916600160c81b179055612e3585612e1261323f565b60018401546001600160a01b03166000908152602091909152604090209061448b565b612e4157612e41615a67565b6000612e4c8661389b565b60000151905060007f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b646001600160a01b0316631540aa896040518163ffffffff1660e01b815260040160206040518083038186803b158015612ead57600080fd5b505afa158015612ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee591906157fc565b905060007f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b646001600160a01b0316633b19e84a6040518163ffffffff1660e01b815260040160206040518083038186803b158015612f4257600080fd5b505afa158015612f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f7a9190615a7d565b90506000670de0b6b3a7640000612f918486615998565b612f9b91906158ce565b9050612fa787856145bc565b6001600160a01b038716338a7f6ad26c5e238e7d002799f9a5db07e81ef14e37386ae03496d7a7ef04713e145b612fde85896158a1565b60405190815260200160405180910390a4505050505050505050565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008315806130555750613052610ebe565b84115b6130715760405162461bcd60e51b8152600401610d4290615a9a565b600061307b61101c565b9050841580613090575061308d610ebe565b85115b6130d45760405162461bcd60e51b8152602060048201526015602482015274496e76616c696452657175657374496452616e676560581b6044820152606401610d42565b8015806130e757506130e4610ff2565b85115b806130f157508284115b1561310057600091505061165c565b613108614671565b600084815260209190915260409020548510613170578083141561312f578291505061165c565b613137614671565b60006131448560016158e2565b815260200190815260200160002060000154851015613166578291505061165c565b600091505061165c565b613178614671565b6000858152602091909152604090205485101561319957600091505061165c565b8360006131a76001866158a1565b90505b8181111561321157600060026131c084846158e2565b6131cb9060016158e2565b6131d591906158ce565b9050876131e0614671565b60008381526020919091526040902054116131fd5780925061320b565b6132086001826158a1565b91505b506131aa565b5095945050505050565b7fe21b95c4eb1b99fd548b219e3b5c175a8efb31f910cb76456b20e14eba8cfe4390565b7f4b9bfe0774f05ab288bd50bd23f74ae80a797f1d0c82d419d43ebda4fdc2fe1f90565b6000610cb1825490565b6060600061165c83614695565b7f8f8c450dae5029cd48cd91dd9db65da48fb742893edfc7941250f6721d93cbbe90565b600061165c83836146f1565b6114657f6825d6bead7081b4d1ac062bbb771f0e4ade13182688453e79955a721d58c4dd829055565b816001600160a01b0316836001600160a01b031614156133065760405163b06307db60e01b815260040160405180910390fd5b6001600160a01b0383811660008181527fe6a0e71d546599dab4b90490502c456cf7c806a5710690dde406c1a77d7f25e76020908152604080832094871680845294825291829020805460ff1916861515908117909155825190815291517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319281900390910190a3505050565b81518151600091829182916133a791615970565b6001600160801b03169150846020015184602001516133c69190615970565b6001600160801b03169050806133e7676765c793fa10079d601b1b84615998565b6133f191906158ce565b92509250925092565b61340261278e565b42811015613423576040516339e2ec5360e11b815260040160405180910390fd5b60006000198214613440576134398260016158e2565b9050613445565b506000195b610fbb8161471b565b613456610ebe565b8310156134755760405162461bcd60e51b8152600401610d4290615a9a565b600061347f610ff2565b9050808411156134c75760405162461bcd60e51b8152602060048201526013602482015272496e76616c69645265717565737449642d2d2d60681b6044820152606401610d42565b60006134d161321b565b600083815260209182526040808220815160c08101835281546001600160801b038082168352600160801b9091041694810194909452600101546001600160a01b0381169184019190915264ffffffffff600160a01b82048116606085015260ff600160c81b83041615156080850152600160d01b9091041660a083015290915061355a61321b565b600087815260209182526040808220815160c08101835281546001600160801b03808216808452600160801b90920416958201959095526001909101546001600160a01b0381169282019290925264ffffffffff600160a01b83048116606083015260ff600160c81b84041615156080830152600160d01b90920490911660a0820152845190935090916135ee9190615970565b9050806001600160801b031686116136415760405162461bcd60e51b8152602060048201526016602482015275546f6f4d7563684574686572546f46696e616c697a6560501b6044820152606401610d42565b600061364e8560016158e2565b9050600061365a61101c565b9050604051806040016040528083815260200188815250613679614671565b60006136868460016158e2565b8152602080820192909252604001600020825181559101516001918201556136b8906136b39083906158e2565b6147a7565b6136d3886136c4612553565b6136ce91906158e2565b6147d0565b6040516377063bc760e01b8152600481018a905230906377063bc790602401600060405180830381600087803b15801561370c57600080fd5b505af1158015613720573d6000803e3d6000fd5b5050505088827f197874c72af6a06fb0aa4fab45fd39c7cb61ac0992159872dc3295207da7e9eb8a8860200151886020015161375c9190615970565b604080519283526001600160801b039091166020830152429082015260600160405180910390a3505050505050505050565b60006001600160a01b0384163b1561389357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906137d2903390899088908890600401615ac4565b602060405180830381600087803b1580156137ec57600080fd5b505af192505050801561381c575060408051601f3d908101601f1916820190925261381991810190615b01565b60015b613879573d80801561384a576040519150601f19603f3d011682016040523d82523d6000602084013e61384f565b606091505b50805161387157846040516309f844e360e01b8152600401610d429190614e20565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506115dc565b5060016115dc565b6138a3614cc6565b8115806138b657506138b3610ebe565b82115b156138d7576040516364b4f07960e11b815260048101839052602401610d42565b60006138e161321b565b600084815260209182526040808220815160c08101835281546001600160801b038082168352600160801b9091041694810194909452600101546001600160a01b0381169184019190915264ffffffffff600160a01b82048116606085015260ff600160c81b83041615156080850152600160d01b9091041660a083015290915061396a61321b565b60006139776001876158a1565b81526020808201929092526040908101600020815160c0808201845282546001600160801b038082168452600160801b90910416948201949094526001909101546001600160a01b0381168284015264ffffffffff600160a01b82048116606084015260ff600160c81b83041615156080840152600160d01b9091041660a08201528151928301909152805184519193508291613a149190615970565b6001600160801b0316815260200182602001518460200151613a369190615970565b6001600160801b0316815260200183604001516001600160a01b03168152602001836060015164ffffffffff168152602001613a70610ff2565b861115151581526020018360800151151581525092505050919050565b613a956147f9565b613a9f6001614928565b613aaa600082612c25565b600019600080516020615ca0833981519152557f20b34d2aaaf6acb4fbbc9c4846858bb824053ab11ff44a59dfba1e22ceb8a50981604051613aec9190614e20565b60405180910390a150565b60606000613b03612c7b565b8054613b0e906157c7565b80601f0160208091040260200160405190810160405280929190818152602001828054613b3a906157c7565b8015613b875780601f10613b5c57610100808354040283529160200191613b87565b820191906000526020600020905b815481529060010190602001808311613b6a57829003601f168201915b50505050509050805160001415613bae575050604080516020810190915260008152919050565b600081604051806040016040528060018152602001602f60f81b815250613bd486614957565b6040518060400160405280600b81526020016a3f7265717565737465643d60a81b815250613c63613c0361321b565b6000613c1060018c6158a1565b81526020810191909152604001600020546001600160801b0316613c3261321b565b60008b81526020919091526040902054613c5591906001600160801b0316615970565b6001600160801b0316614957565b6040518060400160405280600c81526020016b26637265617465645f61743d60a01b815250613cb9613c9361321b565b60008c81526020919091526040902060010154600160a01b900464ffffffffff16614957565b604051602001613ccf9796959493929190615b1e565b60405160208183030381529060405290506000613cea610ff2565b851180159150610eb657816040518060400160405280600b81526020016a2666696e616c697a65643d60a81b815250613d38613d3388613d2e8a600161258f61101c565b613d63565b614957565b604051602001613d4a93929190615bb0565b6040516020818303038152906040529150509392505050565b6000821580613d785750613d75610ebe565b83115b15613d99576040516364b4f07960e11b815260048101849052602401610d42565b613da1610ff2565b831115613db057506000610cb1565b6000613dba61321b565b6000858152602091909152604090206001810154909150600160c81b900460ff1615613dea576000915050610cb1565b6040805160c08101825282546001600160801b038082168352600160801b90910416602082015260018301546001600160a01b0381169282019290925264ffffffffff600160a01b83048116606083015260ff600160c81b84041615156080830152600160d01b90920490911660a08201526115dc908585611816565b6040516323b872dd60e01b81526000906001600160a01b037f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b6416906323b872dd90613eba90339030908890600401615a26565b602060405180830381600087803b158015613ed457600080fd5b505af1158015613ee8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f0c9190615a4a565b50604051631920845160e01b8152600481018490526000907f00000000000000000000000030f2ea599708fe0725bb9a35a4294a3fb39a5b646001600160a01b03169063192084519060240160206040518083038186803b158015613f7057600080fd5b505afa158015613f84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fa891906157fc565b9050613fb5848285614208565b9150611c1660008484612ffa565b613fcb61278e565b80613fe95760405163ad58bfc760e01b815260040160405180910390fd5b6000600019821415613ffe5750600019613445565b61400882426158e2565b9050610fbb8161471b565b60006001600160e01b03198216637965db0b60e01b1480610cb157506301ffc9a760e01b6001600160e01b0319831614610cb1565b60606000614057836002615998565b6140629060026158e2565b6001600160401b0381111561407957614079615279565b6040519080825280601f01601f1916602001820160405280156140a3576020820181803683370190505b509050600360fc1b816000815181106140be576140be615751565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106140ed576140ed615751565b60200101906001600160f81b031916908160001a9053506000614111846002615998565b61411c9060016158e2565b90505b6001811115614194576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061415057614150615751565b1a60f81b82828151811061416657614166615751565b60200101906001600160f81b031916908160001a90535060049490941c9361418d81615bf3565b905061411f565b50831561165c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d42565b6141eb611a7e565b610ce95760405163b047186b60e01b815260040160405180910390fd5b600080614213610ebe565b9050600061421f61321b565b600083815260209182526040808220815160c08101835281546001600160801b038082168352600160801b909104169481018590526001909101546001600160a01b0381169282019290925264ffffffffff600160a01b83048116606083015260ff600160c81b84041615156080830152600160d01b90920490911660a08201529250906142ae908790615c0a565b905060008783600001516142c29190615c0a565b90506142cf8460016158e2565b94506142da85614a54565b60006040518060c00160405280836001600160801b03168152602001846001600160801b03168152602001886001600160a01b031681526020014264ffffffffff168152602001600015158152602001614332614a7d565b64ffffffffff16905290508061434661321b565b600088815260209182526040908190208351928401516001600160801b03938416600160801b9490911693909302929092178255820151600190910180546060840151608085015160a0909501516001600160a01b039094166001600160c81b031990921691909117600160a01b64ffffffffff928316021765ffffffffffff60c81b1916600160c81b9415159490940264ffffffffff60d01b191693909317600160d01b93909216929092021790556144218661440261323f565b6001600160a01b038a1660009081526020919091526040902090614497565b61442d5761442d615a67565b604080516001600160801b03808c1682528a1660208201526001600160a01b03891691339189917ff0cb471f23fb74ea44b8252eb1881a2dca546288d9f6e90d1a0e82fe0ed342ab910160405180910390a450505050509392505050565b600061165c8383614aa7565b600061165c8383614b9a565b6144ad8282611663565b610fbb5760016144bb612c01565b6000848152602091825260408082206001600160a01b0386168084529352808220805460ff1916941515949094179093559151339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b600061165c836001600160a01b038416614b9a565b6145398282611663565b15610fbb576000614548612c01565b6000848152602091825260408082206001600160a01b0386168084529352808220805460ff1916941515949094179093559151339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061165c836001600160a01b038416614aa7565b804710156145dd57604051638a0d377960e01b815260040160405180910390fd5b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461462a576040519150601f19603f3d011682016040523d82523d6000602084013e61462f565b606091505b5050905080610df75760405162461bcd60e51b815260206004820152600e60248201526d11985a5b1959081d1bc81cd95b9960921b6044820152606401610d42565b7f445f3cbbc114a35d080f2a1953516d74e74d5106860bc2317840ba265f03b51a90565b6060816000018054806020026020016040519081016040528092919081815260200182805480156146e557602002820191906000526020600020905b8154815260200190600101908083116146d1575b50505050509050919050565b600082600001828154811061470857614708615751565b9060005260206000200154905092915050565b614732600080516020615cc0833981519152829055565b60001981141561476e5760405160001981527f32fb7c9891bc4f963c7de9f1186d2a7755c7d6e9f4604dabe1d8bb3027c2f49e90602001613aec565b7f32fb7c9891bc4f963c7de9f1186d2a7755c7d6e9f4604dabe1d8bb3027c2f49e61479942836158a1565b604051908152602001613aec565b6114657f9d8be19d6a54e40bd767aa61b0f462241f5562ef6967d7045485bccac825b240829055565b6114657f0e27eaa2e71c8572ab988fef0b54cd45bbd1740de1e22343fb6cda7536edc12f829055565b6040805160c08101825260008082526020820181905291810182905264ffffffffff421660608201526001608082015260a081019190915261483961321b565b6000808052602091825260408082208451858501516001600160801b03918216600160801b929091169190910217815584820151600190910180546060870151608088015160a0909801516001600160a01b039094166001600160c81b031990921691909117600160a01b64ffffffffff928316021765ffffffffffff60c81b1916600160c81b9715159790970264ffffffffff60d01b191696909617600160d01b9690921695909502179093558251808401909352808352908201526148fe614671565b600061490861101c565b815260208082019290925260400160002082518155910151600190910155565b61493061160f565b1561494e5760405163184e52a160e21b815260040160405180910390fd5b61146581614be9565b60608161497b5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156149a5578061498f8161577d565b915061499e9050600a836158ce565b915061497f565b6000816001600160401b038111156149bf576149bf615279565b6040519080825280601f01601f1916602001820160405280156149e9576020820181803683370190505b5090505b84156115dc576149fe6001836158a1565b9150614a0b600a86615c35565b614a169060306158e2565b60f81b818381518110614a2b57614a2b615751565b60200101906001600160f81b031916908160001a905350614a4d600a866158ce565b94506149ed565b6114657f8ee26abbbdf533de3953ccf2204279e845eecb5ab51f8398522746e4ea068041829055565b6000610d167f6825d6bead7081b4d1ac062bbb771f0e4ade13182688453e79955a721d58c4dd5490565b60008181526001830160205260408120548015614b90576000614acb6001836158a1565b8554909150600090614adf906001906158a1565b9050818114614b44576000866000018281548110614aff57614aff615751565b9060005260206000200154905080876000018481548110614b2257614b22615751565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b5557614b55615c49565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cb1565b6000915050610cb1565b6000818152600183016020526040812054614be157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cb1565b506000610cb1565b614c127f4dd0f6662ba1d6b081f08b350f5e9a6a7b15cf586926ba66f753594928fa64a6829055565b6040518181527ffddcded6b4f4730c226821172046b48372d3cd963c159701ae1b7c3bcac541bb90602001613aec565b828054614c4e906157c7565b90600052602060002090601f016020900481019282614c705760008555614cb6565b82601f10614c895782800160ff19823516178555614cb6565b82800160010185558215614cb6579182015b82811115614cb6578235825591602001919060010190614c9b565b50614cc2929150614d35565b5090565b6040518060c00160405280600081526020016000815260200160006001600160a01b03168152602001600081526020016000151581526020016000151581525090565b6040805160808101825260008082526020820152908101614d28614d4a565b8152602001600081525090565b5b80821115614cc25760008155600101614d36565b6040518061048001604052806024906020820280368337509192915050565b6001600160e01b03198116811461146557600080fd5b600060208284031215614d9157600080fd5b813561165c81614d69565b60005b83811015614db7578181015183820152602001614d9f565b838111156117ed5750506000910152565b60008151808452614de0816020860160208601614d9c565b601f01601f19169290920160200192915050565b60208152600061165c6020830184614dc8565b600060208284031215614e1957600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b038116811461146557600080fd5b60008060408385031215614e5c57600080fd5b8235614e6781614e34565b946020939093013593505050565b60008083601f840112614e8757600080fd5b5081356001600160401b03811115614e9e57600080fd5b6020830191508360208260051b8501011115614eb957600080fd5b9250929050565b600080600060408486031215614ed557600080fd5b83356001600160401b03811115614eeb57600080fd5b614ef786828701614e75565b9094509250506020840135614f0b81614e34565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b81811015614f4e57835183529284019291840191600101614f32565b50909695505050505050565b600080600060608486031215614f6f57600080fd5b8335614f7a81614e34565b92506020840135614f8a81614e34565b929592945050506040919091013590565b60008060408385031215614fae57600080fd5b823591506020830135614fc081614e34565b809150509250929050565b60008060208385031215614fde57600080fd5b82356001600160401b0380821115614ff557600080fd5b818501915085601f83011261500957600080fd5b81358181111561501857600080fd5b86602082850101111561502a57600080fd5b60209290920196919550909350505050565b60008060008060006060868803121561505457600080fd5b85356001600160401b038082111561506b57600080fd5b61507789838a01614e75565b9097509550602088013591508082111561509057600080fd5b5061509d88828901614e75565b90945092505060408601356150b181614e34565b809150509295509295909350565b600080600080606085870312156150d557600080fd5b84356001600160401b038111156150eb57600080fd5b6150f787828801614e75565b90989097506020870135966040013595509350505050565b60006020828403121561512157600080fd5b813561165c81614e34565b60008060008084860360e081121561514357600080fd5b85356001600160401b0381111561515957600080fd5b61516588828901614e75565b909650945050602086013561517981614e34565b925060a0603f198201121561518d57600080fd5b509295919450926040019150565b600080604083850312156151ae57600080fd5b50508035926020909101359150565b801515811461146557600080fd5b6000806000606084860312156151e057600080fd5b83356151eb816151bd565b95602085013595506040909401359392505050565b6000806040838503121561521357600080fd5b823561521e81614e34565b91506020830135614fc0816151bd565b60008060006040848603121561524357600080fd5b83356001600160401b0381111561525957600080fd5b61526586828701614e75565b909790965060209590950135949350505050565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156152b1576152b1615279565b60405290565b604051608081016001600160401b03811182821017156152b1576152b1615279565b60405161048081016001600160401b03811182821017156152b1576152b1615279565b604051601f8201601f191681016001600160401b038111828210171561532457615324615279565b604052919050565b80356001600160801b038116811461534357600080fd5b919050565b803564ffffffffff8116811461534357600080fd5b600080600083850361010081121561537457600080fd5b60c081121561538257600080fd5b5061538b61528f565b6153948561532c565b81526153a26020860161532c565b602082015260408501356153b581614e34565b60408201526153c660608601615348565b606082015260808501356153d9816151bd565b60808201526153ea60a08601615348565b60a08201529560c0850135955060e0909401359392505050565b60006001600160401b0382111561541d5761541d615279565b50601f01601f191660200190565b6000806000806080858703121561544157600080fd5b843561544c81614e34565b9350602085013561545c81614e34565b92506040850135915060608501356001600160401b0381111561547e57600080fd5b8501601f8101871361548f57600080fd5b80356154a261549d82615404565b6152fc565b8181528860208385010111156154b757600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b600080602083850312156154ec57600080fd5b82356001600160401b0381111561550257600080fd5b61550e85828601614e75565b90969095509350505050565b602080825282518282018190526000919060409081850190868401855b82811015615592578151805185528681015187860152858101516001600160a01b0316868601526060808201519086015260808082015115159086015260a09081015115159085015260c09093019290850190600101615537565b5091979650505050505050565b600080600080604085870312156155b557600080fd5b84356001600160401b03808211156155cc57600080fd5b6155d888838901614e75565b909650945060208701359150808211156155f157600080fd5b506155fe87828801614e75565b95989497509550505050565b6000806040838503121561561d57600080fd5b823561562881614e34565b91506020830135614fc081614e34565b60008060008084860361054081121561565057600080fd5b853594506020808701359450604087013593506104e0605f198301121561567657600080fd5b61567e6152b7565b9150606087013582526080870135615695816151bd565b8282015260bf870188136156a857600080fd5b6156b06152d9565b8061052089018a8111156156c357600080fd5b60a08a015b818110156156df57803584529284019284016156c8565b50604085019190915235606084015250949793965091945090925050565b815181526020808301511515818301526040808401516104e084019291840160005b602481101561573c5782518252918301919083019060010161571f565b5050505060608301516104c083015292915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561579157615791615767565b5060010190565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600181811c908216806157db57607f821691505b60208210811415611d4257634e487b7160e01b600052602260045260246000fd5b60006020828403121561580e57600080fd5b5051919050565b6020808252600e908201526d1253959053125108105353d5539560921b604082015260600190565b60006020828403121561584f57600080fd5b813560ff8116811461165c57600080fd5b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6000828210156158b3576158b3615767565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826158dd576158dd6158b8565b500490565b600082198211156158f5576158f5615767565b500190565b60006020828403121561590c57600080fd5b81516001600160401b0381111561592257600080fd5b8201601f8101841361593357600080fd5b805161594161549d82615404565b81815285602083850101111561595657600080fd5b615967826020830160208601614d9c565b95945050505050565b60006001600160801b038381169083168181101561599057615990615767565b039392505050565b60008160001904831182151516156159b2576159b2615767565b500290565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516159e9816017850160208801614d9c565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a1a816028840160208801614d9c565b01602801949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215615a5c57600080fd5b815161165c816151bd565b634e487b7160e01b600052600160045260246000fd5b600060208284031215615a8f57600080fd5b815161165c81614e34565b60208082526010908201526f125b9d985b1a5914995c5d595cdd125960821b604082015260600190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615af790830184614dc8565b9695505050505050565b600060208284031215615b1357600080fd5b815161165c81614d69565b600088516020615b318285838e01614d9c565b895191840191615b448184848e01614d9c565b8951920191615b568184848d01614d9c565b8851920191615b688184848c01614d9c565b8751920191615b7a8184848b01614d9c565b8651920191615b8c8184848a01614d9c565b8551920191615b9e8184848901614d9c565b919091019a9950505050505050505050565b60008451615bc2818460208901614d9c565b845190830190615bd6818360208901614d9c565b8451910190615be9818360208801614d9c565b0195945050505050565b600081615c0257615c02615767565b506000190190565b60006001600160801b03828116848216808303821115615c2c57615c2c615767565b01949350505050565b600082615c4457615c446158b8565b500690565b634e487b7160e01b600052603160045260246000fdfebe882725f03f148e7c5a5e63ec45f182f7dcdb6bb8b92311ade5a6d138e0ee0f2a81836f39b1062c2144ef0b520c964f50c3af430524cc6f585ff0aa7dd48c721450eb8d0693284079f6627b2c1c6bb2e076066e44df1b18ba6ea7cc507e9bcbe8b012900cb200ee5dfc3b895a32791b67d12891b09f117814f167a237783a02139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46da26469706673582212202f643e18e9f2f9427c1a3f18c2655c8f785325f33ba0d2a3e2dce3d99fe6e9ed64736f6c63430008090033