Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- stVLXMinterWithdrawal
- Optimization enabled
- true
- Compiler version
- v0.8.21+commit.d9974bed
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2025-01-20T11:15:29.418555Z
Constructor Arguments
0000000000000000000000003557371afed82dd683de278924bd0e1a790a3c49
Arg [0] (address) : 0x3557371afed82dd683de278924bd0e1a790a3c49
Contract source code
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.20;
// ERC20 interface
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function mint(address to, uint256 amount) external;
function burn(uint256 amount) external;
function transferOwnership(address newOwner) external;
}
/**
* @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);
}
/**
* @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`.
*
* 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;
/**
* @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* 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 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 address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
/**
* @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);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @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 `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
/*//////////////////////////////////////////////////////////////
ETH OPERATIONS
//////////////////////////////////////////////////////////////*/
function safeTransferETH(address to, uint256 amount) internal {
bool success;
assembly {
// Transfer the ETH and store if it succeeded or not.
success := call(gas(), to, amount, 0, 0, 0, 0)
}
require(success, "ETH_TRANSFER_FAILED");
}
/*//////////////////////////////////////////////////////////////
ERC20 OPERATIONS
//////////////////////////////////////////////////////////////*/
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 amount
) internal {
require(address(token).code.length != 0, "token does not exist");
bool success;
assembly {
// Get a pointer to some free memory.
let freeMemoryPointer := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.
success := and(
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data.
or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
// We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
// Counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation.
call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
)
}
require(success, "TRANSFER_FROM_FAILED");
}
function safeTransfer(
IERC20 token,
address to,
uint256 amount
) internal {
require(address(token).code.length != 0, "token does not exist");
bool success;
assembly {
// Get a pointer to some free memory.
let freeMemoryPointer := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.
success := and(
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data.
or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
// Counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation.
call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
)
}
require(success, "TRANSFER_FAILED");
}
function safeApprove(
IERC20 token,
address to,
uint256 amount
) internal {
require(address(token).code.length != 0, "token does not exist");
bool success;
assembly {
// Get a pointer to some free memory.
let freeMemoryPointer := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.
success := and(
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data.
or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
// Counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation.
call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
)
}
require(success, "APPROVE_FAILED");
}
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
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_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
/**
* @dev Provides a set of functions to operate with Base64 strings.
*/
library Base64 {
/**
* @dev Base64 Encoding/Decoding Table
* See sections 4 and 5 of https://datatracker.ietf.org/doc/html/rfc4648
*/
string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
string internal constant _TABLE_URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
/**
* @dev Converts a `bytes` to its Bytes64 `string` representation.
*/
function encode(bytes memory data) internal pure returns (string memory) {
return _encode(data, _TABLE, true);
}
/**
* @dev Converts a `bytes` to its Bytes64Url `string` representation.
* Output is not padded with `=` as specified in https://www.rfc-editor.org/rfc/rfc4648[rfc4648].
*/
function encodeURL(bytes memory data) internal pure returns (string memory) {
return _encode(data, _TABLE_URL, false);
}
/**
* @dev Internal table-agnostic conversion
*/
function _encode(bytes memory data, string memory table, bool withPadding) private pure returns (string memory) {
/**
* Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
* https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
*/
if (data.length == 0) return "";
// If padding is enabled, the final length should be `bytes` data length divided by 3 rounded up and then
// multiplied by 4 so that it leaves room for padding the last chunk
// - `data.length + 2` -> Prepare for division rounding up
// - `/ 3` -> Number of 3-bytes chunks (rounded up)
// - `4 *` -> 4 characters for each chunk
// This is equivalent to: 4 * Math.ceil(data.length / 3)
//
// If padding is disabled, the final length should be `bytes` data length multiplied by 4/3 rounded up as
// opposed to when padding is required to fill the last chunk.
// - `4 * data.length` -> 4 characters for each chunk
// - ` + 2` -> Prepare for division rounding up
// - `/ 3` -> Number of 3-bytes chunks (rounded up)
// This is equivalent to: Math.ceil((4 * data.length) / 3)
uint256 resultLength = withPadding ? 4 * ((data.length + 2) / 3) : (4 * data.length + 2) / 3;
string memory result = new string(resultLength);
assembly ("memory-safe") {
// Prepare the lookup table (skip the first "length" byte)
let tablePtr := add(table, 1)
// Prepare result pointer, jump over length
let resultPtr := add(result, 0x20)
let dataPtr := data
let endPtr := add(data, mload(data))
// In some cases, the last iteration will read bytes after the end of the data. We cache the value, and
// set it to zero to make sure no dirty bytes are read in that section.
let afterPtr := add(endPtr, 0x20)
let afterCache := mload(afterPtr)
mstore(afterPtr, 0x00)
// Run over the input, 3 bytes at a time
for {
} lt(dataPtr, endPtr) {
} {
// Advance 3 bytes
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
// To write each character, shift the 3 byte (24 bits) chunk
// 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
// and apply logical AND with 0x3F to bitmask the least significant 6 bits.
// Use this as an index into the lookup table, mload an entire word
// so the desired character is in the least significant byte, and
// mstore8 this least significant byte into the result and continue.
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
}
// Reset the value that was cached
mstore(afterPtr, afterCache)
if withPadding {
// When data `bytes` is not exactly 3 bytes long
// it is padded with `=` characters at the end
switch mod(mload(data), 3)
case 1 {
mstore8(sub(resultPtr, 1), 0x3d)
mstore8(sub(resultPtr, 2), 0x3d)
}
case 2 {
mstore8(sub(resultPtr, 1), 0x3d)
}
}
}
return result;
}
}
/**
* @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.1 (security/ReentrancyGuard.sol)
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @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);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
mapping(uint256 tokenId => address) private _owners;
mapping(address owner => uint256) private _balances;
mapping(uint256 tokenId => address) private _tokenApprovals;
mapping(address owner => mapping(address operator => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual returns (uint256) {
if (owner == address(0)) {
revert ERC721InvalidOwner(address(0));
}
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual returns (address) {
return _requireOwned(tokenId);
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
_requireOwned(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual {
_approve(to, tokenId, _msgSender());
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual returns (address) {
_requireOwned(tokenId);
return _getApproved(tokenId);
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
// Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
address previousOwner = _update(to, tokenId, _msgSender());
if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
transferFrom(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
/**
* @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
*
* IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
* core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
* consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
* `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
*/
function _getApproved(uint256 tokenId) internal view virtual returns (address) {
return _tokenApprovals[tokenId];
}
/**
* @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
* particular (ignoring whether it is owned by `owner`).
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
return
spender != address(0) &&
(owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
}
/**
* @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
* Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
* the `spender` for the specific `tokenId`.
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
if (!_isAuthorized(owner, spender, tokenId)) {
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else {
revert ERC721InsufficientApproval(spender, tokenId);
}
}
}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
* a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
*
* WARNING: Increasing an account's balance using this function tends to be paired with an override of the
* {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
* remain consistent with one another.
*/
function _increaseBalance(address account, uint128 value) internal virtual {
unchecked {
_balances[account] += value;
}
}
/**
* @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
* (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
*
* The `auth` argument is optional. If the value passed is non 0, then this function will check that
* `auth` is either the owner of the token, or approved to operate on the token (by the owner).
*
* Emits a {Transfer} event.
*
* NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
*/
function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
address from = _ownerOf(tokenId);
// Perform (optional) operator check
if (auth != address(0)) {
_checkAuthorized(from, auth, tokenId);
}
// Execute the update
if (from != address(0)) {
// Clear approval. No need to re-authorize or emit the Approval event
_approve(address(0), tokenId, address(0), false);
unchecked {
_balances[from] -= 1;
}
}
if (to != address(0)) {
unchecked {
_balances[to] += 1;
}
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
return from;
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner != address(0)) {
revert ERC721InvalidSender(address(0));
}
}
/**
* @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
_checkOnERC721Received(address(0), to, tokenId, data);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal {
address previousOwner = _update(address(0), tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
* are aware of the ERC721 standard to prevent tokens from being forever locked.
*
* `data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is like {safeTransferFrom} in the sense that it invokes
* {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `tokenId` token must exist and be owned by `from`.
* - `to` cannot be the zero address.
* - `from` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId) internal {
_safeTransfer(from, to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
* either the owner of the token, or approved to operate on all tokens held by this owner.
*
* Emits an {Approval} event.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address to, uint256 tokenId, address auth) internal {
_approve(to, tokenId, auth, true);
}
/**
* @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
* emitted in the context of transfers.
*/
function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
// Avoid reading the owner unless necessary
if (emitEvent || auth != address(0)) {
address owner = _requireOwned(tokenId);
// We do not use _isAuthorized because single-token approvals should not be able to call approve
if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
revert ERC721InvalidApprover(auth);
}
if (emitEvent) {
emit Approval(owner, to, tokenId);
}
}
_tokenApprovals[tokenId] = to;
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Requirements:
* - operator can't be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC721InvalidOperator(operator);
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
* Returns the owner.
*
* Overrides to ownership logic should be done to {_ownerOf}.
*/
function _requireOwned(uint256 tokenId) internal view returns (address) {
address owner = _ownerOf(tokenId);
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
return owner;
}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
* recipient doesn't accept the token transfer. 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 tokenId uint256 ID of the token to be transferred
* @param data bytes optional data to send along with the call
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
if (to.code.length > 0) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
if (retval != IERC721Receiver.onERC721Received.selector) {
revert ERC721InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
revert ERC721InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
}
/**
* @title ERC-721 Burnable Token
* @dev ERC-721 Token that can be burned (destroyed).
*/
abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
// Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
_update(address(0), tokenId, _msgSender());
}
}
/**
* @dev This implements an optional extension of {ERC721} defined in the ERC that adds enumerability
* of all the token ids in the contract as well as all token ids owned by each account.
*
* CAUTION: {ERC721} extensions that implement custom `balanceOf` logic, such as {ERC721Consecutive},
* interfere with enumerability and should not be used together with {ERC721Enumerable}.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
mapping(address owner => mapping(uint256 index => uint256)) private _ownedTokens;
mapping(uint256 tokenId => uint256) private _ownedTokensIndex;
uint256[] private _allTokens;
mapping(uint256 tokenId => uint256) private _allTokensIndex;
/**
* @dev An `owner`'s token query was out of bounds for `index`.
*
* NOTE: The owner being `address(0)` indicates a global out of bounds index.
*/
error ERC721OutOfBoundsIndex(address owner, uint256 index);
/**
* @dev Batch mint is not allowed.
*/
error ERC721EnumerableForbiddenBatchMint();
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
if (index >= balanceOf(owner)) {
revert ERC721OutOfBoundsIndex(owner, index);
}
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual returns (uint256) {
if (index >= totalSupply()) {
revert ERC721OutOfBoundsIndex(address(0), index);
}
return _allTokens[index];
}
/**
* @dev See {ERC721-_update}.
*/
function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
address previousOwner = super._update(to, tokenId, auth);
if (previousOwner == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (previousOwner != to) {
_removeTokenFromOwnerEnumeration(previousOwner, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (previousOwner != to) {
_addTokenToOwnerEnumeration(to, tokenId);
}
return previousOwner;
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = balanceOf(to) - 1;
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = balanceOf(from);
uint256 tokenIndex = _ownedTokensIndex[tokenId];
mapping(uint256 index => uint256) storage _ownedTokensByOwner = _ownedTokens[from];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokensByOwner[lastTokenIndex];
_ownedTokensByOwner[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokensByOwner[lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
/**
* See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch
*/
function _increaseBalance(address account, uint128 amount) internal virtual override {
if (amount > 0) {
revert ERC721EnumerableForbiddenBatchMint();
}
super._increaseBalance(account, amount);
}
}
// BaseMinter
abstract contract BaseMinter is Ownable, ReentrancyGuard {
string public constant VERSION = "v2.0.0";
string public MINTER_TYPE = "base";
uint256 public depositFee = 0; // possible fee to cover bridging costs
uint256 public minDeposit = 1; // min deposit amount (wei)
uint256 public constant MAX_DEPOSIT_FEE = 500; // max deposit fee 500bp (5%)
uint256 public constant FEE_DENOMINATOR = 10000; // fee denominator for basis points
// Staking token
IERC20 public stakingToken;
constructor(address _stakingToken) {
stakingToken = IERC20(_stakingToken);
}
event UpdateDepositFee(uint256 _depositFee);
event UpdateMinDeposit(uint256 _minDeposit);
event TransferStakingTokenOwnership(address indexed _newOwner);
event Mint(address indexed caller, address indexed receiver, uint256 amount);
function getVersion() public view virtual returns (string memory) {
return string(abi.encodePacked(VERSION, ":", MINTER_TYPE));
}
function previewDeposit(uint256 amount) public view virtual returns (uint256) {
uint256 feeAmount = amount*depositFee/FEE_DENOMINATOR;
uint256 netAmount = amount-feeAmount;
return netAmount;
}
function updateDepositFee(uint256 newFee) public onlyOwner {
require(newFee <= MAX_DEPOSIT_FEE, ">MaxFee");
depositFee = newFee;
emit UpdateDepositFee(newFee);
}
function updateMinDeposit(uint256 newMin) public onlyOwner {
require(newMin > 0, "ZeroMinDeposit");
require(newMin < type(uint128).max, "NewMinTooBig");
minDeposit = newMin;
emit UpdateMinDeposit(minDeposit);
}
function transferStakingTokenOwnership(address newOwner) public onlyOwner {
stakingToken.transferOwnership(newOwner);
emit TransferStakingTokenOwnership(newOwner);
}
function mint(uint256 amount, address receiver) public onlyOwner {
stakingToken.mint(receiver, amount);
emit Mint(address(msg.sender), receiver, amount);
}
}
// NativeMinter contract accepts network coin as a base token for liquid staking
contract NativeMinter is BaseMinter {
constructor(address _stakingToken) BaseMinter(_stakingToken) {
MINTER_TYPE = string(abi.encodePacked(MINTER_TYPE, ":native"));
}
event Deposit(address indexed caller, address indexed receiver, uint256 amount);
event Withdraw(address indexed caller, address indexed receiver, uint256 amount);
event FundsReceived(address sender, uint amount);
// receive() function to handle plain gas token transfers
receive() external payable {
emit FundsReceived(msg.sender, msg.value);
}
function deposit(address receiver) public payable virtual nonReentrant {
require(msg.value >= minDeposit, "LessThanMin");
uint256 mintAmount = previewDeposit(msg.value);
require(mintAmount > 0, "ZeroMintAmount");
stakingToken.mint(receiver, mintAmount);
emit Deposit(address(msg.sender), receiver, msg.value);
}
function withdraw(address receiver) public virtual onlyOwner {
uint256 availableBalance = address(this).balance;
require(availableBalance > 0, "ZeroWithdraw");
SafeTransferLib.safeTransferETH(receiver, availableBalance);
emit Withdraw(address(msg.sender), receiver, availableBalance);
}
}
// ERC20Minter contract accepts ERC20 token as a base token for liduid staking
contract ERC20Minter is BaseMinter {
using SafeTransferLib for IERC20;
// Base token
IERC20 public baseToken;
constructor(address _baseToken, address _stakingToken) BaseMinter(_stakingToken) {
MINTER_TYPE = string(abi.encodePacked(MINTER_TYPE, ":erc20"));
baseToken = IERC20(_baseToken);
}
event Deposit(address indexed caller, address indexed receiver, uint256 amount);
event Withdraw(address indexed caller, address indexed receiver, uint256 amount);
function deposit(uint256 amount, address receiver) public virtual nonReentrant {
require(amount >= minDeposit, "LessThanMin");
uint256 mintAmount = previewDeposit(amount);
require(mintAmount > 0, "ZeroMintAmount");
baseToken.safeTransferFrom(address(msg.sender), address(this), amount);
stakingToken.mint(receiver, mintAmount);
emit Deposit(address(msg.sender), receiver, amount);
}
function withdraw(address receiver) public virtual onlyOwner {
uint256 availableBalance = baseToken.balanceOf(address(this));
require(availableBalance > 0, "ZeroWithdraw");
baseToken.safeTransfer(receiver, availableBalance);
emit Withdraw(address(msg.sender), receiver, availableBalance);
}
}
// BaseMinterRedeem is BaseMinter extension with redeem free management
abstract contract BaseMinterRedeem is BaseMinter {
uint256 public redeemFee = 0; // possible fee to cover bridging costs
uint256 public constant MAX_REDEEM_FEE = 500; // max redeem fee 500bp (5%)
constructor() {
MINTER_TYPE = "redeem";
}
event UpdateRedeemFee(uint256 _redeemFee);
event Redeem(address indexed caller, address indexed receiver, uint256 amount);
function previewRedeem(uint256 amount) public view virtual returns (uint256) {
uint256 feeAmount = amount*redeemFee/FEE_DENOMINATOR;
uint256 netAmount = amount-feeAmount;
return netAmount;
}
function updateRedeemFee(uint256 newFee) public onlyOwner {
require(newFee <= MAX_REDEEM_FEE, ">MaxFee");
redeemFee = newFee;
emit UpdateRedeemFee(newFee);
}
}
// NativeMinterRedeem is NativeMinter extension that allows to instantly network coin
contract NativeMinterRedeem is BaseMinterRedeem, NativeMinter {
using SafeTransferLib for IERC20;
constructor(address _stakingToken) NativeMinter(_stakingToken) {
}
function redeem(uint256 amount, address receiver) public virtual nonReentrant {
require(amount > 0, "ZeroRedeem");
uint256 redeemAmount = previewRedeem(amount);
require(redeemAmount > 0, "ZeroRedeemAmount");
stakingToken.safeTransferFrom(address(msg.sender), address(this), amount);
stakingToken.burn(amount);
SafeTransferLib.safeTransferETH(receiver, redeemAmount);
emit Redeem(address(msg.sender), receiver, amount);
}
}
// ERC20MinterRedeem is ERC20Minter extension that allows to instantly redeem base token
contract ERC20MinterRedeem is BaseMinterRedeem, ERC20Minter {
using SafeTransferLib for IERC20;
constructor(address _baseToken, address _stakingToken) ERC20Minter(_baseToken, _stakingToken) {
}
function redeem(uint256 amount, address receiver) public virtual nonReentrant {
require(amount > 0, "ZeroRedeem");
uint256 redeemAmount = previewRedeem(amount);
require(redeemAmount > 0, "ZeroRedeemAmount");
stakingToken.safeTransferFrom(address(msg.sender), address(this), amount);
stakingToken.burn(amount);
baseToken.safeTransfer(receiver, redeemAmount);
emit Redeem(address(msg.sender), receiver, amount);
}
}
// BaseMinterWithdrawal is BaseMinter extension with redeem free management
abstract contract BaseMinterWithdrawal is BaseMinter, ERC721, ERC721Enumerable, ERC721Burnable {
using SafeTransferLib for IERC20;
uint256 public withdrawalFee = 0; // possible fee to cover withdrawal costs
uint256 public minWithdrawal = 1; // min withdrawal amount (wei)
uint256 public constant MAX_WITHDRAWAL_FEE = 500; // max withdrawal fee 500bp (5%)
uint256 public totalPendingWithdrawals = 0; // total pending withdrawals
uint256 public totalUnclaimedWithdrawals = 0; // total unclaimed withdrawals
uint256 public totalWithdrawalFees = 0; // total fees accumulated
uint256 public nextWithdrawalId = 1; // counter for withdrawal IDs
string private baseURI; // base url for nft images
struct WithdrawalRequest {
uint256 amount;
bool processed;
bool claimed;
}
mapping(uint256 => WithdrawalRequest) internal _withdrawalRequests;
event UpdateWithdrawalFee(uint256 _withdrawalFee);
event UpdateMinWithdrawal(uint256 _minWithdrawal);
event RequestWithdrawal(address indexed caller, address indexed receiver, uint256 amount, uint256 indexed withdrawalId);
event ProcessWithdrawal(uint256 indexed withdrawalId);
event CollectWithdrawalFees(address indexed caller, address indexed receiver, uint256 amount);
event ClaimWithdrawal(address indexed caller, address indexed receiver, uint256 amount, uint256 indexed withdrawalId);
constructor(
string memory _unstTokenName,
string memory _unstTokenSymbol,
string memory _unstTokenBaseURI
) ERC721(_unstTokenName, _unstTokenSymbol) {
MINTER_TYPE = "withdrawal";
baseURI = _unstTokenBaseURI;
}
function _baseURI() internal view override returns (string memory) {
uint256 chainId;
assembly {
chainId := chainid()
}
return string.concat(baseURI, "/", Strings.toString(chainId), "/", Strings.toHexString(address(this)), "/");
}
// ERC721Enumerable: The following functions are overrides required by Solidity.
function _update(address to, uint256 tokenId, address auth)
internal
override(ERC721, ERC721Enumerable)
returns (address)
{
return super._update(to, tokenId, auth);
}
function _increaseBalance(address account, uint128 value)
internal
override(ERC721, ERC721Enumerable)
{
super._increaseBalance(account, value);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
// Custom tokenURI
function tokenURI(uint256 tokenId) public view override returns (string memory) {
_requireOwned(tokenId);
string memory imageURI = string(abi.encodePacked(_baseURI(), Strings.toString(tokenId), ".png"));
string memory name = string(abi.encodePacked("Withdrawal #", Strings.toString(tokenId)));
string memory json = string(abi.encodePacked(
'{"name": "', name, '", ',
'"image": "', imageURI, '"}'
));
string memory jsonBase64 = Base64.encode(bytes(json));
return string(abi.encodePacked("data:application/json;base64,", jsonBase64));
}
// Minter
function balanceAvailable() public view virtual returns (uint256);
function previewWithdrawal(uint256 amount) public view virtual returns (uint256) {
uint256 feeAmount = amount*withdrawalFee/FEE_DENOMINATOR;
uint256 netAmount = amount-feeAmount;
return netAmount;
}
function updateWithdrawalFee(uint256 newFee) public onlyOwner {
require(newFee <= MAX_WITHDRAWAL_FEE, ">MaxFee");
withdrawalFee = newFee;
emit UpdateWithdrawalFee(withdrawalFee);
}
function updateMinWithdrawal(uint256 newMin) public onlyOwner {
require(newMin > 0, "ZeroMinWithdrawal");
require(newMin < type(uint128).max, "NewMinTooBig");
minWithdrawal = newMin;
emit UpdateMinWithdrawal(minWithdrawal);
}
function requestWithdrawal(uint256 amount, address receiver) public nonReentrant {
require(amount >= minWithdrawal, "LessThanMin");
uint256 netAmount = previewWithdrawal(amount);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 withdrawalId = nextWithdrawalId++;
_mint(receiver, withdrawalId);
emit RequestWithdrawal(address(msg.sender), receiver, amount, withdrawalId);
totalWithdrawalFees = totalWithdrawalFees+amount-netAmount;
// check if withdrawal will be auto-processed
uint256 balance = balanceAvailable();
bool isPreviousProcessed = (withdrawalId == 1) || _withdrawalRequests[withdrawalId-1].processed;
// if enough tokens & previous is processed => auto-process this withdrawal
if ((netAmount <= balance) && (isPreviousProcessed)) {
stakingToken.burn(netAmount);
totalUnclaimedWithdrawals = totalUnclaimedWithdrawals+netAmount;
_withdrawalRequests[withdrawalId] = WithdrawalRequest({
amount: netAmount,
processed: true,
claimed: false
});
emit ProcessWithdrawal(withdrawalId);
}
// or withdrawal is pending
else {
totalPendingWithdrawals = totalPendingWithdrawals+netAmount;
_withdrawalRequests[withdrawalId] = WithdrawalRequest({
amount: netAmount,
processed: false,
claimed: false
});
}
}
function getWithdrawalRequest(uint256 withdrawalId) public view returns (WithdrawalRequest memory) {
WithdrawalRequest memory request = _withdrawalRequests[withdrawalId];
return (request);
}
function tokensOfOwner(address owner) external view returns (uint256[] memory) {
uint256 tokenCount = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(owner, i);
}
return tokenIds;
}
function processWithdrawals(uint256[] calldata withdrawalIds) public onlyOwner {
uint256 totalWithdrawals;
for (uint256 i = 0; i < withdrawalIds.length; i++) {
uint256 withdrawalId = withdrawalIds[i];
WithdrawalRequest storage request = _withdrawalRequests[withdrawalId];
require(request.amount > 0, "ZeroAmount");
require(!request.processed, "AlreadyProcessed");
require(!request.claimed, "AlreadyClaimed");
request.processed = true;
totalWithdrawals = totalWithdrawals+request.amount;
emit ProcessWithdrawal(withdrawalId);
}
require(totalWithdrawals <= totalPendingWithdrawals, "TotalWithdrawalAmountExceeded");
stakingToken.burn(totalWithdrawals);
totalPendingWithdrawals = totalPendingWithdrawals-totalWithdrawals;
totalUnclaimedWithdrawals = totalUnclaimedWithdrawals+totalWithdrawals;
}
function collectWithdrawalFees(address receiver) public onlyOwner {
require(totalWithdrawalFees > 0, "ZeroFees");
uint256 feesToCollect = totalWithdrawalFees;
totalWithdrawalFees = 0;
stakingToken.safeTransfer(receiver, feesToCollect);
emit CollectWithdrawalFees(address(msg.sender), receiver, feesToCollect);
}
}
contract NativeMinterWithdrawal is BaseMinterWithdrawal, NativeMinter {
constructor(
address _stakingToken,
string memory _unstTokenName,
string memory _unstTokenSymbol,
string memory _baseURL
) BaseMinterWithdrawal(_unstTokenName, _unstTokenSymbol, _baseURL) NativeMinter(_stakingToken) {}
function balanceAvailable() public view override returns (uint256) {
uint256 availableBalance = address(this).balance;
uint256 balance;
if (availableBalance < totalUnclaimedWithdrawals) {
balance = 0;
} else {
balance = availableBalance-totalUnclaimedWithdrawals;
}
return balance;
}
function withdraw(address receiver) public virtual onlyOwner override {
uint256 balance = balanceAvailable();
require(balance > 0, "BalanceNotEnough");
SafeTransferLib.safeTransferETH(receiver, balance);
emit Withdraw(address(msg.sender), receiver, balance);
}
function claimWithdrawal(uint256 withdrawalId, address receiver) public virtual nonReentrant {
require(ownerOf(withdrawalId) == msg.sender, "NotOwner");
WithdrawalRequest storage request = _withdrawalRequests[withdrawalId];
require(request.processed, "NotProcessedYet");
_burn(withdrawalId);
request.claimed = true;
totalUnclaimedWithdrawals = totalUnclaimedWithdrawals-request.amount;
SafeTransferLib.safeTransferETH(receiver, request.amount);
emit ClaimWithdrawal(address(msg.sender), receiver, request.amount, withdrawalId);
}
}
contract ERC20MinterWithdrawal is BaseMinterWithdrawal, ERC20Minter {
using SafeTransferLib for IERC20;
constructor(
address _baseToken,
address _stakingToken,
string memory _unstTokenName,
string memory _unstTokenSymbol,
string memory _baseURL
) BaseMinterWithdrawal(_unstTokenName, _unstTokenSymbol, _baseURL) ERC20Minter(_baseToken, _stakingToken) {}
function balanceAvailable() public view override returns (uint256) {
uint256 availableBalance = baseToken.balanceOf(address(this));
uint256 balance;
if (availableBalance < totalUnclaimedWithdrawals) {
balance = 0;
} else {
balance = availableBalance-totalUnclaimedWithdrawals;
}
return balance;
}
function withdraw(address receiver) public virtual onlyOwner override {
uint256 balance = balanceAvailable();
require(balance > 0, "BalanceNotEnough");
baseToken.safeTransfer(receiver, balance);
emit Withdraw(address(msg.sender), receiver, balance);
}
function claimWithdrawal(uint256 withdrawalId, address receiver) public virtual nonReentrant {
require(ownerOf(withdrawalId) == msg.sender, "NotOwner");
WithdrawalRequest storage request = _withdrawalRequests[withdrawalId];
require(request.processed, "NotProcessedYet");
_burn(withdrawalId);
request.claimed = true;
totalUnclaimedWithdrawals = totalUnclaimedWithdrawals-request.amount;
baseToken.safeTransfer(receiver, request.amount);
emit ClaimWithdrawal(address(msg.sender), receiver, request.amount, withdrawalId);
}
}
contract stVLXMinterWithdrawal is NativeMinterWithdrawal {
string public BASE_URI = "https://api.accumulated.finance/v1/nft";
constructor(address _stakingToken) NativeMinterWithdrawal(_stakingToken, "unstVLX", "unstVLX", BASE_URI) {
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_stakingToken","internalType":"address"}]},{"type":"error","name":"ERC721EnumerableForbiddenBatchMint","inputs":[]},{"type":"error","name":"ERC721IncorrectOwner","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"ERC721InsufficientApproval","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"error","name":"ERC721InvalidApprover","inputs":[{"type":"address","name":"approver","internalType":"address"}]},{"type":"error","name":"ERC721InvalidOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"error","name":"ERC721InvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"ERC721InvalidReceiver","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"error","name":"ERC721InvalidSender","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"ERC721NonexistentToken","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"error","name":"ERC721OutOfBoundsIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"error","name":"StringsInsufficientHexLength","inputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"length","internalType":"uint256"}]},{"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":"ClaimWithdrawal","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"withdrawalId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"CollectWithdrawalFees","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FundsReceived","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Mint","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ProcessWithdrawal","inputs":[{"type":"uint256","name":"withdrawalId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"RequestWithdrawal","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"withdrawalId","internalType":"uint256","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":"TransferStakingTokenOwnership","inputs":[{"type":"address","name":"_newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"UpdateDepositFee","inputs":[{"type":"uint256","name":"_depositFee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateMinDeposit","inputs":[{"type":"uint256","name":"_minDeposit","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateMinWithdrawal","inputs":[{"type":"uint256","name":"_minWithdrawal","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateWithdrawalFee","inputs":[{"type":"uint256","name":"_withdrawalFee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"BASE_URI","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"FEE_DENOMINATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_DEPOSIT_FEE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_WITHDRAWAL_FEE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"MINTER_TYPE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"VERSION","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceAvailable","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimWithdrawal","inputs":[{"type":"uint256","name":"withdrawalId","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"collectWithdrawalFees","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"deposit","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"depositFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getVersion","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct BaseMinterWithdrawal.WithdrawalRequest","components":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bool","name":"processed","internalType":"bool"},{"type":"bool","name":"claimed","internalType":"bool"}]}],"name":"getWithdrawalRequest","inputs":[{"type":"uint256","name":"withdrawalId","internalType":"uint256"}]},{"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":"uint256","name":"","internalType":"uint256"}],"name":"minDeposit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minWithdrawal","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nextWithdrawalId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previewDeposit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previewWithdrawal","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"processWithdrawals","inputs":[{"type":"uint256[]","name":"withdrawalIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestWithdrawal","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","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":"tokenId","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":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"stakingToken","inputs":[]},{"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":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"tokensOfOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPendingWithdrawals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalUnclaimedWithdrawals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalWithdrawalFees","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferStakingTokenOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateDepositFee","inputs":[{"type":"uint256","name":"newFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateMinDeposit","inputs":[{"type":"uint256","name":"newMin","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateMinWithdrawal","inputs":[{"type":"uint256","name":"newMin","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateWithdrawalFee","inputs":[{"type":"uint256","name":"newFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawalFee","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60c060405260046080908152636261736560e01b60a0526002906200002590826200035d565b506000600355600160045560006010556001601155600060125560006013556000601455600160155560405180606001604052806026815260200162003ae9602691396018906200007790826200035d565b503480156200008557600080fd5b5060405162003b0f38038062003b0f833981016040819052620000a89162000429565b80604051806040016040528060078152602001660eadce6e8ac98b60cb1b815250604051806040016040528060078152602001660eadce6e8ac98b60cb1b81525060188054620000f890620002ce565b80601f01602080910402602001604051908101604052809291908181526020018280546200012690620002ce565b8015620001775780601f106200014b5761010080835404028352916020019162000177565b820191906000526020600020905b8154815290600101906020018083116200015957829003601f168201915b5050505050838383838282856200019d620001976200026460201b60201c565b62000268565b60018055600580546001600160a01b0319166001600160a01b03929092169190911790556006620001cf83826200035d565b506007620001de82826200035d565b505060408051808201909152600a8152691dda5d1a191c985dd85b60b21b6020820152600291506200021190826200035d565b5060166200022082826200035d565b5050505060026040516020016200023891906200045b565b604051602081830303815290604052600290816200025791906200035d565b50505050505050620004e8565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002e357607f821691505b6020821081036200030457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200035857600081815260208120601f850160051c81016020861015620003335750805b601f850160051c820191505b8181101562000354578281556001016200033f565b5050505b505050565b81516001600160401b03811115620003795762000379620002b8565b62000391816200038a8454620002ce565b846200030a565b602080601f831160018114620003c95760008415620003b05750858301515b600019600386901b1c1916600185901b17855562000354565b600085815260208120601f198616915b82811015620003fa57888601518255948401946001909101908401620003d9565b5085821015620004195787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156200043c57600080fd5b81516001600160a01b03811681146200045457600080fd5b9392505050565b60008083546200046b81620002ce565b600182811680156200048657600181146200049c57620004cd565b60ff1984168752821515830287019450620004cd565b8760005260208060002060005b85811015620004c45781548a820152908401908201620004a9565b50505082870194505b5050663a6e617469766560c81b835250506007019392505050565b6135f180620004f86000396000f3fe60806040526004361061031e5760003560e01c80638462151c116101ab578063c6d87dd5116100f7578063e985e9c511610095578063f2fde38b1161006f578063f2fde38b14610977578063f340fa0114610997578063f9abb1f1146109aa578063ffa1ad74146109c057600080fd5b8063e985e9c514610937578063eb6ed33014610880578063ef8b30f71461095757600080fd5b8063cf03ef89116100d1578063cf03ef89146108cc578063d6925460146108ec578063d73792a91461090c578063dbddb26a1461092257600080fd5b8063c6d87dd514610880578063c87b56dd14610896578063ca9a6da5146108b657600080fd5b80639a7be47111610164578063a8b9ef301161013e578063a8b9ef301461079f578063ae3df706146107b5578063ae485651146107ca578063b88d4fde1461086057600080fd5b80639a7be47114610749578063a22cb46514610769578063a4563e031461078957600080fd5b80638462151c146106935780638bc7e8c4146106c05780638da5cb5b146106d65780638e3a889e146106f457806394bf804d1461071457806395d89b411461073457600080fd5b806342966c681161026a578063569b8e2c1161022357806370a08231116101fd57806370a0823114610629578063715018a61461064957806372f702f31461065e5780637da2d1f41461067e57600080fd5b8063569b8e2c146105d35780636352211e146105f357806367a527931461061357600080fd5b806342966c681461051d57806344eaa9921461053d5780634a9122e31461055d5780634f6ccce71461057357806350d9065a1461059357806351cff8d9146105b357600080fd5b806318160ddd116102d75780632f745c59116102b15780632f745c59146104a75780633384d9fb146104c757806341b3d185146104e757806342842e0e146104fd57600080fd5b806318160ddd14610448578063217397791461046757806323b872dd1461048757600080fd5b8063017def571461036257806301ffc9a71461038457806306fdde03146103b9578063081812fc146103db578063095ea7b3146104135780630d8e6e2c1461043357600080fd5b3661035d57604080513381523460208201527f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f910160405180910390a1005b600080fd5b34801561036e57600080fd5b5061038261037d366004612e0e565b6109f2565b005b34801561039057600080fd5b506103a461039f366004612e3d565b610a9d565b60405190151581526020015b60405180910390f35b3480156103c557600080fd5b506103ce610aae565b6040516103b09190612eaa565b3480156103e757600080fd5b506103fb6103f6366004612e0e565b610b40565b6040516001600160a01b0390911681526020016103b0565b34801561041f57600080fd5b5061038261042e366004612ed9565b610b69565b34801561043f57600080fd5b506103ce610b78565b34801561045457600080fd5b50600e545b6040519081526020016103b0565b34801561047357600080fd5b50610382610482366004612f03565b610bc0565b34801561049357600080fd5b506103826104a2366004612f2f565b610e77565b3480156104b357600080fd5b506104596104c2366004612ed9565b610f02565b3480156104d357600080fd5b506103826104e2366004612f03565b610f67565b3480156104f357600080fd5b5061045960045481565b34801561050957600080fd5b50610382610518366004612f2f565b611095565b34801561052957600080fd5b50610382610538366004612e0e565b6110b5565b34801561054957600080fd5b50610382610558366004612f6b565b6110c1565b34801561056957600080fd5b5061045960155481565b34801561057f57600080fd5b5061045961058e366004612e0e565b611336565b34801561059f57600080fd5b506103826105ae366004612e0e565b61138f565b3480156105bf57600080fd5b506103826105ce366004612fe0565b611477565b3480156105df57600080fd5b506103826105ee366004612e0e565b61153f565b3480156105ff57600080fd5b506103fb61060e366004612e0e565b6115da565b34801561061f57600080fd5b5061045960035481565b34801561063557600080fd5b50610459610644366004612fe0565b6115e5565b34801561065557600080fd5b5061038261162d565b34801561066a57600080fd5b506005546103fb906001600160a01b031681565b34801561068a57600080fd5b50610459611663565b34801561069f57600080fd5b506106b36106ae366004612fe0565b611691565b6040516103b09190612ffb565b3480156106cc57600080fd5b5061045960105481565b3480156106e257600080fd5b506000546001600160a01b03166103fb565b34801561070057600080fd5b5061045961070f366004612e0e565b611733565b34801561072057600080fd5b5061038261072f366004612f03565b611767565b34801561074057600080fd5b506103ce611834565b34801561075557600080fd5b50610382610764366004612e0e565b611843565b34801561077557600080fd5b50610382610784366004613033565b611928565b34801561079557600080fd5b5061045960125481565b3480156107ab57600080fd5b5061045960135481565b3480156107c157600080fd5b506103ce611933565b3480156107d657600080fd5b5061083a6107e5366004612e0e565b604080516060808201835260008083526020808401829052928401819052938452601782529282902082519384018352805484526001015460ff80821615159285019290925261010090041615159082015290565b6040805182518152602080840151151590820152918101511515908201526060016103b0565b34801561086c57600080fd5b5061038261087b366004613085565b6119c1565b34801561088c57600080fd5b506104596101f481565b3480156108a257600080fd5b506103ce6108b1366004612e0e565b6119d8565b3480156108c257600080fd5b5061045960145481565b3480156108d857600080fd5b506103826108e7366004612fe0565b611aa3565b3480156108f857600080fd5b50610382610907366004612fe0565b611b67565b34801561091857600080fd5b5061045961271081565b34801561092e57600080fd5b506103ce611c27565b34801561094357600080fd5b506103a4610952366004613161565b611c34565b34801561096357600080fd5b50610459610972366004612e0e565b611c62565b34801561098357600080fd5b50610382610992366004612fe0565b611c76565b6103826109a5366004612fe0565b611d11565b3480156109b657600080fd5b5061045960115481565b3480156109cc57600080fd5b506103ce60405180604001604052806006815260200165076322e302e360d41b81525081565b6000546001600160a01b03163314610a255760405162461bcd60e51b8152600401610a1c9061318b565b60405180910390fd5b6101f4811115610a615760405162461bcd60e51b81526020600482015260076024820152663e4d617846656560c81b6044820152606401610a1c565b60038190556040518181527f721c401ac1df6aa6d76f66c40109ef145b3789fc067202fd5e3194ea0c2a4985906020015b60405180910390a150565b6000610aa882611e57565b92915050565b606060068054610abd906131c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae9906131c0565b8015610b365780601f10610b0b57610100808354040283529160200191610b36565b820191906000526020600020905b815481529060010190602001808311610b1957829003601f168201915b5050505050905090565b6000610b4b82611e7c565b506000828152600a60205260409020546001600160a01b0316610aa8565b610b74828233611eb5565b5050565b606060405180604001604052806006815260200165076322e302e360d41b8152506002604051602001610bac929190613297565b604051602081830303815290604052905090565b610bc8611ec2565b601154821015610c085760405162461bcd60e51b815260206004820152600b60248201526a2632b9b9aa3430b726b4b760a91b6044820152606401610a1c565b6000610c1383611733565b600554909150610c2e906001600160a01b0316333086611f1b565b6015805460009182610c3f836132e0565b919050559050610c4f8382611ff6565b80836001600160a01b0316336001600160a01b03167fd71e6ec4eed83207b08d7ee4a0773c0ff8f8a1ab94b8ce85737fc0c5ea2b5f0c87604051610c9591815260200190565b60405180910390a48184601454610cac91906132f9565b610cb6919061330c565b6014556000610cc3611663565b905060008260011480610cf8575060176000610ce060018661330c565b815260208101919091526040016000206001015460ff165b9050818411158015610d075750805b15610e0057600554604051630852cd8d60e31b8152600481018690526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610d5257600080fd5b505af1158015610d66573d6000803e3d6000fd5b5050505083601354610d7891906132f9565b601355604080516060810182528581526001602080830182815260008486018181528982526017909352858120945185559051939092018054915161ffff1990921693151561ff001916939093176101009115159190910217909155905184917f14fc547608262a6b59dc9947086c22fef6bd734a2a3326be072db772b59c784891a2610e6a565b83601254610e0e91906132f9565b60125560408051606081018252858152600060208083018281528385018381528884526017909252939091209151825591516001919091018054925115156101000261ff00199215159290921661ffff19909316929092171790555b50505050610b7460018055565b6001600160a01b038216610ea157604051633250574960e11b815260006004820152602401610a1c565b6000610eae83833361205b565b9050836001600160a01b0316816001600160a01b031614610efc576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610a1c565b50505050565b6000610f0d836115e5565b8210610f3e5760405163295f44f760e21b81526001600160a01b038416600482015260248101839052604401610a1c565b506001600160a01b03919091166000908152600c60209081526040808320938352929052205490565b610f6f611ec2565b33610f79836115da565b6001600160a01b031614610fba5760405162461bcd60e51b81526020600482015260086024820152672737ba27bbb732b960c11b6044820152606401610a1c565b6000828152601760205260409020600181015460ff1661100e5760405162461bcd60e51b815260206004820152600f60248201526e139bdd141c9bd8d95cdcd95916595d608a1b6044820152606401610a1c565b61101783612068565b60018101805461ff0019166101001790558054601354611037919061330c565b60135580546110479083906120a3565b805460405190815283906001600160a01b0384169033907f703e6da4e9727213d78008d5f4b0159c2f3a0319b5611466d660302cbfdb29599060200160405180910390a450610b7460018055565b6110b0838383604051806020016040528060008152506119c1565b505050565b610b746000823361205b565b6000546001600160a01b031633146110eb5760405162461bcd60e51b8152600401610a1c9061318b565b6000805b8281101561125e57600084848381811061110b5761110b61331f565b9050602002013590506000601760008381526020019081526020016000209050600081600001541161116c5760405162461bcd60e51b815260206004820152600a60248201526916995c9bd05b5bdd5b9d60b21b6044820152606401610a1c565b600181015460ff16156111b45760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e541c9bd8d95cdcd95960821b6044820152606401610a1c565b6001810154610100900460ff16156111ff5760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e50db185a5b595960921b6044820152606401610a1c565b6001818101805460ff19169091179055805461121b90856132f9565b60405190945082907f14fc547608262a6b59dc9947086c22fef6bd734a2a3326be072db772b59c784890600090a250508080611256906132e0565b9150506110ef565b506012548111156112b15760405162461bcd60e51b815260206004820152601d60248201527f546f74616c5769746864726177616c416d6f756e7445786365656465640000006044820152606401610a1c565b600554604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b1580156112f757600080fd5b505af115801561130b573d6000803e3d6000fd5b505050508060125461131d919061330c565b60125560135461132e9082906132f9565b601355505050565b6000611341600e5490565b821061136a5760405163295f44f760e21b81526000600482015260248101839052604401610a1c565b600e828154811061137d5761137d61331f565b90600052602060002001549050919050565b6000546001600160a01b031633146113b95760405162461bcd60e51b8152600401610a1c9061318b565b600081116113fd5760405162461bcd60e51b815260206004820152601160248201527016995c9bd35a5b95da5d1a191c985dd85b607a1b6044820152606401610a1c565b6001600160801b0381106114425760405162461bcd60e51b815260206004820152600c60248201526b4e65774d696e546f6f42696760a01b6044820152606401610a1c565b60118190556040518181527fda26802c7f7b25a88d02b53bf623c08480b433a6c6112cc1e33d7803e1673cf990602001610a92565b6000546001600160a01b031633146114a15760405162461bcd60e51b8152600401610a1c9061318b565b60006114ab611663565b9050600081116114f05760405162461bcd60e51b815260206004820152601060248201526f084c2d8c2dcc6ca9cdee88adcdeeaced60831b6044820152606401610a1c565b6114fa82826120a3565b6040518181526001600160a01b0383169033907f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb906020015b60405180910390a35050565b6000546001600160a01b031633146115695760405162461bcd60e51b8152600401610a1c9061318b565b6101f48111156115a55760405162461bcd60e51b81526020600482015260076024820152663e4d617846656560c81b6044820152606401610a1c565b60108190556040518181527fdf26583297f944258b4ad7a68f4ff7d7c5aa9a440776620fad8baf2ba562deb890602001610a92565b6000610aa882611e7c565b60006001600160a01b038216611611576040516322718ad960e21b815260006004820152602401610a1c565b506001600160a01b031660009081526009602052604090205490565b6000546001600160a01b031633146116575760405162461bcd60e51b8152600401610a1c9061318b565b61166160006120f4565b565b600080479050600060135482101561167d57506000610aa8565b60135461168a908361330c565b9392505050565b6060600061169e836115e5565b905060008167ffffffffffffffff8111156116bb576116bb61306f565b6040519080825280602002602001820160405280156116e4578160200160208202803683370190505b50905060005b8281101561172b576116fc8582610f02565b82828151811061170e5761170e61331f565b602090810291909101015280611723816132e0565b9150506116ea565b509392505050565b600080612710601054846117479190613335565b611751919061334c565b9050600061175f828561330c565b949350505050565b6000546001600160a01b031633146117915760405162461bcd60e51b8152600401610a1c9061318b565b6005546040516340c10f1960e01b81526001600160a01b03838116600483015260248201859052909116906340c10f1990604401600060405180830381600087803b1580156117df57600080fd5b505af11580156117f3573d6000803e3d6000fd5b50506040518481526001600160a01b03841692503391507fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f890602001611533565b606060078054610abd906131c0565b6000546001600160a01b0316331461186d5760405162461bcd60e51b8152600401610a1c9061318b565b600081116118ae5760405162461bcd60e51b815260206004820152600e60248201526d16995c9bd35a5b91195c1bdcda5d60921b6044820152606401610a1c565b6001600160801b0381106118f35760405162461bcd60e51b815260206004820152600c60248201526b4e65774d696e546f6f42696760a01b6044820152606401610a1c565b60048190556040518181527fbc4b9b4fa5f3e34af4236a368b445c3845cf5247dd7c971534685fa80c1cb0d990602001610a92565b610b74338383612144565b60028054611940906131c0565b80601f016020809104026020016040519081016040528092919081815260200182805461196c906131c0565b80156119b95780601f1061198e576101008083540402835291602001916119b9565b820191906000526020600020905b81548152906001019060200180831161199c57829003601f168201915b505050505081565b6119cc848484610e77565b610efc848484846121e3565b60606119e382611e7c565b5060006119ee612305565b6119f784612343565b604051602001611a0892919061336e565b60405160208183030381529060405290506000611a2484612343565b604051602001611a3491906133ac565b604051602081830303815290604052905060008183604051602001611a5a9291906133e0565b60405160208183030381529060405290506000611a76826123d6565b905080604051602001611a899190613457565b604051602081830303815290604052945050505050919050565b6000546001600160a01b03163314611acd5760405162461bcd60e51b8152600401610a1c9061318b565b600060145411611b0a5760405162461bcd60e51b81526020600482015260086024820152675a65726f4665657360c01b6044820152606401610a1c565b601480546000909155600554611b2a906001600160a01b031683836123fc565b6040518181526001600160a01b0383169033907f818a096114f8d6092a36dee454aa992148ea56ef2699c73bbab08018648c168490602001611533565b6000546001600160a01b03163314611b915760405162461bcd60e51b8152600401610a1c9061318b565b60055460405163f2fde38b60e01b81526001600160a01b0383811660048301529091169063f2fde38b90602401600060405180830381600087803b158015611bd857600080fd5b505af1158015611bec573d6000803e3d6000fd5b50506040516001600160a01b03841692507f398f34f5549656902b9a0238f99c6dd158ec5e7a6b1513a62348df24a757756e9150600090a250565b60188054611940906131c0565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b600080612710600354846117479190613335565b6000546001600160a01b03163314611ca05760405162461bcd60e51b8152600401610a1c9061318b565b6001600160a01b038116611d055760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a1c565b611d0e816120f4565b50565b611d19611ec2565b600454341015611d595760405162461bcd60e51b815260206004820152600b60248201526a2632b9b9aa3430b726b4b760a91b6044820152606401610a1c565b6000611d6434611c62565b905060008111611da75760405162461bcd60e51b815260206004820152600e60248201526d16995c9bd35a5b9d105b5bdd5b9d60921b6044820152606401610a1c565b6005546040516340c10f1960e01b81526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015611df557600080fd5b505af1158015611e09573d6000803e3d6000fd5b50506040513481526001600160a01b03851692503391507f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f629060200160405180910390a350611d0e60018055565b60006001600160e01b0319821663780e9d6360e01b1480610aa85750610aa8826124c5565b6000818152600860205260408120546001600160a01b031680610aa857604051637e27328960e01b815260048101849052602401610a1c565b6110b08383836001612515565b600260015403611f145760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a1c565b6002600155565b836001600160a01b03163b600003611f6c5760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610a1c565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d1160016000511416171691505080611fef5760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610a1c565b5050505050565b6001600160a01b03821661202057604051633250574960e11b815260006004820152602401610a1c565b600061202e8383600061205b565b90506001600160a01b038116156110b0576040516339e3563760e11b815260006004820152602401610a1c565b600061175f84848461261b565b6000612077600083600061205b565b90506001600160a01b038116610b7457604051637e27328960e01b815260048101839052602401610a1c565b600080600080600085875af19050806110b05760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610a1c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03821661217657604051630b61174360e31b81526001600160a01b0383166004820152602401610a1c565b6001600160a01b038381166000818152600b6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b15610efc57604051630a85bd0160e11b81526001600160a01b0384169063150b7a029061222590339088908790879060040161349c565b6020604051808303816000875af1925050508015612260575060408051601f3d908101601f1916820190925261225d918101906134d9565b60015b6122c9573d80801561228e576040519150601f19603f3d011682016040523d82523d6000602084013e612293565b606091505b5080516000036122c157604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611fef57604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b606046601661231382612343565b61231c306126e8565b60405160200161232e939291906134f6565b60405160208183030381529060405291505090565b60606000612350836126fe565b600101905060008167ffffffffffffffff8111156123705761237061306f565b6040519080825280601f01601f19166020018201604052801561239a576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846123a457509392505050565b6060610aa88260405180606001604052806040815260200161357c6040913960016127d6565b826001600160a01b03163b60000361244d5760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610a1c565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610efc5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610a1c565b60006001600160e01b031982166380ac58cd60e01b14806124f657506001600160e01b03198216635b5e139f60e01b145b80610aa857506301ffc9a760e01b6001600160e01b0319831614610aa8565b808061252957506001600160a01b03821615155b156125eb57600061253984611e7c565b90506001600160a01b038316158015906125655750826001600160a01b0316816001600160a01b031614155b801561257857506125768184611c34565b155b156125a15760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610a1c565b81156125e95783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50506000908152600a6020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b600080612629858585612956565b90506001600160a01b0381166126865761268184600e80546000838152600f60205260408120829055600182018355919091527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0155565b6126a9565b846001600160a01b0316816001600160a01b0316146126a9576126a98185612a4f565b6001600160a01b0385166126c5576126c084612ad0565b61175f565b846001600160a01b0316816001600160a01b03161461175f5761175f8585612b7f565b6060610aa86001600160a01b0383166014612bcf565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061273d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612769576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061278757662386f26fc10000830492506010015b6305f5e100831061279f576305f5e100830492506008015b61271083106127b357612710830492506004015b606483106127c5576064830492506002015b600a8310610aa85760010192915050565b606083516000036127f6575060408051602081019091526000815261168a565b6000826128275760038551600461280d9190613335565b6128189060026132f9565b612822919061334c565b61284c565b60038551600261283791906132f9565b612841919061334c565b61284c906004613335565b905060008167ffffffffffffffff8111156128695761286961306f565b6040519080825280601f01601f191660200182016040528015612893576020820181803683370190505b50905060018501602082018788518901602081018051600082525b82841015612909576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f81168701518653506001850194506128ae565b90525050851561294a5760038851066001811461292d576002811461294057612948565b603d6001830353603d6002830353612948565b603d60018303535b505b50909695505050505050565b6000828152600860205260408120546001600160a01b039081169083161561298357612983818486612d47565b6001600160a01b038116156129c1576129a0600085600080612515565b6001600160a01b038116600090815260096020526040902080546000190190555b6001600160a01b038516156129f0576001600160a01b0385166000908152600960205260409020805460010190555b60008481526008602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6000612a5a836115e5565b6000838152600d60209081526040808320546001600160a01b0388168452600c90925290912091925090818314612ab157600083815260208281526040808320548584528184208190558352600d90915290208290555b6000938452600d60209081526040808620869055938552525081205550565b600e54600090612ae29060019061330c565b6000838152600f6020526040812054600e8054939450909284908110612b0a57612b0a61331f565b9060005260206000200154905080600e8381548110612b2b57612b2b61331f565b6000918252602080832090910192909255828152600f9091526040808220849055858252812055600e805480612b6357612b6361354e565b6001900381819060005260206000200160009055905550505050565b60006001612b8c846115e5565b612b96919061330c565b6001600160a01b039093166000908152600c602090815260408083208684528252808320859055938252600d9052919091209190915550565b6060826000612bdf846002613335565b612bea9060026132f9565b67ffffffffffffffff811115612c0257612c0261306f565b6040519080825280601f01601f191660200182016040528015612c2c576020820181803683370190505b509050600360fc1b81600081518110612c4757612c4761331f565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612c7657612c7661331f565b60200101906001600160f81b031916908160001a9053506000612c9a856002613335565b612ca59060016132f9565b90505b6001811115612d1d576f181899199a1a9b1b9c1cb0b131b232b360811b83600f1660108110612cd957612cd961331f565b1a60f81b828281518110612cef57612cef61331f565b60200101906001600160f81b031916908160001a90535060049290921c91612d1681613564565b9050612ca8565b50811561175f5760405163e22e27eb60e01b81526004810186905260248101859052604401610a1c565b612d52838383612dab565b6110b0576001600160a01b038316612d8057604051637e27328960e01b815260048101829052602401610a1c565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610a1c565b60006001600160a01b0383161580159061175f5750826001600160a01b0316846001600160a01b03161480612de55750612de58484611c34565b8061175f5750506000908152600a60205260409020546001600160a01b03908116911614919050565b600060208284031215612e2057600080fd5b5035919050565b6001600160e01b031981168114611d0e57600080fd5b600060208284031215612e4f57600080fd5b813561168a81612e27565b60005b83811015612e75578181015183820152602001612e5d565b50506000910152565b60008151808452612e96816020860160208601612e5a565b601f01601f19169290920160200192915050565b60208152600061168a6020830184612e7e565b80356001600160a01b0381168114612ed457600080fd5b919050565b60008060408385031215612eec57600080fd5b612ef583612ebd565b946020939093013593505050565b60008060408385031215612f1657600080fd5b82359150612f2660208401612ebd565b90509250929050565b600080600060608486031215612f4457600080fd5b612f4d84612ebd565b9250612f5b60208501612ebd565b9150604084013590509250925092565b60008060208385031215612f7e57600080fd5b823567ffffffffffffffff80821115612f9657600080fd5b818501915085601f830112612faa57600080fd5b813581811115612fb957600080fd5b8660208260051b8501011115612fce57600080fd5b60209290920196919550909350505050565b600060208284031215612ff257600080fd5b61168a82612ebd565b6020808252825182820181905260009190848201906040850190845b8181101561294a57835183529284019291840191600101613017565b6000806040838503121561304657600080fd5b61304f83612ebd565b91506020830135801515811461306457600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561309b57600080fd5b6130a485612ebd565b93506130b260208601612ebd565b925060408501359150606085013567ffffffffffffffff808211156130d657600080fd5b818701915087601f8301126130ea57600080fd5b8135818111156130fc576130fc61306f565b604051601f8201601f19908116603f011681019083821181831017156131245761312461306f565b816040528281528a602084870101111561313d57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561317457600080fd5b61317d83612ebd565b9150612f2660208401612ebd565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806131d457607f821691505b6020821081036131f457634e487b7160e01b600052602260045260246000fd5b50919050565b8054600090600181811c908083168061321457607f831692505b6020808410820361323557634e487b7160e01b600052602260045260246000fd5b818015613249576001811461325e5761328b565b60ff198616895284151585028901965061328b565b60008881526020902060005b868110156132835781548b82015290850190830161326a565b505084890196505b50505050505092915050565b600083516132a9818460208801612e5a565b601d60f91b9083019081526132c160018201856131fa565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b6000600182016132f2576132f26132ca565b5060010190565b80820180821115610aa857610aa86132ca565b81810381811115610aa857610aa86132ca565b634e487b7160e01b600052603260045260246000fd5b8082028115828204841417610aa857610aa86132ca565b60008261336957634e487b7160e01b600052601260045260246000fd5b500490565b60008351613380818460208801612e5a565b835190830190613394818360208801612e5a565b632e706e6760e01b9101908152600401949350505050565b6b5769746864726177616c202360a01b8152600082516133d381600c850160208701612e5a565b91909101600c0192915050565b693d913730b6b2911d101160b11b8152825160009061340681600a850160208801612e5a565b6201116160ed1b600a91840191820152691134b6b0b3b2911d101160b11b600d820152835161343c816017840160208801612e5a565b61227d60f01b60179290910191820152601901949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161348f81601d850160208701612e5a565b91909101601d0192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906134cf90830184612e7e565b9695505050505050565b6000602082840312156134eb57600080fd5b815161168a81612e27565b600061350282866131fa565b602f60f81b808252855161351d816001850160208a01612e5a565b60019201918201819052845161353a816002850160208901612e5a565b600292019182015260030195945050505050565b634e487b7160e01b600052603160045260246000fd5b600081613573576135736132ca565b50600019019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122003014c0dc51adf93b08671649f19fde989e14caa5b320d63da62f5564df5e22964736f6c6343000815003368747470733a2f2f6170692e616363756d756c617465642e66696e616e63652f76312f6e66740000000000000000000000003557371afed82dd683de278924bd0e1a790a3c49
Deployed ByteCode
0x60806040526004361061031e5760003560e01c80638462151c116101ab578063c6d87dd5116100f7578063e985e9c511610095578063f2fde38b1161006f578063f2fde38b14610977578063f340fa0114610997578063f9abb1f1146109aa578063ffa1ad74146109c057600080fd5b8063e985e9c514610937578063eb6ed33014610880578063ef8b30f71461095757600080fd5b8063cf03ef89116100d1578063cf03ef89146108cc578063d6925460146108ec578063d73792a91461090c578063dbddb26a1461092257600080fd5b8063c6d87dd514610880578063c87b56dd14610896578063ca9a6da5146108b657600080fd5b80639a7be47111610164578063a8b9ef301161013e578063a8b9ef301461079f578063ae3df706146107b5578063ae485651146107ca578063b88d4fde1461086057600080fd5b80639a7be47114610749578063a22cb46514610769578063a4563e031461078957600080fd5b80638462151c146106935780638bc7e8c4146106c05780638da5cb5b146106d65780638e3a889e146106f457806394bf804d1461071457806395d89b411461073457600080fd5b806342966c681161026a578063569b8e2c1161022357806370a08231116101fd57806370a0823114610629578063715018a61461064957806372f702f31461065e5780637da2d1f41461067e57600080fd5b8063569b8e2c146105d35780636352211e146105f357806367a527931461061357600080fd5b806342966c681461051d57806344eaa9921461053d5780634a9122e31461055d5780634f6ccce71461057357806350d9065a1461059357806351cff8d9146105b357600080fd5b806318160ddd116102d75780632f745c59116102b15780632f745c59146104a75780633384d9fb146104c757806341b3d185146104e757806342842e0e146104fd57600080fd5b806318160ddd14610448578063217397791461046757806323b872dd1461048757600080fd5b8063017def571461036257806301ffc9a71461038457806306fdde03146103b9578063081812fc146103db578063095ea7b3146104135780630d8e6e2c1461043357600080fd5b3661035d57604080513381523460208201527f8e47b87b0ef542cdfa1659c551d88bad38aa7f452d2bbb349ab7530dfec8be8f910160405180910390a1005b600080fd5b34801561036e57600080fd5b5061038261037d366004612e0e565b6109f2565b005b34801561039057600080fd5b506103a461039f366004612e3d565b610a9d565b60405190151581526020015b60405180910390f35b3480156103c557600080fd5b506103ce610aae565b6040516103b09190612eaa565b3480156103e757600080fd5b506103fb6103f6366004612e0e565b610b40565b6040516001600160a01b0390911681526020016103b0565b34801561041f57600080fd5b5061038261042e366004612ed9565b610b69565b34801561043f57600080fd5b506103ce610b78565b34801561045457600080fd5b50600e545b6040519081526020016103b0565b34801561047357600080fd5b50610382610482366004612f03565b610bc0565b34801561049357600080fd5b506103826104a2366004612f2f565b610e77565b3480156104b357600080fd5b506104596104c2366004612ed9565b610f02565b3480156104d357600080fd5b506103826104e2366004612f03565b610f67565b3480156104f357600080fd5b5061045960045481565b34801561050957600080fd5b50610382610518366004612f2f565b611095565b34801561052957600080fd5b50610382610538366004612e0e565b6110b5565b34801561054957600080fd5b50610382610558366004612f6b565b6110c1565b34801561056957600080fd5b5061045960155481565b34801561057f57600080fd5b5061045961058e366004612e0e565b611336565b34801561059f57600080fd5b506103826105ae366004612e0e565b61138f565b3480156105bf57600080fd5b506103826105ce366004612fe0565b611477565b3480156105df57600080fd5b506103826105ee366004612e0e565b61153f565b3480156105ff57600080fd5b506103fb61060e366004612e0e565b6115da565b34801561061f57600080fd5b5061045960035481565b34801561063557600080fd5b50610459610644366004612fe0565b6115e5565b34801561065557600080fd5b5061038261162d565b34801561066a57600080fd5b506005546103fb906001600160a01b031681565b34801561068a57600080fd5b50610459611663565b34801561069f57600080fd5b506106b36106ae366004612fe0565b611691565b6040516103b09190612ffb565b3480156106cc57600080fd5b5061045960105481565b3480156106e257600080fd5b506000546001600160a01b03166103fb565b34801561070057600080fd5b5061045961070f366004612e0e565b611733565b34801561072057600080fd5b5061038261072f366004612f03565b611767565b34801561074057600080fd5b506103ce611834565b34801561075557600080fd5b50610382610764366004612e0e565b611843565b34801561077557600080fd5b50610382610784366004613033565b611928565b34801561079557600080fd5b5061045960125481565b3480156107ab57600080fd5b5061045960135481565b3480156107c157600080fd5b506103ce611933565b3480156107d657600080fd5b5061083a6107e5366004612e0e565b604080516060808201835260008083526020808401829052928401819052938452601782529282902082519384018352805484526001015460ff80821615159285019290925261010090041615159082015290565b6040805182518152602080840151151590820152918101511515908201526060016103b0565b34801561086c57600080fd5b5061038261087b366004613085565b6119c1565b34801561088c57600080fd5b506104596101f481565b3480156108a257600080fd5b506103ce6108b1366004612e0e565b6119d8565b3480156108c257600080fd5b5061045960145481565b3480156108d857600080fd5b506103826108e7366004612fe0565b611aa3565b3480156108f857600080fd5b50610382610907366004612fe0565b611b67565b34801561091857600080fd5b5061045961271081565b34801561092e57600080fd5b506103ce611c27565b34801561094357600080fd5b506103a4610952366004613161565b611c34565b34801561096357600080fd5b50610459610972366004612e0e565b611c62565b34801561098357600080fd5b50610382610992366004612fe0565b611c76565b6103826109a5366004612fe0565b611d11565b3480156109b657600080fd5b5061045960115481565b3480156109cc57600080fd5b506103ce60405180604001604052806006815260200165076322e302e360d41b81525081565b6000546001600160a01b03163314610a255760405162461bcd60e51b8152600401610a1c9061318b565b60405180910390fd5b6101f4811115610a615760405162461bcd60e51b81526020600482015260076024820152663e4d617846656560c81b6044820152606401610a1c565b60038190556040518181527f721c401ac1df6aa6d76f66c40109ef145b3789fc067202fd5e3194ea0c2a4985906020015b60405180910390a150565b6000610aa882611e57565b92915050565b606060068054610abd906131c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae9906131c0565b8015610b365780601f10610b0b57610100808354040283529160200191610b36565b820191906000526020600020905b815481529060010190602001808311610b1957829003601f168201915b5050505050905090565b6000610b4b82611e7c565b506000828152600a60205260409020546001600160a01b0316610aa8565b610b74828233611eb5565b5050565b606060405180604001604052806006815260200165076322e302e360d41b8152506002604051602001610bac929190613297565b604051602081830303815290604052905090565b610bc8611ec2565b601154821015610c085760405162461bcd60e51b815260206004820152600b60248201526a2632b9b9aa3430b726b4b760a91b6044820152606401610a1c565b6000610c1383611733565b600554909150610c2e906001600160a01b0316333086611f1b565b6015805460009182610c3f836132e0565b919050559050610c4f8382611ff6565b80836001600160a01b0316336001600160a01b03167fd71e6ec4eed83207b08d7ee4a0773c0ff8f8a1ab94b8ce85737fc0c5ea2b5f0c87604051610c9591815260200190565b60405180910390a48184601454610cac91906132f9565b610cb6919061330c565b6014556000610cc3611663565b905060008260011480610cf8575060176000610ce060018661330c565b815260208101919091526040016000206001015460ff165b9050818411158015610d075750805b15610e0057600554604051630852cd8d60e31b8152600481018690526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610d5257600080fd5b505af1158015610d66573d6000803e3d6000fd5b5050505083601354610d7891906132f9565b601355604080516060810182528581526001602080830182815260008486018181528982526017909352858120945185559051939092018054915161ffff1990921693151561ff001916939093176101009115159190910217909155905184917f14fc547608262a6b59dc9947086c22fef6bd734a2a3326be072db772b59c784891a2610e6a565b83601254610e0e91906132f9565b60125560408051606081018252858152600060208083018281528385018381528884526017909252939091209151825591516001919091018054925115156101000261ff00199215159290921661ffff19909316929092171790555b50505050610b7460018055565b6001600160a01b038216610ea157604051633250574960e11b815260006004820152602401610a1c565b6000610eae83833361205b565b9050836001600160a01b0316816001600160a01b031614610efc576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610a1c565b50505050565b6000610f0d836115e5565b8210610f3e5760405163295f44f760e21b81526001600160a01b038416600482015260248101839052604401610a1c565b506001600160a01b03919091166000908152600c60209081526040808320938352929052205490565b610f6f611ec2565b33610f79836115da565b6001600160a01b031614610fba5760405162461bcd60e51b81526020600482015260086024820152672737ba27bbb732b960c11b6044820152606401610a1c565b6000828152601760205260409020600181015460ff1661100e5760405162461bcd60e51b815260206004820152600f60248201526e139bdd141c9bd8d95cdcd95916595d608a1b6044820152606401610a1c565b61101783612068565b60018101805461ff0019166101001790558054601354611037919061330c565b60135580546110479083906120a3565b805460405190815283906001600160a01b0384169033907f703e6da4e9727213d78008d5f4b0159c2f3a0319b5611466d660302cbfdb29599060200160405180910390a450610b7460018055565b6110b0838383604051806020016040528060008152506119c1565b505050565b610b746000823361205b565b6000546001600160a01b031633146110eb5760405162461bcd60e51b8152600401610a1c9061318b565b6000805b8281101561125e57600084848381811061110b5761110b61331f565b9050602002013590506000601760008381526020019081526020016000209050600081600001541161116c5760405162461bcd60e51b815260206004820152600a60248201526916995c9bd05b5bdd5b9d60b21b6044820152606401610a1c565b600181015460ff16156111b45760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e541c9bd8d95cdcd95960821b6044820152606401610a1c565b6001810154610100900460ff16156111ff5760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e50db185a5b595960921b6044820152606401610a1c565b6001818101805460ff19169091179055805461121b90856132f9565b60405190945082907f14fc547608262a6b59dc9947086c22fef6bd734a2a3326be072db772b59c784890600090a250508080611256906132e0565b9150506110ef565b506012548111156112b15760405162461bcd60e51b815260206004820152601d60248201527f546f74616c5769746864726177616c416d6f756e7445786365656465640000006044820152606401610a1c565b600554604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b1580156112f757600080fd5b505af115801561130b573d6000803e3d6000fd5b505050508060125461131d919061330c565b60125560135461132e9082906132f9565b601355505050565b6000611341600e5490565b821061136a5760405163295f44f760e21b81526000600482015260248101839052604401610a1c565b600e828154811061137d5761137d61331f565b90600052602060002001549050919050565b6000546001600160a01b031633146113b95760405162461bcd60e51b8152600401610a1c9061318b565b600081116113fd5760405162461bcd60e51b815260206004820152601160248201527016995c9bd35a5b95da5d1a191c985dd85b607a1b6044820152606401610a1c565b6001600160801b0381106114425760405162461bcd60e51b815260206004820152600c60248201526b4e65774d696e546f6f42696760a01b6044820152606401610a1c565b60118190556040518181527fda26802c7f7b25a88d02b53bf623c08480b433a6c6112cc1e33d7803e1673cf990602001610a92565b6000546001600160a01b031633146114a15760405162461bcd60e51b8152600401610a1c9061318b565b60006114ab611663565b9050600081116114f05760405162461bcd60e51b815260206004820152601060248201526f084c2d8c2dcc6ca9cdee88adcdeeaced60831b6044820152606401610a1c565b6114fa82826120a3565b6040518181526001600160a01b0383169033907f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb906020015b60405180910390a35050565b6000546001600160a01b031633146115695760405162461bcd60e51b8152600401610a1c9061318b565b6101f48111156115a55760405162461bcd60e51b81526020600482015260076024820152663e4d617846656560c81b6044820152606401610a1c565b60108190556040518181527fdf26583297f944258b4ad7a68f4ff7d7c5aa9a440776620fad8baf2ba562deb890602001610a92565b6000610aa882611e7c565b60006001600160a01b038216611611576040516322718ad960e21b815260006004820152602401610a1c565b506001600160a01b031660009081526009602052604090205490565b6000546001600160a01b031633146116575760405162461bcd60e51b8152600401610a1c9061318b565b61166160006120f4565b565b600080479050600060135482101561167d57506000610aa8565b60135461168a908361330c565b9392505050565b6060600061169e836115e5565b905060008167ffffffffffffffff8111156116bb576116bb61306f565b6040519080825280602002602001820160405280156116e4578160200160208202803683370190505b50905060005b8281101561172b576116fc8582610f02565b82828151811061170e5761170e61331f565b602090810291909101015280611723816132e0565b9150506116ea565b509392505050565b600080612710601054846117479190613335565b611751919061334c565b9050600061175f828561330c565b949350505050565b6000546001600160a01b031633146117915760405162461bcd60e51b8152600401610a1c9061318b565b6005546040516340c10f1960e01b81526001600160a01b03838116600483015260248201859052909116906340c10f1990604401600060405180830381600087803b1580156117df57600080fd5b505af11580156117f3573d6000803e3d6000fd5b50506040518481526001600160a01b03841692503391507fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f890602001611533565b606060078054610abd906131c0565b6000546001600160a01b0316331461186d5760405162461bcd60e51b8152600401610a1c9061318b565b600081116118ae5760405162461bcd60e51b815260206004820152600e60248201526d16995c9bd35a5b91195c1bdcda5d60921b6044820152606401610a1c565b6001600160801b0381106118f35760405162461bcd60e51b815260206004820152600c60248201526b4e65774d696e546f6f42696760a01b6044820152606401610a1c565b60048190556040518181527fbc4b9b4fa5f3e34af4236a368b445c3845cf5247dd7c971534685fa80c1cb0d990602001610a92565b610b74338383612144565b60028054611940906131c0565b80601f016020809104026020016040519081016040528092919081815260200182805461196c906131c0565b80156119b95780601f1061198e576101008083540402835291602001916119b9565b820191906000526020600020905b81548152906001019060200180831161199c57829003601f168201915b505050505081565b6119cc848484610e77565b610efc848484846121e3565b60606119e382611e7c565b5060006119ee612305565b6119f784612343565b604051602001611a0892919061336e565b60405160208183030381529060405290506000611a2484612343565b604051602001611a3491906133ac565b604051602081830303815290604052905060008183604051602001611a5a9291906133e0565b60405160208183030381529060405290506000611a76826123d6565b905080604051602001611a899190613457565b604051602081830303815290604052945050505050919050565b6000546001600160a01b03163314611acd5760405162461bcd60e51b8152600401610a1c9061318b565b600060145411611b0a5760405162461bcd60e51b81526020600482015260086024820152675a65726f4665657360c01b6044820152606401610a1c565b601480546000909155600554611b2a906001600160a01b031683836123fc565b6040518181526001600160a01b0383169033907f818a096114f8d6092a36dee454aa992148ea56ef2699c73bbab08018648c168490602001611533565b6000546001600160a01b03163314611b915760405162461bcd60e51b8152600401610a1c9061318b565b60055460405163f2fde38b60e01b81526001600160a01b0383811660048301529091169063f2fde38b90602401600060405180830381600087803b158015611bd857600080fd5b505af1158015611bec573d6000803e3d6000fd5b50506040516001600160a01b03841692507f398f34f5549656902b9a0238f99c6dd158ec5e7a6b1513a62348df24a757756e9150600090a250565b60188054611940906131c0565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b600080612710600354846117479190613335565b6000546001600160a01b03163314611ca05760405162461bcd60e51b8152600401610a1c9061318b565b6001600160a01b038116611d055760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a1c565b611d0e816120f4565b50565b611d19611ec2565b600454341015611d595760405162461bcd60e51b815260206004820152600b60248201526a2632b9b9aa3430b726b4b760a91b6044820152606401610a1c565b6000611d6434611c62565b905060008111611da75760405162461bcd60e51b815260206004820152600e60248201526d16995c9bd35a5b9d105b5bdd5b9d60921b6044820152606401610a1c565b6005546040516340c10f1960e01b81526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015611df557600080fd5b505af1158015611e09573d6000803e3d6000fd5b50506040513481526001600160a01b03851692503391507f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f629060200160405180910390a350611d0e60018055565b60006001600160e01b0319821663780e9d6360e01b1480610aa85750610aa8826124c5565b6000818152600860205260408120546001600160a01b031680610aa857604051637e27328960e01b815260048101849052602401610a1c565b6110b08383836001612515565b600260015403611f145760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a1c565b6002600155565b836001600160a01b03163b600003611f6c5760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610a1c565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d1160016000511416171691505080611fef5760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610a1c565b5050505050565b6001600160a01b03821661202057604051633250574960e11b815260006004820152602401610a1c565b600061202e8383600061205b565b90506001600160a01b038116156110b0576040516339e3563760e11b815260006004820152602401610a1c565b600061175f84848461261b565b6000612077600083600061205b565b90506001600160a01b038116610b7457604051637e27328960e01b815260048101839052602401610a1c565b600080600080600085875af19050806110b05760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606401610a1c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03821661217657604051630b61174360e31b81526001600160a01b0383166004820152602401610a1c565b6001600160a01b038381166000818152600b6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b15610efc57604051630a85bd0160e11b81526001600160a01b0384169063150b7a029061222590339088908790879060040161349c565b6020604051808303816000875af1925050508015612260575060408051601f3d908101601f1916820190925261225d918101906134d9565b60015b6122c9573d80801561228e576040519150601f19603f3d011682016040523d82523d6000602084013e612293565b606091505b5080516000036122c157604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611fef57604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b606046601661231382612343565b61231c306126e8565b60405160200161232e939291906134f6565b60405160208183030381529060405291505090565b60606000612350836126fe565b600101905060008167ffffffffffffffff8111156123705761237061306f565b6040519080825280601f01601f19166020018201604052801561239a576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846123a457509392505050565b6060610aa88260405180606001604052806040815260200161357c6040913960016127d6565b826001600160a01b03163b60000361244d5760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610a1c565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610efc5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610a1c565b60006001600160e01b031982166380ac58cd60e01b14806124f657506001600160e01b03198216635b5e139f60e01b145b80610aa857506301ffc9a760e01b6001600160e01b0319831614610aa8565b808061252957506001600160a01b03821615155b156125eb57600061253984611e7c565b90506001600160a01b038316158015906125655750826001600160a01b0316816001600160a01b031614155b801561257857506125768184611c34565b155b156125a15760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610a1c565b81156125e95783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50506000908152600a6020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b600080612629858585612956565b90506001600160a01b0381166126865761268184600e80546000838152600f60205260408120829055600182018355919091527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0155565b6126a9565b846001600160a01b0316816001600160a01b0316146126a9576126a98185612a4f565b6001600160a01b0385166126c5576126c084612ad0565b61175f565b846001600160a01b0316816001600160a01b03161461175f5761175f8585612b7f565b6060610aa86001600160a01b0383166014612bcf565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061273d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612769576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061278757662386f26fc10000830492506010015b6305f5e100831061279f576305f5e100830492506008015b61271083106127b357612710830492506004015b606483106127c5576064830492506002015b600a8310610aa85760010192915050565b606083516000036127f6575060408051602081019091526000815261168a565b6000826128275760038551600461280d9190613335565b6128189060026132f9565b612822919061334c565b61284c565b60038551600261283791906132f9565b612841919061334c565b61284c906004613335565b905060008167ffffffffffffffff8111156128695761286961306f565b6040519080825280601f01601f191660200182016040528015612893576020820181803683370190505b50905060018501602082018788518901602081018051600082525b82841015612909576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f81168701518653506001850194506128ae565b90525050851561294a5760038851066001811461292d576002811461294057612948565b603d6001830353603d6002830353612948565b603d60018303535b505b50909695505050505050565b6000828152600860205260408120546001600160a01b039081169083161561298357612983818486612d47565b6001600160a01b038116156129c1576129a0600085600080612515565b6001600160a01b038116600090815260096020526040902080546000190190555b6001600160a01b038516156129f0576001600160a01b0385166000908152600960205260409020805460010190555b60008481526008602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6000612a5a836115e5565b6000838152600d60209081526040808320546001600160a01b0388168452600c90925290912091925090818314612ab157600083815260208281526040808320548584528184208190558352600d90915290208290555b6000938452600d60209081526040808620869055938552525081205550565b600e54600090612ae29060019061330c565b6000838152600f6020526040812054600e8054939450909284908110612b0a57612b0a61331f565b9060005260206000200154905080600e8381548110612b2b57612b2b61331f565b6000918252602080832090910192909255828152600f9091526040808220849055858252812055600e805480612b6357612b6361354e565b6001900381819060005260206000200160009055905550505050565b60006001612b8c846115e5565b612b96919061330c565b6001600160a01b039093166000908152600c602090815260408083208684528252808320859055938252600d9052919091209190915550565b6060826000612bdf846002613335565b612bea9060026132f9565b67ffffffffffffffff811115612c0257612c0261306f565b6040519080825280601f01601f191660200182016040528015612c2c576020820181803683370190505b509050600360fc1b81600081518110612c4757612c4761331f565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612c7657612c7661331f565b60200101906001600160f81b031916908160001a9053506000612c9a856002613335565b612ca59060016132f9565b90505b6001811115612d1d576f181899199a1a9b1b9c1cb0b131b232b360811b83600f1660108110612cd957612cd961331f565b1a60f81b828281518110612cef57612cef61331f565b60200101906001600160f81b031916908160001a90535060049290921c91612d1681613564565b9050612ca8565b50811561175f5760405163e22e27eb60e01b81526004810186905260248101859052604401610a1c565b612d52838383612dab565b6110b0576001600160a01b038316612d8057604051637e27328960e01b815260048101829052602401610a1c565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610a1c565b60006001600160a01b0383161580159061175f5750826001600160a01b0316846001600160a01b03161480612de55750612de58484611c34565b8061175f5750506000908152600a60205260409020546001600160a01b03908116911614919050565b600060208284031215612e2057600080fd5b5035919050565b6001600160e01b031981168114611d0e57600080fd5b600060208284031215612e4f57600080fd5b813561168a81612e27565b60005b83811015612e75578181015183820152602001612e5d565b50506000910152565b60008151808452612e96816020860160208601612e5a565b601f01601f19169290920160200192915050565b60208152600061168a6020830184612e7e565b80356001600160a01b0381168114612ed457600080fd5b919050565b60008060408385031215612eec57600080fd5b612ef583612ebd565b946020939093013593505050565b60008060408385031215612f1657600080fd5b82359150612f2660208401612ebd565b90509250929050565b600080600060608486031215612f4457600080fd5b612f4d84612ebd565b9250612f5b60208501612ebd565b9150604084013590509250925092565b60008060208385031215612f7e57600080fd5b823567ffffffffffffffff80821115612f9657600080fd5b818501915085601f830112612faa57600080fd5b813581811115612fb957600080fd5b8660208260051b8501011115612fce57600080fd5b60209290920196919550909350505050565b600060208284031215612ff257600080fd5b61168a82612ebd565b6020808252825182820181905260009190848201906040850190845b8181101561294a57835183529284019291840191600101613017565b6000806040838503121561304657600080fd5b61304f83612ebd565b91506020830135801515811461306457600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561309b57600080fd5b6130a485612ebd565b93506130b260208601612ebd565b925060408501359150606085013567ffffffffffffffff808211156130d657600080fd5b818701915087601f8301126130ea57600080fd5b8135818111156130fc576130fc61306f565b604051601f8201601f19908116603f011681019083821181831017156131245761312461306f565b816040528281528a602084870101111561313d57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561317457600080fd5b61317d83612ebd565b9150612f2660208401612ebd565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806131d457607f821691505b6020821081036131f457634e487b7160e01b600052602260045260246000fd5b50919050565b8054600090600181811c908083168061321457607f831692505b6020808410820361323557634e487b7160e01b600052602260045260246000fd5b818015613249576001811461325e5761328b565b60ff198616895284151585028901965061328b565b60008881526020902060005b868110156132835781548b82015290850190830161326a565b505084890196505b50505050505092915050565b600083516132a9818460208801612e5a565b601d60f91b9083019081526132c160018201856131fa565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b6000600182016132f2576132f26132ca565b5060010190565b80820180821115610aa857610aa86132ca565b81810381811115610aa857610aa86132ca565b634e487b7160e01b600052603260045260246000fd5b8082028115828204841417610aa857610aa86132ca565b60008261336957634e487b7160e01b600052601260045260246000fd5b500490565b60008351613380818460208801612e5a565b835190830190613394818360208801612e5a565b632e706e6760e01b9101908152600401949350505050565b6b5769746864726177616c202360a01b8152600082516133d381600c850160208701612e5a565b91909101600c0192915050565b693d913730b6b2911d101160b11b8152825160009061340681600a850160208801612e5a565b6201116160ed1b600a91840191820152691134b6b0b3b2911d101160b11b600d820152835161343c816017840160208801612e5a565b61227d60f01b60179290910191820152601901949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161348f81601d850160208701612e5a565b91909101601d0192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906134cf90830184612e7e565b9695505050505050565b6000602082840312156134eb57600080fd5b815161168a81612e27565b600061350282866131fa565b602f60f81b808252855161351d816001850160208a01612e5a565b60019201918201819052845161353a816002850160208901612e5a565b600292019182015260030195945050505050565b634e487b7160e01b600052603160045260246000fd5b600081613573576135736132ca565b50600019019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122003014c0dc51adf93b08671649f19fde989e14caa5b320d63da62f5564df5e22964736f6c63430008150033