Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- ERC404Factory
- Optimization enabled
- true
- Compiler version
- v0.8.24+commit.e11b9ed9
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-02-13T22:26:13.559894Z
Contract source code
// File: 404factory.sol
/**
*
*
* ██████╗ ██╗ ██╗██╗ ███████╗███████╗ ██████╗ ██████╗ ██╗███╗ ██╗
* ██╔══██╗██║ ██║██║ ██╔════╝██╔════╝██╔════╝██╔═══██╗██║████╗ ██║
* ██████╔╝██║ ██║██║ ███████╗█████╗ ██║ ██║ ██║██║██╔██╗ ██║
* ██╔═══╝ ██║ ██║██║ ╚════██║██╔══╝ ██║ ██║ ██║██║██║╚██╗██║
* ██║ ╚██████╔╝███████╗███████║███████╗╚██████╗╚██████╔╝██║██║ ╚████║
* ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝╚═╝ ╚═══╝
*
* @title PulseCoin ERC404 Factory Contract
* @notice This contract is released under the GNU General Public License v3.0
*
*
* Copyright (C) 2024 PulseCoin
*/
pragma solidity ^0.8.2;
contract ERC404Factory {
event ERC404Created(address indexed owner, address indexed newERC404Address, uint indexed contractIndex, address creator);
address[] public deployedERC404s;
uint public totalContracts; // Variable to store the total number of contracts created
address public feeTo; // Address to send fees
address private _owner; // Address of the contract owner
// Mapping to store the creator's address for each deployed contract
mapping(address => address) public contractCreators;
// New mapping to track available mints for each address
mapping(address => uint256) public availableMints;
modifier onlyOwner() {
require(msg.sender == _owner, "Caller is not the owner");
_;
}
constructor() {
_owner = msg.sender; // Set the deployer as the initial owner
feeTo = msg.sender; // Set the deployer as the feeTo address
}
// Function to set feeTo address, only callable by the contract owner
function setFeeTo(address _feeTo) public onlyOwner {
feeTo = _feeTo;
}
// Function to change the owner, only callable by the current owner
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "New owner is the zero address");
_owner = newOwner;
}
// Function to whitelist an address and set available mints
function whitelistAddress(address _address, uint256 _availableMints) public onlyOwner {
availableMints[_address] = _availableMints;
}
function createERC404WithETHFee(
string memory name,
string memory symbol,
uint8 decimals,
uint256 totalNativeSupply,
string[] memory imageUrls,
string[] memory colors
) public payable {
// Check if the user is whitelisted with available mints or requires to pay the fee
if (availableMints[msg.sender] < 1) {
require(msg.value == 1e23, "Fee is 100 thousand PLS");
payable(feeTo).transfer(msg.value);
availableMints[msg.sender] += 3; // Grant 3 available mints after payment
}
require(imageUrls.length == colors.length, "Image URLs and colors length mismatch");
PulseCoinERC404 newERC404 = new PulseCoinERC404(
name,
symbol,
decimals,
totalNativeSupply,
address(this),
msg.sender,
imageUrls,
colors
);
_finalizeContractCreation(newERC404, msg.sender);
availableMints[msg.sender] -= 1; // Deduct an available mint
}
function _finalizeContractCreation(PulseCoinERC404 newERC404, address creator) private {
address newERC404Address = address(newERC404);
deployedERC404s.push(newERC404Address);
contractCreators[newERC404Address] = creator;
emit ERC404Created(address(this), newERC404Address, totalContracts, creator);
totalContracts += 1;
newERC404.setWhitelist(newERC404Address, true);
newERC404.setWhitelist(creator, true);
newERC404.transferOwnership(creator);
}
function getERC404Address(uint index) public view returns (address) {
require(index < totalContracts, "Index out of bounds");
return deployedERC404s[index];
}
}
// File: @openzeppelin/contracts/utils/math/SignedMath.sol
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @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);
}
}
}
// File: @openzeppelin/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
/**
* @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));
}
}
// File: 404template.sol
pragma solidity ^0.8.0;
abstract contract Ownable {
event OwnershipTransferred(address indexed user, address indexed newOwner);
error Unauthorized();
error InvalidOwner();
address public owner;
modifier onlyOwner() virtual {
if (msg.sender != owner) revert Unauthorized();
_;
}
constructor(address _owner) {
if (_owner == address(0)) revert InvalidOwner();
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
function transferOwnership(address _owner) public virtual onlyOwner {
if (_owner == address(0)) revert InvalidOwner();
owner = _owner;
emit OwnershipTransferred(msg.sender, _owner);
}
function revokeOwnership() public virtual onlyOwner {
owner = address(0);
emit OwnershipTransferred(msg.sender, address(0));
}
}
abstract contract ERC721Receiver {
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external virtual returns (bytes4) {
return ERC721Receiver.onERC721Received.selector;
}
}
/// @notice ERC404
/// A gas-efficient, mixed ERC20 / ERC721 implementation
/// with native liquidity and fractionalization.
///
/// This is an experimental standard designed to integrate
/// with pre-existing ERC20 / ERC721 support as smoothly as
/// possible.
///
/// @dev In order to support full functionality of ERC20 and ERC721
/// supply assumptions are made that slightly constraint usage.
/// Ensure decimals are sufficiently large (standard 18 recommended)
/// as ids are effectively encoded in the lowest range of amounts.
///
/// NFTs are spent on ERC20 functions in a FILO queue, this is by
/// design.
///
abstract contract ERC404 is Ownable {
// Events
event ERC20Transfer(
address indexed from,
address indexed to,
uint256 amount
);
event Approval(
address indexed owner,
address indexed spender,
uint256 amount
);
event Transfer(
address indexed from,
address indexed to,
uint256 indexed id
);
event ERC721Approval(
address indexed owner,
address indexed spender,
uint256 indexed id
);
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
// Errors
error NotFound();
error AlreadyExists();
error InvalidRecipient();
error InvalidSender();
error UnsafeRecipient();
// Metadata
/// @dev Token name
string public name;
/// @dev Token symbol
string public symbol;
/// @dev Decimals for fractional representation
uint8 public immutable decimals;
/// @dev Total supply in fractionalized representation
uint256 public immutable totalSupply;
/// @dev Current mint counter, monotonically increasing to ensure accurate ownership
uint256 public minted;
// Mappings
/// @dev Balance of user in fractional representation
mapping(address => uint256) public balanceOf;
/// @dev Allowance of user in fractional representation
mapping(address => mapping(address => uint256)) public allowance;
/// @dev Approval in native representaion
mapping(uint256 => address) public getApproved;
/// @dev Approval for all in native representation
mapping(address => mapping(address => bool)) public isApprovedForAll;
/// @dev Owner of id in native representation
mapping(uint256 => address) internal _ownerOf;
/// @dev Array of owned ids in native representation
mapping(address => uint256[]) internal _owned;
/// @dev Tracks indices for the _owned mapping
mapping(uint256 => uint256) internal _ownedIndex;
/// @dev Addresses whitelisted from minting / burning for gas savings (pairs, routers, etc)
mapping(address => bool) public whitelist;
// Constructor
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalNativeSupply,
address _owner
) Ownable(_owner) {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalNativeSupply * (10 ** decimals);
}
/// @notice Initialization function to set pairs / etc
/// saving gas by avoiding mint / burn on unnecessary targets
function setWhitelist(address target, bool state) public onlyOwner {
whitelist[target] = state;
}
/// @notice Function to find owner of a given native token
function ownerOf(uint256 id) public view virtual returns (address owner) {
owner = _ownerOf[id];
if (owner == address(0)) {
revert NotFound();
}
}
/// @notice tokenURI must be implemented by child contract
function tokenURI(uint256 id) public view virtual returns (string memory);
/// @notice Function for token approvals
/// @dev This function assumes id / native if amount less than or equal to current max id
function approve(
address spender,
uint256 amountOrId
) public virtual returns (bool) {
if (amountOrId <= minted && amountOrId > 0) {
address owner = _ownerOf[amountOrId];
if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) {
revert Unauthorized();
}
getApproved[amountOrId] = spender;
emit Approval(owner, spender, amountOrId);
} else {
allowance[msg.sender][spender] = amountOrId;
emit Approval(msg.sender, spender, amountOrId);
}
return true;
}
/// @notice Function native approvals
function setApprovalForAll(address operator, bool approved) public virtual {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
/// @notice Function for mixed transfers
/// @dev This function assumes id / native if amount less than or equal to current max id
function transferFrom(
address from,
address to,
uint256 amountOrId
) public virtual {
if (amountOrId <= minted) {
if (from != _ownerOf[amountOrId]) {
revert InvalidSender();
}
if (to == address(0)) {
revert InvalidRecipient();
}
if (
msg.sender != from &&
!isApprovedForAll[from][msg.sender] &&
msg.sender != getApproved[amountOrId]
) {
revert Unauthorized();
}
balanceOf[from] -= _getUnit();
unchecked {
balanceOf[to] += _getUnit();
}
_ownerOf[amountOrId] = to;
delete getApproved[amountOrId];
// update _owned for sender
uint256 updatedId = _owned[from][_owned[from].length - 1];
_owned[from][_ownedIndex[amountOrId]] = updatedId;
// pop
_owned[from].pop();
// update index for the moved id
_ownedIndex[updatedId] = _ownedIndex[amountOrId];
// push token to to owned
_owned[to].push(amountOrId);
// update index for to owned
_ownedIndex[amountOrId] = _owned[to].length - 1;
emit Transfer(from, to, amountOrId);
emit ERC20Transfer(from, to, _getUnit());
} else {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max)
allowance[from][msg.sender] = allowed - amountOrId;
_transfer(from, to, amountOrId);
}
}
/// @notice Function for fractional transfers
function transfer(
address to,
uint256 amount
) public virtual returns (bool) {
return _transfer(msg.sender, to, amount);
}
/// @notice Function for native transfers with contract support
function safeTransferFrom(
address from,
address to,
uint256 id
) public virtual {
transferFrom(from, to, id);
if (
to.code.length != 0 &&
ERC721Receiver(to).onERC721Received(msg.sender, from, id, "") !=
ERC721Receiver.onERC721Received.selector
) {
revert UnsafeRecipient();
}
}
/// @notice Function for native transfers with contract support and callback data
function safeTransferFrom(
address from,
address to,
uint256 id,
bytes calldata data
) public virtual {
transferFrom(from, to, id);
if (
to.code.length != 0 &&
ERC721Receiver(to).onERC721Received(msg.sender, from, id, data) !=
ERC721Receiver.onERC721Received.selector
) {
revert UnsafeRecipient();
}
}
/// @notice Internal function for fractional transfers
function _transfer(
address from,
address to,
uint256 amount
) internal returns (bool) {
uint256 unit = _getUnit();
uint256 balanceBeforeSender = balanceOf[from];
uint256 balanceBeforeReceiver = balanceOf[to];
balanceOf[from] -= amount;
unchecked {
balanceOf[to] += amount;
}
// Skip burn for certain addresses to save gas
if (!whitelist[from]) {
uint256 tokens_to_burn = (balanceBeforeSender / unit) -
(balanceOf[from] / unit);
for (uint256 i = 0; i < tokens_to_burn; i++) {
_burn(from);
}
}
// Skip minting for certain addresses to save gas
if (!whitelist[to]) {
uint256 tokens_to_mint = (balanceOf[to] / unit) -
(balanceBeforeReceiver / unit);
for (uint256 i = 0; i < tokens_to_mint; i++) {
_mint(to);
}
}
emit ERC20Transfer(from, to, amount);
return true;
}
// Internal utility logic
function _getUnit() internal view returns (uint256) {
return 10 ** decimals;
}
function _mint(address to) internal virtual {
if (to == address(0)) {
revert InvalidRecipient();
}
unchecked {
minted++;
}
uint256 id = minted;
if (_ownerOf[id] != address(0)) {
revert AlreadyExists();
}
_ownerOf[id] = to;
_owned[to].push(id);
_ownedIndex[id] = _owned[to].length - 1;
emit Transfer(address(0), to, id);
}
function _burn(address from) internal virtual {
if (from == address(0)) {
revert InvalidSender();
}
uint256 id = _owned[from][_owned[from].length - 1];
_owned[from].pop();
delete _ownedIndex[id];
delete _ownerOf[id];
delete getApproved[id];
emit Transfer(from, address(0), id);
}
function _setNameSymbol(
string memory _name,
string memory _symbol
) internal {
name = _name;
symbol = _symbol;
}
}
// File: 404fee.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract PulseCoinERC404 is ERC404 {
string public dataURI;
string public baseTokenURI;
address private creator;
struct ImageData {
string url;
string color;
}
ImageData[] private images;
// Adjusted constructor to accept parallel arrays for image URLs and colors
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalNativeSupply,
address _owner,
address _creator,
string[] memory _imageUrls,
string[] memory _colors
) ERC404(_name, _symbol, _decimals, _totalNativeSupply, _owner) {
require(_imageUrls.length == _colors.length, "Image URLs and colors length mismatch");
creator = _creator;
balanceOf[_creator] = _totalNativeSupply * 10 ** _decimals;
// Automatically whitelist the creator to prevent unnecessary NFT minting
whitelist[_creator] = true;
// Initialize image data
for(uint i = 0; i < _imageUrls.length; i++) {
images.push(ImageData(_imageUrls[i], _colors[i]));
}
}
function setDataURI(string memory _dataURI) public onlyOwner {
dataURI = _dataURI;
}
function setTokenURI(string memory _tokenURI) public {
require(msg.sender == creator, "Only creator can set token URI");
baseTokenURI = _tokenURI;
}
function setNameSymbol(string memory _name, string memory _symbol) public {
require(msg.sender == creator, "Only creator can set name and symbol");
name = _name;
symbol = _symbol;
}
// Function to generate token URI with dynamic metadata based on the seed value
function tokenURI(uint256 id) public view override returns (string memory) {
require(_ownerOf[id] != address(0), "ERC721Metadata: URI query for nonexistent token");
uint8 seed = uint8(uint256(keccak256(abi.encodePacked(id))) % 256);
string memory image;
string memory color;
// Use the predefined image URLs based on the seed value
if (seed <= 100) {
image = images[0].url;
color = images[0].color;
} else if (seed <= 160) {
image = images[1].url;
color = images[1].color;
} else if (seed <= 210) {
image = images[2].url;
color = images[2].color;
} else if (seed <= 240) {
image = images[3].url;
color = images[3].color;
} else {
image = images[4].url;
color = images[4].color;
}
// Dynamically construct the JSON metadata to reflect the actual token name and attributes
string memory json = string(abi.encodePacked(
'{"name": "', name, ' #', Strings.toString(id),
'","description":"A collection of Hybrid ERC404 NFTs, made by PulseCoin Factory",',
'"external_url":"https://pulsecoin.io","image":"', dataURI, image,
'","attributes":[{"trait_type":"Color","value":"', color, '"}]}'
));
return string(abi.encodePacked("data:application/json;utf8,", json));
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"ERC404Created","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"newERC404Address","internalType":"address","indexed":true},{"type":"uint256","name":"contractIndex","internalType":"uint256","indexed":true},{"type":"address","name":"creator","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"availableMints","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"contractCreators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"createERC404WithETHFee","inputs":[{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"uint8","name":"decimals","internalType":"uint8"},{"type":"uint256","name":"totalNativeSupply","internalType":"uint256"},{"type":"string[]","name":"imageUrls","internalType":"string[]"},{"type":"string[]","name":"colors","internalType":"string[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"deployedERC404s","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeTo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getERC404Address","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeTo","inputs":[{"type":"address","name":"_feeTo","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalContracts","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"whitelistAddress","inputs":[{"type":"address","name":"_address","internalType":"address"},{"type":"uint256","name":"_availableMints","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561000f575f80fd5b5060038054336001600160a01b0319918216811790925560028054909116909117905561372c8061003f5f395ff3fe6080604052600436106200009b575f3560e01c8063d66b3eda116200005e578063d66b3eda1462000178578063d6fd654514620001a7578063f2fde38b14620001cb578063f46901ed14620001ef578063ff05e4f41462000213575f80fd5b8063017e7e58146200009f578063200c729514620000dd578063589ab4a5146200010357806385714768146200011a578063a09037a91462000152575b5f80fd5b348015620000ab575f80fd5b50600254620000c0906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b348015620000e9575f80fd5b5062000101620000fb366004620007d2565b62000237565b005b62000101620001143660046200096f565b62000288565b34801562000126575f80fd5b50620000c06200013836600462000a3c565b60046020525f90815260409020546001600160a01b031681565b3480156200015e575f80fd5b506200016960015481565b604051908152602001620000d4565b34801562000184575f80fd5b50620001696200019636600462000a3c565b60056020525f908152604090205481565b348015620001b3575f80fd5b50620000c0620001c536600462000a5f565b6200043d565b348015620001d7575f80fd5b5062000101620001e936600462000a3c565b62000465565b348015620001fb575f80fd5b50620001016200020d36600462000a3c565b6200050c565b3480156200021f575f80fd5b50620000c06200023136600462000a5f565b6200055b565b6003546001600160a01b031633146200026d5760405162461bcd60e51b8152600401620002649062000a77565b60405180910390fd5b6001600160a01b039091165f90815260056020526040902055565b335f90815260056020526040902054600111156200035a573469152d02c7e14af680000014620002fb5760405162461bcd60e51b815260206004820152601760248201527f466565206973203130302074686f7573616e6420504c53000000000000000000604482015260640162000264565b6002546040516001600160a01b03909116903480156108fc02915f818181858888f1935050505015801562000332573d5f803e3d5ffd5b50335f9081526005602052604081208054600392906200035490849062000ac2565b90915550505b8051825114620003bb5760405162461bcd60e51b815260206004820152602560248201527f496d6167652055524c7320616e6420636f6c6f7273206c656e677468206d69736044820152640dac2e8c6d60db1b606482015260840162000264565b5f8686868630338888604051620003d290620007a8565b620003e598979695949392919062000b7f565b604051809103905ff080158015620003ff573d5f803e3d5ffd5b5090506200040e8133620005d4565b335f9081526005602052604081208054600192906200042f90849062000c0c565b909155505050505050505050565b5f81815481106200044c575f80fd5b5f918252602090912001546001600160a01b0316905081565b6003546001600160a01b03163314620004925760405162461bcd60e51b8152600401620002649062000a77565b6001600160a01b038116620004ea5760405162461bcd60e51b815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015260640162000264565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314620005395760405162461bcd60e51b8152600401620002649062000a77565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f6001548210620005a55760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640162000264565b5f8281548110620005ba57620005ba62000c22565b5f918252602090912001546001600160a01b031692915050565b5f8054600180820183557f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56390910180546001600160a01b038681166001600160a01b031992831681179093558285526004602090815260409586902080549288169290931682179092559254935192835285939230917fcbdc4752987606059c4afbe1a576531b2a18395ec6988c6d48c8c48027cdf106910160405180910390a46001805f82825462000688919062000ac2565b90915550506040516353d6fd5960e01b81526001600160a01b038281166004830152600160248301528416906353d6fd59906044015f604051808303815f87803b158015620006d5575f80fd5b505af1158015620006e8573d5f803e3d5ffd5b50506040516353d6fd5960e01b81526001600160a01b03858116600483015260016024830152861692506353d6fd5991506044015f604051808303815f87803b15801562000734575f80fd5b505af115801562000747573d5f803e3d5ffd5b505060405163f2fde38b60e01b81526001600160a01b0385811660048301528616925063f2fde38b91506024015f604051808303815f87803b1580156200078c575f80fd5b505af11580156200079f573d5f803e3d5ffd5b50505050505050565b612ac08062000c3783390190565b80356001600160a01b0381168114620007cd575f80fd5b919050565b5f8060408385031215620007e4575f80fd5b620007ef83620007b6565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156200083d576200083d620007fd565b604052919050565b5f82601f83011262000855575f80fd5b813567ffffffffffffffff811115620008725762000872620007fd565b62000887601f8201601f191660200162000811565b8181528460208386010111156200089c575f80fd5b816020850160208301375f918101602001919091529392505050565b803560ff81168114620007cd575f80fd5b5f82601f830112620008d9575f80fd5b8135602067ffffffffffffffff80831115620008f957620008f9620007fd565b8260051b6200090a83820162000811565b938452858101830193838101908886111562000924575f80fd5b84880192505b85831015620009635782358481111562000942575f80fd5b620009528a87838c010162000845565b83525091840191908401906200092a565b98975050505050505050565b5f805f805f8060c0878903121562000985575f80fd5b863567ffffffffffffffff808211156200099d575f80fd5b620009ab8a838b0162000845565b97506020890135915080821115620009c1575f80fd5b620009cf8a838b0162000845565b9650620009df60408a01620008b8565b9550606089013594506080890135915080821115620009fc575f80fd5b62000a0a8a838b01620008c9565b935060a089013591508082111562000a20575f80fd5b5062000a2f89828a01620008c9565b9150509295509295509295565b5f6020828403121562000a4d575f80fd5b62000a5882620007b6565b9392505050565b5f6020828403121562000a70575f80fd5b5035919050565b60208082526017908201527f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b8082018082111562000ad85762000ad862000aae565b92915050565b5f81518084525f5b8181101562000b045760208185018101518683018201520162000ae6565b505f602082860101526020601f19601f83011685010191505092915050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101562000b7257601f1986840301895262000b5f83835162000ade565b9884019892509083019060010162000b40565b5090979650505050505050565b5f61010080835262000b948184018c62000ade565b9050828103602084015262000baa818b62000ade565b60ff8a166040850152606084018990526001600160a01b038881166080860152871660a085015283810360c0850152905062000be7818662000b23565b905082810360e084015262000bfd818562000b23565b9b9a5050505050505050505050565b8181038181111562000ad85762000ad862000aae565b634e487b7160e01b5f52603260045260245ffdfe60c060405234801562000010575f80fd5b5060405162002ac038038062002ac0833981016040819052620000339162000411565b8787878787806001600160a01b03811662000061576040516349e27cff60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b03831690811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001620000b786826200058d565b506002620000c685826200058d565b5060ff83166080819052620000dd90600a62000768565b620000e990836200077f565b60a052505083518551149250620001579150505760405162461bcd60e51b815260206004820152602560248201527f496d6167652055524c7320616e6420636f6c6f7273206c656e677468206d69736044820152640dac2e8c6d60db1b606482015260840160405180910390fd5b600e80546001600160a01b0319166001600160a01b0385161790556200017f86600a62000768565b6200018b90866200077f565b6001600160a01b0384165f90815260046020908152604080832093909355600b9052908120805460ff191660011790555b82518110156200026157600f6040518060400160405280858481518110620001e857620001e862000799565b602002602001015181526020018484815181106200020a576200020a62000799565b60209081029190910181015190915282546001810184555f938452922081519192600202019081906200023e90826200058d565b50602082015160018201906200025590826200058d565b505050600101620001bc565b505050505050505050620007ad565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715620002af57620002af62000270565b604052919050565b5f82601f830112620002c7575f80fd5b81516001600160401b03811115620002e357620002e362000270565b6020620002f9601f8301601f1916820162000284565b82815285828487010111156200030d575f80fd5b5f5b838110156200032c5785810183015182820184015282016200030f565b505f928101909101919091529392505050565b805160ff8116811462000350575f80fd5b919050565b80516001600160a01b038116811462000350575f80fd5b5f82601f8301126200037c575f80fd5b815160206001600160401b03808311156200039b576200039b62000270565b8260051b620003ac83820162000284565b9384528581018301938381019088861115620003c6575f80fd5b84880192505b858310156200040557825184811115620003e4575f80fd5b620003f48a87838c0101620002b7565b8352509184019190840190620003cc565b98975050505050505050565b5f805f805f805f80610100898b0312156200042a575f80fd5b88516001600160401b038082111562000441575f80fd5b6200044f8c838d01620002b7565b995060208b015191508082111562000465575f80fd5b620004738c838d01620002b7565b98506200048360408c016200033f565b975060608b015196506200049a60808c0162000355565b9550620004aa60a08c0162000355565b945060c08b0151915080821115620004c0575f80fd5b620004ce8c838d016200036c565b935060e08b0151915080821115620004e4575f80fd5b50620004f38b828c016200036c565b9150509295985092959890939650565b600181811c908216806200051857607f821691505b6020821081036200053757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200058857805f5260205f20601f840160051c81016020851015620005645750805b601f840160051c820191505b8181101562000585575f815560010162000570565b50505b505050565b81516001600160401b03811115620005a957620005a962000270565b620005c181620005ba845462000503565b846200053d565b602080601f831160018114620005f7575f8415620005df5750858301515b5f19600386901b1c1916600185901b17855562000651565b5f85815260208120601f198616915b82811015620006275788860151825594840194600190910190840162000606565b50858210156200064557878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52601160045260245ffd5b600181815b80851115620006ad57815f190482111562000691576200069162000659565b808516156200069f57918102915b93841c939080029062000672565b509250929050565b5f82620006c55750600162000762565b81620006d357505f62000762565b8160018114620006ec5760028114620006f75762000717565b600191505062000762565b60ff8411156200070b576200070b62000659565b50506001821b62000762565b5060208310610133831016604e8410600b84101617156200073c575081810a62000762565b6200074883836200066d565b805f19048211156200075e576200075e62000659565b0290505b92915050565b5f6200077860ff841683620006b5565b9392505050565b808202811582820484141762000762576200076262000659565b634e487b7160e01b5f52603260045260245ffd5b60805160a0516122ea620007d65f395f61022b01525f818161029001526114c101526122ea5ff3fe608060405234801561000f575f80fd5b50600436106101a1575f3560e01c806370a08231116100f3578063c87b56dd11610093578063e0df5b6f1161006e578063e0df5b6f146103f2578063e985e9c514610405578063f28ca1dd14610432578063f2fde38b1461043a575f80fd5b8063c87b56dd146103ad578063d547cfb7146103c0578063dd62ed3e146103c8575f80fd5b80639b19251a116100ce5780639b19251a14610352578063a22cb46514610374578063a9059cbb14610387578063b88d4fde1461039a575f80fd5b806370a08231146103195780638da5cb5b1461033857806395d89b411461034a575f80fd5b80632b9689581161015e5780634f02c420116101395780634f02c420146102d7578063504334c2146102e057806353d6fd59146102f35780636352211e14610306575f80fd5b80632b96895814610283578063313ce5671461028b57806342842e0e146102c4575f80fd5b806306fdde03146101a5578063081812fc146101c3578063095ea7b31461020357806318160ddd1461022657806318d217c31461025b57806323b872dd14610270575b5f80fd5b6101ad61044d565b6040516101ba9190611a43565b60405180910390f35b6101eb6101d1366004611a75565b60066020525f90815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016101ba565b610216610211366004611aa2565b6104d9565b60405190151581526020016101ba565b61024d7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101ba565b61026e610269366004611b67565b610624565b005b61026e61027e366004611ba1565b61065d565b61026e6109d9565b6102b27f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016101ba565b61026e6102d2366004611ba1565b610a3d565b61024d60035481565b61026e6102ee366004611bda565b610b0e565b61026e610301366004611c3a565b610b92565b6101eb610314366004611a75565b610be5565b61024d610327366004611c73565b60046020525f908152604090205481565b5f546101eb906001600160a01b031681565b6101ad610c1f565b610216610360366004611c73565b600b6020525f908152604090205460ff1681565b61026e610382366004611c3a565b610c2c565b610216610395366004611aa2565b610c97565b61026e6103a8366004611c8c565b610caa565b6101ad6103bb366004611a75565b610d6a565b6101ad6113a1565b61024d6103d6366004611d1f565b600560209081525f928352604080842090915290825290205481565b61026e610400366004611b67565b6113ae565b610216610413366004611d1f565b600760209081525f928352604080842090915290825290205460ff1681565b6101ad611414565b61026e610448366004611c73565b611421565b6001805461045a90611d50565b80601f016020809104026020016040519081016040528092919081815260200182805461048690611d50565b80156104d15780601f106104a8576101008083540402835291602001916104d1565b820191905f5260205f20905b8154815290600101906020018083116104b457829003601f168201915b505050505081565b5f60035482111580156104eb57505f82115b156105bf575f828152600860205260409020546001600160a01b031633811480159061053a57506001600160a01b0381165f90815260076020908152604080832033845290915290205460ff16155b15610557576040516282b42960e81b815260040160405180910390fd5b5f8381526006602090815260409182902080546001600160a01b0319166001600160a01b038881169182179092559251868152908416917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35061061a565b335f8181526005602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35b5060015b92915050565b5f546001600160a01b0316331461064d576040516282b42960e81b815260040160405180910390fd5b600c6106598282611dcc565b5050565b600354811161096d575f818152600860205260409020546001600160a01b0384811691161461069f57604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b0382166106c657604051634e46966960e11b815260040160405180910390fd5b336001600160a01b0384161480159061070257506001600160a01b0383165f90815260076020908152604080832033845290915290205460ff16155b801561072457505f818152600660205260409020546001600160a01b03163314155b15610741576040516282b42960e81b815260040160405180910390fd5b6107496114bb565b6001600160a01b0384165f9081526004602052604081208054909190610770908490611ea0565b9091555061077e90506114bb565b6001600160a01b038084165f81815260046020908152604080832080549096019095558582526008815284822080546001600160a01b0319908116909417905560068152848220805490931690925591861682526009905290812080546107e790600190611ea0565b815481106107f7576107f7611eb3565b5f9182526020808320909101546001600160a01b0387168352600982526040808420868552600a9093529092205481549293508392811061083a5761083a611eb3565b5f9182526020808320909101929092556001600160a01b038616815260099091526040902080548061086e5761086e611ec7565b5f828152602080822083015f19908101839055909201909255838252600a8152604080832054848452818420556001600160a01b0386168084526009835290832080546001818101835582865293852001869055925290546108d09190611ea0565b5f838152600a602052604080822092909255905183916001600160a01b0380871692908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4826001600160a01b0316846001600160a01b03167fe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e0314876109566114bb565b60405190815260200160405180910390a350505050565b6001600160a01b0383165f9081526005602090815260408083203384529091529020545f1981146109c6576109a28282611ea0565b6001600160a01b0385165f9081526005602090815260408083203384529091529020555b6109d18484846114ec565b50505b505050565b5f546001600160a01b03163314610a02576040516282b42960e81b815260040160405180910390fd5b5f80546001600160a01b031916815560405133907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3565b610a4883838361065d565b6001600160a01b0382163b15801590610af05750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401525f608484015290919084169063150b7a029060a4016020604051808303815f875af1158015610abf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ae39190611edb565b6001600160e01b03191614155b156109d457604051633da6393160e01b815260040160405180910390fd5b600e546001600160a01b03163314610b795760405162461bcd60e51b8152602060048201526024808201527f4f6e6c792063726561746f722063616e20736574206e616d6520616e642073796044820152631b589bdb60e21b60648201526084015b60405180910390fd5b6001610b858382611dcc565b5060026109d48282611dcc565b5f546001600160a01b03163314610bbb576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b5f818152600860205260409020546001600160a01b031680610c1a5760405163c5723b5160e01b815260040160405180910390fd5b919050565b6002805461045a90611d50565b335f8181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b5f610ca33384846114ec565b9392505050565b610cb585858561065d565b6001600160a01b0384163b15801590610d4c5750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290610cff9033908a90899089908990600401611f02565b6020604051808303815f875af1158015610d1b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d3f9190611edb565b6001600160e01b03191614155b156109d157604051633da6393160e01b815260040160405180910390fd5b5f818152600860205260409020546060906001600160a01b0316610de85760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b70565b5f61010083604051602001610dff91815260200190565b604051602081830303815290604052805190602001205f1c610e219190611f68565b905060608060648360ff1611610f8b57600f5f81548110610e4457610e44611eb3565b905f5260205f2090600202015f018054610e5d90611d50565b80601f0160208091040260200160405190810160405280929190818152602001828054610e8990611d50565b8015610ed45780601f10610eab57610100808354040283529160200191610ed4565b820191905f5260205f20905b815481529060010190602001808311610eb757829003601f168201915b50505050509150600f5f81548110610eee57610eee611eb3565b905f5260205f2090600202016001018054610f0890611d50565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3490611d50565b8015610f7f5780601f10610f5657610100808354040283529160200191610f7f565b820191905f5260205f20905b815481529060010190602001808311610f6257829003601f168201915b50505050509050611341565b60a08360ff161161105557600f600181548110610faa57610faa611eb3565b905f5260205f2090600202015f018054610fc390611d50565b80601f0160208091040260200160405190810160405280929190818152602001828054610fef90611d50565b801561103a5780601f106110115761010080835404028352916020019161103a565b820191905f5260205f20905b81548152906001019060200180831161101d57829003601f168201915b50505050509150600f600181548110610eee57610eee611eb3565b60d28360ff161161111f57600f60028154811061107457611074611eb3565b905f5260205f2090600202015f01805461108d90611d50565b80601f01602080910402602001604051908101604052809291908181526020018280546110b990611d50565b80156111045780601f106110db57610100808354040283529160200191611104565b820191905f5260205f20905b8154815290600101906020018083116110e757829003601f168201915b50505050509150600f600281548110610eee57610eee611eb3565b60f08360ff16116111e957600f60038154811061113e5761113e611eb3565b905f5260205f2090600202015f01805461115790611d50565b80601f016020809104026020016040519081016040528092919081815260200182805461118390611d50565b80156111ce5780601f106111a5576101008083540402835291602001916111ce565b820191905f5260205f20905b8154815290600101906020018083116111b157829003601f168201915b50505050509150600f600381548110610eee57610eee611eb3565b600f6004815481106111fd576111fd611eb3565b905f5260205f2090600202015f01805461121690611d50565b80601f016020809104026020016040519081016040528092919081815260200182805461124290611d50565b801561128d5780601f106112645761010080835404028352916020019161128d565b820191905f5260205f20905b81548152906001019060200180831161127057829003601f168201915b50505050509150600f6004815481106112a8576112a8611eb3565b905f5260205f20906002020160010180546112c290611d50565b80601f01602080910402602001604051908101604052809291908181526020018280546112ee90611d50565b80156113395780601f1061131057610100808354040283529160200191611339565b820191905f5260205f20905b81548152906001019060200180831161131c57829003601f168201915b505050505090505b5f600161134d87611691565b600c8585604051602001611365959493929190612005565b604051602081830303815290604052905080604051602001611387919061216f565b604051602081830303815290604052945050505050919050565b600d805461045a90611d50565b600e546001600160a01b031633146114085760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c792063726561746f722063616e2073657420746f6b656e2055524900006044820152606401610b70565b600d6106598282611dcc565b600c805461045a90611d50565b5f546001600160a01b0316331461144a576040516282b42960e81b815260040160405180910390fd5b6001600160a01b038116611471576040516349e27cff60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b5f6114e77f0000000000000000000000000000000000000000000000000000000000000000600a612293565b905090565b5f806114f66114bb565b6001600160a01b038087165f818152600460205260408082208054948a16835290822054928252939450919290918691906115318386611ea0565b90915550506001600160a01b038087165f90815260046020908152604080832080548a019055928a168252600b9052205460ff166115c0576001600160a01b0387165f9081526004602052604081205461158c9085906122a1565b61159685856122a1565b6115a09190611ea0565b90505f5b818110156115bd576115b589611721565b6001016115a4565b50505b6001600160a01b0386165f908152600b602052604090205460ff16611637575f6115ea84836122a1565b6001600160a01b0388165f9081526004602052604090205461160d9086906122a1565b6116179190611ea0565b90505f5b818110156116345761162c88611842565b60010161161b565b50505b856001600160a01b0316876001600160a01b03167fe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e0314878760405161167c91815260200190565b60405180910390a35060019695505050505050565b60605f61169d8361194a565b60010190505f8167ffffffffffffffff8111156116bc576116bc611aca565b6040519080825280601f01601f1916602001820160405280156116e6576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846116f057509392505050565b6001600160a01b03811661174857604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b0381165f908152600960205260408120805461176d90600190611ea0565b8154811061177d5761177d611eb3565b905f5260205f200154905060095f836001600160a01b03166001600160a01b031681526020019081526020015f208054806117ba576117ba611ec7565b5f828152602080822083015f19908101839055909201909255828252600a815260408083208390556008825280832080546001600160a01b031990811690915560069092528083208054909216909155518291906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b03811661186957604051634e46966960e11b815260040160405180910390fd5b60038054600101908190555f818152600860205260409020546001600160a01b0316156118a95760405163119b4fd360e11b815260040160405180910390fd5b5f81815260086020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558084526009835290832080546001818101835582865293852001859055925290546119009190611ea0565b5f828152600a602052604080822092909255905182916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106119885772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106119b4576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106119d257662386f26fc10000830492506010015b6305f5e10083106119ea576305f5e100830492506008015b61271083106119fe57612710830492506004015b60648310611a10576064830492506002015b600a831061061e5760010192915050565b5f5b83811015611a3b578181015183820152602001611a23565b50505f910152565b602081525f8251806020840152611a61816040850160208701611a21565b601f01601f19169190910160400192915050565b5f60208284031215611a85575f80fd5b5035919050565b80356001600160a01b0381168114610c1a575f80fd5b5f8060408385031215611ab3575f80fd5b611abc83611a8c565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611aed575f80fd5b813567ffffffffffffffff80821115611b0857611b08611aca565b604051601f8301601f19908116603f01168101908282118183101715611b3057611b30611aca565b81604052838152866020858801011115611b48575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f60208284031215611b77575f80fd5b813567ffffffffffffffff811115611b8d575f80fd5b611b9984828501611ade565b949350505050565b5f805f60608486031215611bb3575f80fd5b611bbc84611a8c565b9250611bca60208501611a8c565b9150604084013590509250925092565b5f8060408385031215611beb575f80fd5b823567ffffffffffffffff80821115611c02575f80fd5b611c0e86838701611ade565b93506020850135915080821115611c23575f80fd5b50611c3085828601611ade565b9150509250929050565b5f8060408385031215611c4b575f80fd5b611c5483611a8c565b915060208301358015158114611c68575f80fd5b809150509250929050565b5f60208284031215611c83575f80fd5b610ca382611a8c565b5f805f805f60808688031215611ca0575f80fd5b611ca986611a8c565b9450611cb760208701611a8c565b935060408601359250606086013567ffffffffffffffff80821115611cda575f80fd5b818801915088601f830112611ced575f80fd5b813581811115611cfb575f80fd5b896020828501011115611d0c575f80fd5b9699959850939650602001949392505050565b5f8060408385031215611d30575f80fd5b611d3983611a8c565b9150611d4760208401611a8c565b90509250929050565b600181811c90821680611d6457607f821691505b602082108103611d8257634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156109d457805f5260205f20601f840160051c81016020851015611dad5750805b601f840160051c820191505b818110156109d1575f8155600101611db9565b815167ffffffffffffffff811115611de657611de6611aca565b611dfa81611df48454611d50565b84611d88565b602080601f831160018114611e2d575f8415611e165750858301515b5f19600386901b1c1916600185901b178555611e84565b5f85815260208120601f198616915b82811015611e5b57888601518255948401946001909101908401611e3c565b5085821015611e7857878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561061e5761061e611e8c565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52603160045260245ffd5b5f60208284031215611eeb575f80fd5b81516001600160e01b031981168114610ca3575f80fd5b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290525f828460a08401375f60a0848401015260a0601f19601f85011683010190509695505050505050565b634e487b7160e01b5f52601260045260245ffd5b5f82611f7657611f76611f54565b500690565b5f8154611f8781611d50565b60018281168015611f9f5760018114611fb457611fe0565b60ff1984168752821515830287019450611fe0565b855f526020805f205f5b85811015611fd75781548a820152908401908201611fbe565b50505082870194505b5050505092915050565b5f8151611ffb818560208601611a21565b9290920192915050565b693d913730b6b2911d101160b11b81525f612023600a830188611f7b565b61202360f01b8152865161203e816002840160208b01611a21565b7f222c226465736372697074696f6e223a224120636f6c6c656374696f6e206f66600292909101918201527f2048796272696420455243343034204e4654732c206d6164652062792050756c60228201526f1cd950dbda5b88119858dd1bdc9e488b60821b60428201527f2265787465726e616c5f75726c223a2268747470733a2f2f70756c7365636f6960528201526e371734b791161134b6b0b3b2911d1160891b60728201526120f36081820187611f7b565b90508451612105818360208901611a21565b7f222c2261747472696275746573223a5b7b2274726169745f74797065223a224391019081526e37b637b91116113b30b63ab2911d1160891b6020820152612163612153602f830186611fea565b63227d5d7d60e01b815260040190565b98975050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c000000000081525f82516121a681601b850160208701611a21565b91909101601b0192915050565b600181815b808511156121ed57815f19048211156121d3576121d3611e8c565b808516156121e057918102915b93841c93908002906121b8565b509250929050565b5f826122035750600161061e565b8161220f57505f61061e565b8160018114612225576002811461222f5761224b565b600191505061061e565b60ff84111561224057612240611e8c565b50506001821b61061e565b5060208310610133831016604e8410600b841016171561226e575081810a61061e565b61227883836121b3565b805f190482111561228b5761228b611e8c565b029392505050565b5f610ca360ff8416836121f5565b5f826122af576122af611f54565b50049056fea26469706673582212202e549963fdb7114953cebfd36ad851e7cb9022fde21fbab6857855be61d9689564736f6c63430008180033a264697066735822122055ac6c267b13873be59d93df246cbb56c8d6bcc3a08d4fa57ad5d2d1cbdcbff664736f6c63430008180033
Deployed ByteCode
0x6080604052600436106200009b575f3560e01c8063d66b3eda116200005e578063d66b3eda1462000178578063d6fd654514620001a7578063f2fde38b14620001cb578063f46901ed14620001ef578063ff05e4f41462000213575f80fd5b8063017e7e58146200009f578063200c729514620000dd578063589ab4a5146200010357806385714768146200011a578063a09037a91462000152575b5f80fd5b348015620000ab575f80fd5b50600254620000c0906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b348015620000e9575f80fd5b5062000101620000fb366004620007d2565b62000237565b005b62000101620001143660046200096f565b62000288565b34801562000126575f80fd5b50620000c06200013836600462000a3c565b60046020525f90815260409020546001600160a01b031681565b3480156200015e575f80fd5b506200016960015481565b604051908152602001620000d4565b34801562000184575f80fd5b50620001696200019636600462000a3c565b60056020525f908152604090205481565b348015620001b3575f80fd5b50620000c0620001c536600462000a5f565b6200043d565b348015620001d7575f80fd5b5062000101620001e936600462000a3c565b62000465565b348015620001fb575f80fd5b50620001016200020d36600462000a3c565b6200050c565b3480156200021f575f80fd5b50620000c06200023136600462000a5f565b6200055b565b6003546001600160a01b031633146200026d5760405162461bcd60e51b8152600401620002649062000a77565b60405180910390fd5b6001600160a01b039091165f90815260056020526040902055565b335f90815260056020526040902054600111156200035a573469152d02c7e14af680000014620002fb5760405162461bcd60e51b815260206004820152601760248201527f466565206973203130302074686f7573616e6420504c53000000000000000000604482015260640162000264565b6002546040516001600160a01b03909116903480156108fc02915f818181858888f1935050505015801562000332573d5f803e3d5ffd5b50335f9081526005602052604081208054600392906200035490849062000ac2565b90915550505b8051825114620003bb5760405162461bcd60e51b815260206004820152602560248201527f496d6167652055524c7320616e6420636f6c6f7273206c656e677468206d69736044820152640dac2e8c6d60db1b606482015260840162000264565b5f8686868630338888604051620003d290620007a8565b620003e598979695949392919062000b7f565b604051809103905ff080158015620003ff573d5f803e3d5ffd5b5090506200040e8133620005d4565b335f9081526005602052604081208054600192906200042f90849062000c0c565b909155505050505050505050565b5f81815481106200044c575f80fd5b5f918252602090912001546001600160a01b0316905081565b6003546001600160a01b03163314620004925760405162461bcd60e51b8152600401620002649062000a77565b6001600160a01b038116620004ea5760405162461bcd60e51b815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015260640162000264565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314620005395760405162461bcd60e51b8152600401620002649062000a77565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b5f6001548210620005a55760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640162000264565b5f8281548110620005ba57620005ba62000c22565b5f918252602090912001546001600160a01b031692915050565b5f8054600180820183557f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56390910180546001600160a01b038681166001600160a01b031992831681179093558285526004602090815260409586902080549288169290931682179092559254935192835285939230917fcbdc4752987606059c4afbe1a576531b2a18395ec6988c6d48c8c48027cdf106910160405180910390a46001805f82825462000688919062000ac2565b90915550506040516353d6fd5960e01b81526001600160a01b038281166004830152600160248301528416906353d6fd59906044015f604051808303815f87803b158015620006d5575f80fd5b505af1158015620006e8573d5f803e3d5ffd5b50506040516353d6fd5960e01b81526001600160a01b03858116600483015260016024830152861692506353d6fd5991506044015f604051808303815f87803b15801562000734575f80fd5b505af115801562000747573d5f803e3d5ffd5b505060405163f2fde38b60e01b81526001600160a01b0385811660048301528616925063f2fde38b91506024015f604051808303815f87803b1580156200078c575f80fd5b505af11580156200079f573d5f803e3d5ffd5b50505050505050565b612ac08062000c3783390190565b80356001600160a01b0381168114620007cd575f80fd5b919050565b5f8060408385031215620007e4575f80fd5b620007ef83620007b6565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff811182821017156200083d576200083d620007fd565b604052919050565b5f82601f83011262000855575f80fd5b813567ffffffffffffffff811115620008725762000872620007fd565b62000887601f8201601f191660200162000811565b8181528460208386010111156200089c575f80fd5b816020850160208301375f918101602001919091529392505050565b803560ff81168114620007cd575f80fd5b5f82601f830112620008d9575f80fd5b8135602067ffffffffffffffff80831115620008f957620008f9620007fd565b8260051b6200090a83820162000811565b938452858101830193838101908886111562000924575f80fd5b84880192505b85831015620009635782358481111562000942575f80fd5b620009528a87838c010162000845565b83525091840191908401906200092a565b98975050505050505050565b5f805f805f8060c0878903121562000985575f80fd5b863567ffffffffffffffff808211156200099d575f80fd5b620009ab8a838b0162000845565b97506020890135915080821115620009c1575f80fd5b620009cf8a838b0162000845565b9650620009df60408a01620008b8565b9550606089013594506080890135915080821115620009fc575f80fd5b62000a0a8a838b01620008c9565b935060a089013591508082111562000a20575f80fd5b5062000a2f89828a01620008c9565b9150509295509295509295565b5f6020828403121562000a4d575f80fd5b62000a5882620007b6565b9392505050565b5f6020828403121562000a70575f80fd5b5035919050565b60208082526017908201527f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b8082018082111562000ad85762000ad862000aae565b92915050565b5f81518084525f5b8181101562000b045760208185018101518683018201520162000ae6565b505f602082860101526020601f19601f83011685010191505092915050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101562000b7257601f1986840301895262000b5f83835162000ade565b9884019892509083019060010162000b40565b5090979650505050505050565b5f61010080835262000b948184018c62000ade565b9050828103602084015262000baa818b62000ade565b60ff8a166040850152606084018990526001600160a01b038881166080860152871660a085015283810360c0850152905062000be7818662000b23565b905082810360e084015262000bfd818562000b23565b9b9a5050505050505050505050565b8181038181111562000ad85762000ad862000aae565b634e487b7160e01b5f52603260045260245ffdfe60c060405234801562000010575f80fd5b5060405162002ac038038062002ac0833981016040819052620000339162000411565b8787878787806001600160a01b03811662000061576040516349e27cff60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b03831690811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001620000b786826200058d565b506002620000c685826200058d565b5060ff83166080819052620000dd90600a62000768565b620000e990836200077f565b60a052505083518551149250620001579150505760405162461bcd60e51b815260206004820152602560248201527f496d6167652055524c7320616e6420636f6c6f7273206c656e677468206d69736044820152640dac2e8c6d60db1b606482015260840160405180910390fd5b600e80546001600160a01b0319166001600160a01b0385161790556200017f86600a62000768565b6200018b90866200077f565b6001600160a01b0384165f90815260046020908152604080832093909355600b9052908120805460ff191660011790555b82518110156200026157600f6040518060400160405280858481518110620001e857620001e862000799565b602002602001015181526020018484815181106200020a576200020a62000799565b60209081029190910181015190915282546001810184555f938452922081519192600202019081906200023e90826200058d565b50602082015160018201906200025590826200058d565b505050600101620001bc565b505050505050505050620007ad565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715620002af57620002af62000270565b604052919050565b5f82601f830112620002c7575f80fd5b81516001600160401b03811115620002e357620002e362000270565b6020620002f9601f8301601f1916820162000284565b82815285828487010111156200030d575f80fd5b5f5b838110156200032c5785810183015182820184015282016200030f565b505f928101909101919091529392505050565b805160ff8116811462000350575f80fd5b919050565b80516001600160a01b038116811462000350575f80fd5b5f82601f8301126200037c575f80fd5b815160206001600160401b03808311156200039b576200039b62000270565b8260051b620003ac83820162000284565b9384528581018301938381019088861115620003c6575f80fd5b84880192505b858310156200040557825184811115620003e4575f80fd5b620003f48a87838c0101620002b7565b8352509184019190840190620003cc565b98975050505050505050565b5f805f805f805f80610100898b0312156200042a575f80fd5b88516001600160401b038082111562000441575f80fd5b6200044f8c838d01620002b7565b995060208b015191508082111562000465575f80fd5b620004738c838d01620002b7565b98506200048360408c016200033f565b975060608b015196506200049a60808c0162000355565b9550620004aa60a08c0162000355565b945060c08b0151915080821115620004c0575f80fd5b620004ce8c838d016200036c565b935060e08b0151915080821115620004e4575f80fd5b50620004f38b828c016200036c565b9150509295985092959890939650565b600181811c908216806200051857607f821691505b6020821081036200053757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200058857805f5260205f20601f840160051c81016020851015620005645750805b601f840160051c820191505b8181101562000585575f815560010162000570565b50505b505050565b81516001600160401b03811115620005a957620005a962000270565b620005c181620005ba845462000503565b846200053d565b602080601f831160018114620005f7575f8415620005df5750858301515b5f19600386901b1c1916600185901b17855562000651565b5f85815260208120601f198616915b82811015620006275788860151825594840194600190910190840162000606565b50858210156200064557878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52601160045260245ffd5b600181815b80851115620006ad57815f190482111562000691576200069162000659565b808516156200069f57918102915b93841c939080029062000672565b509250929050565b5f82620006c55750600162000762565b81620006d357505f62000762565b8160018114620006ec5760028114620006f75762000717565b600191505062000762565b60ff8411156200070b576200070b62000659565b50506001821b62000762565b5060208310610133831016604e8410600b84101617156200073c575081810a62000762565b6200074883836200066d565b805f19048211156200075e576200075e62000659565b0290505b92915050565b5f6200077860ff841683620006b5565b9392505050565b808202811582820484141762000762576200076262000659565b634e487b7160e01b5f52603260045260245ffd5b60805160a0516122ea620007d65f395f61022b01525f818161029001526114c101526122ea5ff3fe608060405234801561000f575f80fd5b50600436106101a1575f3560e01c806370a08231116100f3578063c87b56dd11610093578063e0df5b6f1161006e578063e0df5b6f146103f2578063e985e9c514610405578063f28ca1dd14610432578063f2fde38b1461043a575f80fd5b8063c87b56dd146103ad578063d547cfb7146103c0578063dd62ed3e146103c8575f80fd5b80639b19251a116100ce5780639b19251a14610352578063a22cb46514610374578063a9059cbb14610387578063b88d4fde1461039a575f80fd5b806370a08231146103195780638da5cb5b1461033857806395d89b411461034a575f80fd5b80632b9689581161015e5780634f02c420116101395780634f02c420146102d7578063504334c2146102e057806353d6fd59146102f35780636352211e14610306575f80fd5b80632b96895814610283578063313ce5671461028b57806342842e0e146102c4575f80fd5b806306fdde03146101a5578063081812fc146101c3578063095ea7b31461020357806318160ddd1461022657806318d217c31461025b57806323b872dd14610270575b5f80fd5b6101ad61044d565b6040516101ba9190611a43565b60405180910390f35b6101eb6101d1366004611a75565b60066020525f90815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016101ba565b610216610211366004611aa2565b6104d9565b60405190151581526020016101ba565b61024d7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101ba565b61026e610269366004611b67565b610624565b005b61026e61027e366004611ba1565b61065d565b61026e6109d9565b6102b27f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016101ba565b61026e6102d2366004611ba1565b610a3d565b61024d60035481565b61026e6102ee366004611bda565b610b0e565b61026e610301366004611c3a565b610b92565b6101eb610314366004611a75565b610be5565b61024d610327366004611c73565b60046020525f908152604090205481565b5f546101eb906001600160a01b031681565b6101ad610c1f565b610216610360366004611c73565b600b6020525f908152604090205460ff1681565b61026e610382366004611c3a565b610c2c565b610216610395366004611aa2565b610c97565b61026e6103a8366004611c8c565b610caa565b6101ad6103bb366004611a75565b610d6a565b6101ad6113a1565b61024d6103d6366004611d1f565b600560209081525f928352604080842090915290825290205481565b61026e610400366004611b67565b6113ae565b610216610413366004611d1f565b600760209081525f928352604080842090915290825290205460ff1681565b6101ad611414565b61026e610448366004611c73565b611421565b6001805461045a90611d50565b80601f016020809104026020016040519081016040528092919081815260200182805461048690611d50565b80156104d15780601f106104a8576101008083540402835291602001916104d1565b820191905f5260205f20905b8154815290600101906020018083116104b457829003601f168201915b505050505081565b5f60035482111580156104eb57505f82115b156105bf575f828152600860205260409020546001600160a01b031633811480159061053a57506001600160a01b0381165f90815260076020908152604080832033845290915290205460ff16155b15610557576040516282b42960e81b815260040160405180910390fd5b5f8381526006602090815260409182902080546001600160a01b0319166001600160a01b038881169182179092559251868152908416917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35061061a565b335f8181526005602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35b5060015b92915050565b5f546001600160a01b0316331461064d576040516282b42960e81b815260040160405180910390fd5b600c6106598282611dcc565b5050565b600354811161096d575f818152600860205260409020546001600160a01b0384811691161461069f57604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b0382166106c657604051634e46966960e11b815260040160405180910390fd5b336001600160a01b0384161480159061070257506001600160a01b0383165f90815260076020908152604080832033845290915290205460ff16155b801561072457505f818152600660205260409020546001600160a01b03163314155b15610741576040516282b42960e81b815260040160405180910390fd5b6107496114bb565b6001600160a01b0384165f9081526004602052604081208054909190610770908490611ea0565b9091555061077e90506114bb565b6001600160a01b038084165f81815260046020908152604080832080549096019095558582526008815284822080546001600160a01b0319908116909417905560068152848220805490931690925591861682526009905290812080546107e790600190611ea0565b815481106107f7576107f7611eb3565b5f9182526020808320909101546001600160a01b0387168352600982526040808420868552600a9093529092205481549293508392811061083a5761083a611eb3565b5f9182526020808320909101929092556001600160a01b038616815260099091526040902080548061086e5761086e611ec7565b5f828152602080822083015f19908101839055909201909255838252600a8152604080832054848452818420556001600160a01b0386168084526009835290832080546001818101835582865293852001869055925290546108d09190611ea0565b5f838152600a602052604080822092909255905183916001600160a01b0380871692908816917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4826001600160a01b0316846001600160a01b03167fe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e0314876109566114bb565b60405190815260200160405180910390a350505050565b6001600160a01b0383165f9081526005602090815260408083203384529091529020545f1981146109c6576109a28282611ea0565b6001600160a01b0385165f9081526005602090815260408083203384529091529020555b6109d18484846114ec565b50505b505050565b5f546001600160a01b03163314610a02576040516282b42960e81b815260040160405180910390fd5b5f80546001600160a01b031916815560405133907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3565b610a4883838361065d565b6001600160a01b0382163b15801590610af05750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401525f608484015290919084169063150b7a029060a4016020604051808303815f875af1158015610abf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ae39190611edb565b6001600160e01b03191614155b156109d457604051633da6393160e01b815260040160405180910390fd5b600e546001600160a01b03163314610b795760405162461bcd60e51b8152602060048201526024808201527f4f6e6c792063726561746f722063616e20736574206e616d6520616e642073796044820152631b589bdb60e21b60648201526084015b60405180910390fd5b6001610b858382611dcc565b5060026109d48282611dcc565b5f546001600160a01b03163314610bbb576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b5f818152600860205260409020546001600160a01b031680610c1a5760405163c5723b5160e01b815260040160405180910390fd5b919050565b6002805461045a90611d50565b335f8181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b5f610ca33384846114ec565b9392505050565b610cb585858561065d565b6001600160a01b0384163b15801590610d4c5750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290610cff9033908a90899089908990600401611f02565b6020604051808303815f875af1158015610d1b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d3f9190611edb565b6001600160e01b03191614155b156109d157604051633da6393160e01b815260040160405180910390fd5b5f818152600860205260409020546060906001600160a01b0316610de85760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610b70565b5f61010083604051602001610dff91815260200190565b604051602081830303815290604052805190602001205f1c610e219190611f68565b905060608060648360ff1611610f8b57600f5f81548110610e4457610e44611eb3565b905f5260205f2090600202015f018054610e5d90611d50565b80601f0160208091040260200160405190810160405280929190818152602001828054610e8990611d50565b8015610ed45780601f10610eab57610100808354040283529160200191610ed4565b820191905f5260205f20905b815481529060010190602001808311610eb757829003601f168201915b50505050509150600f5f81548110610eee57610eee611eb3565b905f5260205f2090600202016001018054610f0890611d50565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3490611d50565b8015610f7f5780601f10610f5657610100808354040283529160200191610f7f565b820191905f5260205f20905b815481529060010190602001808311610f6257829003601f168201915b50505050509050611341565b60a08360ff161161105557600f600181548110610faa57610faa611eb3565b905f5260205f2090600202015f018054610fc390611d50565b80601f0160208091040260200160405190810160405280929190818152602001828054610fef90611d50565b801561103a5780601f106110115761010080835404028352916020019161103a565b820191905f5260205f20905b81548152906001019060200180831161101d57829003601f168201915b50505050509150600f600181548110610eee57610eee611eb3565b60d28360ff161161111f57600f60028154811061107457611074611eb3565b905f5260205f2090600202015f01805461108d90611d50565b80601f01602080910402602001604051908101604052809291908181526020018280546110b990611d50565b80156111045780601f106110db57610100808354040283529160200191611104565b820191905f5260205f20905b8154815290600101906020018083116110e757829003601f168201915b50505050509150600f600281548110610eee57610eee611eb3565b60f08360ff16116111e957600f60038154811061113e5761113e611eb3565b905f5260205f2090600202015f01805461115790611d50565b80601f016020809104026020016040519081016040528092919081815260200182805461118390611d50565b80156111ce5780601f106111a5576101008083540402835291602001916111ce565b820191905f5260205f20905b8154815290600101906020018083116111b157829003601f168201915b50505050509150600f600381548110610eee57610eee611eb3565b600f6004815481106111fd576111fd611eb3565b905f5260205f2090600202015f01805461121690611d50565b80601f016020809104026020016040519081016040528092919081815260200182805461124290611d50565b801561128d5780601f106112645761010080835404028352916020019161128d565b820191905f5260205f20905b81548152906001019060200180831161127057829003601f168201915b50505050509150600f6004815481106112a8576112a8611eb3565b905f5260205f20906002020160010180546112c290611d50565b80601f01602080910402602001604051908101604052809291908181526020018280546112ee90611d50565b80156113395780601f1061131057610100808354040283529160200191611339565b820191905f5260205f20905b81548152906001019060200180831161131c57829003601f168201915b505050505090505b5f600161134d87611691565b600c8585604051602001611365959493929190612005565b604051602081830303815290604052905080604051602001611387919061216f565b604051602081830303815290604052945050505050919050565b600d805461045a90611d50565b600e546001600160a01b031633146114085760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c792063726561746f722063616e2073657420746f6b656e2055524900006044820152606401610b70565b600d6106598282611dcc565b600c805461045a90611d50565b5f546001600160a01b0316331461144a576040516282b42960e81b815260040160405180910390fd5b6001600160a01b038116611471576040516349e27cff60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b5f6114e77f0000000000000000000000000000000000000000000000000000000000000000600a612293565b905090565b5f806114f66114bb565b6001600160a01b038087165f818152600460205260408082208054948a16835290822054928252939450919290918691906115318386611ea0565b90915550506001600160a01b038087165f90815260046020908152604080832080548a019055928a168252600b9052205460ff166115c0576001600160a01b0387165f9081526004602052604081205461158c9085906122a1565b61159685856122a1565b6115a09190611ea0565b90505f5b818110156115bd576115b589611721565b6001016115a4565b50505b6001600160a01b0386165f908152600b602052604090205460ff16611637575f6115ea84836122a1565b6001600160a01b0388165f9081526004602052604090205461160d9086906122a1565b6116179190611ea0565b90505f5b818110156116345761162c88611842565b60010161161b565b50505b856001600160a01b0316876001600160a01b03167fe59fdd36d0d223c0c7d996db7ad796880f45e1936cb0bb7ac102e7082e0314878760405161167c91815260200190565b60405180910390a35060019695505050505050565b60605f61169d8361194a565b60010190505f8167ffffffffffffffff8111156116bc576116bc611aca565b6040519080825280601f01601f1916602001820160405280156116e6576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846116f057509392505050565b6001600160a01b03811661174857604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b0381165f908152600960205260408120805461176d90600190611ea0565b8154811061177d5761177d611eb3565b905f5260205f200154905060095f836001600160a01b03166001600160a01b031681526020019081526020015f208054806117ba576117ba611ec7565b5f828152602080822083015f19908101839055909201909255828252600a815260408083208390556008825280832080546001600160a01b031990811690915560069092528083208054909216909155518291906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b03811661186957604051634e46966960e11b815260040160405180910390fd5b60038054600101908190555f818152600860205260409020546001600160a01b0316156118a95760405163119b4fd360e11b815260040160405180910390fd5b5f81815260086020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558084526009835290832080546001818101835582865293852001859055925290546119009190611ea0565b5f828152600a602052604080822092909255905182916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106119885772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106119b4576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106119d257662386f26fc10000830492506010015b6305f5e10083106119ea576305f5e100830492506008015b61271083106119fe57612710830492506004015b60648310611a10576064830492506002015b600a831061061e5760010192915050565b5f5b83811015611a3b578181015183820152602001611a23565b50505f910152565b602081525f8251806020840152611a61816040850160208701611a21565b601f01601f19169190910160400192915050565b5f60208284031215611a85575f80fd5b5035919050565b80356001600160a01b0381168114610c1a575f80fd5b5f8060408385031215611ab3575f80fd5b611abc83611a8c565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611aed575f80fd5b813567ffffffffffffffff80821115611b0857611b08611aca565b604051601f8301601f19908116603f01168101908282118183101715611b3057611b30611aca565b81604052838152866020858801011115611b48575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f60208284031215611b77575f80fd5b813567ffffffffffffffff811115611b8d575f80fd5b611b9984828501611ade565b949350505050565b5f805f60608486031215611bb3575f80fd5b611bbc84611a8c565b9250611bca60208501611a8c565b9150604084013590509250925092565b5f8060408385031215611beb575f80fd5b823567ffffffffffffffff80821115611c02575f80fd5b611c0e86838701611ade565b93506020850135915080821115611c23575f80fd5b50611c3085828601611ade565b9150509250929050565b5f8060408385031215611c4b575f80fd5b611c5483611a8c565b915060208301358015158114611c68575f80fd5b809150509250929050565b5f60208284031215611c83575f80fd5b610ca382611a8c565b5f805f805f60808688031215611ca0575f80fd5b611ca986611a8c565b9450611cb760208701611a8c565b935060408601359250606086013567ffffffffffffffff80821115611cda575f80fd5b818801915088601f830112611ced575f80fd5b813581811115611cfb575f80fd5b896020828501011115611d0c575f80fd5b9699959850939650602001949392505050565b5f8060408385031215611d30575f80fd5b611d3983611a8c565b9150611d4760208401611a8c565b90509250929050565b600181811c90821680611d6457607f821691505b602082108103611d8257634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156109d457805f5260205f20601f840160051c81016020851015611dad5750805b601f840160051c820191505b818110156109d1575f8155600101611db9565b815167ffffffffffffffff811115611de657611de6611aca565b611dfa81611df48454611d50565b84611d88565b602080601f831160018114611e2d575f8415611e165750858301515b5f19600386901b1c1916600185901b178555611e84565b5f85815260208120601f198616915b82811015611e5b57888601518255948401946001909101908401611e3c565b5085821015611e7857878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561061e5761061e611e8c565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52603160045260245ffd5b5f60208284031215611eeb575f80fd5b81516001600160e01b031981168114610ca3575f80fd5b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290525f828460a08401375f60a0848401015260a0601f19601f85011683010190509695505050505050565b634e487b7160e01b5f52601260045260245ffd5b5f82611f7657611f76611f54565b500690565b5f8154611f8781611d50565b60018281168015611f9f5760018114611fb457611fe0565b60ff1984168752821515830287019450611fe0565b855f526020805f205f5b85811015611fd75781548a820152908401908201611fbe565b50505082870194505b5050505092915050565b5f8151611ffb818560208601611a21565b9290920192915050565b693d913730b6b2911d101160b11b81525f612023600a830188611f7b565b61202360f01b8152865161203e816002840160208b01611a21565b7f222c226465736372697074696f6e223a224120636f6c6c656374696f6e206f66600292909101918201527f2048796272696420455243343034204e4654732c206d6164652062792050756c60228201526f1cd950dbda5b88119858dd1bdc9e488b60821b60428201527f2265787465726e616c5f75726c223a2268747470733a2f2f70756c7365636f6960528201526e371734b791161134b6b0b3b2911d1160891b60728201526120f36081820187611f7b565b90508451612105818360208901611a21565b7f222c2261747472696275746573223a5b7b2274726169745f74797065223a224391019081526e37b637b91116113b30b63ab2911d1160891b6020820152612163612153602f830186611fea565b63227d5d7d60e01b815260040190565b98975050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c000000000081525f82516121a681601b850160208701611a21565b91909101601b0192915050565b600181815b808511156121ed57815f19048211156121d3576121d3611e8c565b808516156121e057918102915b93841c93908002906121b8565b509250929050565b5f826122035750600161061e565b8161220f57505f61061e565b8160018114612225576002811461222f5761224b565b600191505061061e565b60ff84111561224057612240611e8c565b50506001821b61061e565b5060208310610133831016604e8410600b841016171561226e575081810a61061e565b61227883836121b3565b805f190482111561228b5761228b611e8c565b029392505050565b5f610ca360ff8416836121f5565b5f826122af576122af611f54565b50049056fea26469706673582212202e549963fdb7114953cebfd36ad851e7cb9022fde21fbab6857855be61d9689564736f6c63430008180033a264697066735822122055ac6c267b13873be59d93df246cbb56c8d6bcc3a08d4fa57ad5d2d1cbdcbff664736f6c63430008180033