NFT
Overview
TokenID
585
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
KILLABITS
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //// 01011010 01010101 01000011 01010111 01001001 01011000 //// ██ ██ ██ ██ ██ █████ ██████ ██ ████████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ██ ██ ███████ ██████ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ███████ ██ ██ ██████ ██ ██ ███████ //// 01001011 01001001 01001100 01001100 01000001 01010011 //// //// 01110101 01101110 01101001 01110100 01100101 01100100 //// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "erc721a/contracts/ERC721A.sol"; import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol"; /* ------------ Interfaces ------------ */ interface IERC721 { function ownerOf(uint256) external returns (address); } interface ITraitTokenizer { function tokenize( address, uint256, uint256 ) external; function detokenize( address, uint256, uint256 ) external; } /* --------- Structs --------- */ struct TokenInfo { uint64 upgrade; uint64 requestTimestamp; } /* -------- Errors -------- */ error SupplyOverflow(); error UpgradingNotStarted(); error TokensAreTheSame(); error NotYourToken(); error UpgradePending(); error TokenAlreadyUpgraded(); error TokenNotMarkedForUpgrade(); error UpgradeRequestTooRecent(); error TokenHasNoUpgrade(); error TraitsContractNotConfigured(); error IncompatibleUpgrade(); /* ------ Main ------ */ contract KILLABITS is ERC721A, Ownable, VRFConsumerBaseV2 { IERC721 public immutable killabearsContract; VRFCoordinatorV2Interface public immutable chainlinkContract; ITraitTokenizer public traitsContract; mapping(uint256 => string) public baseURIs; uint64[] public upgradeRarity; mapping(uint256 => bool) public compatibleUpgrades; mapping(uint256 => TokenInfo) public tokenInfo; mapping(uint256 => uint256) public requestIdToToken; bool public upgradingEnabled; bytes32 public chainlinkKeyHash; uint64 public chainlinkSubscriptionId; uint16 public chainlinkConfirmations; uint32 public chainlinkGasLimit; /* -------- Events -------- */ event TokenUpgradeRequested( uint256 indexed token, uint256 indexed requestId, uint256 indexed sacrifice ); event TokenUpgraded(uint256 indexed token, uint64 indexed upgrade); event UpgradeTokenized(uint256 indexed token, uint64 indexed upgrade); /* ---------------- Initialization ---------------- */ constructor(address killabearsAddress, address chainlinkAddress) ERC721A("KILLABITS", "KILLABITS") VRFConsumerBaseV2(chainlinkAddress) { baseURIs[0] = "https://bits.killabears.com/nft/"; killabearsContract = IERC721(killabearsAddress); chainlinkContract = VRFCoordinatorV2Interface(chainlinkAddress); } /* --------- Minting --------- */ /// @notice Airdrop to KB holders function airdrop(uint256 qty) external onlyOwner { uint256 token = _nextTokenId(); uint256 last = token + qty - 1; if (last > 3333) revert SupplyOverflow(); uint256 cnt = 0; address prevOwner = killabearsContract.ownerOf(token); while (token <= last) { address owner = killabearsContract.ownerOf(token); if (owner != prevOwner || cnt == 32) { _mint(prevOwner, cnt); cnt = 1; prevOwner = owner; } else cnt++; if (token == last) _mint(owner, cnt); token++; } } /* ----------------- Badassification ---------------- */ /// @notice Initiates an upgrade for one token while burning another token function upgrade(uint256 token, uint256 sacrifice) external { if (!upgradingEnabled && msg.sender != owner()) revert UpgradingNotStarted(); if (token == sacrifice) revert TokensAreTheSame(); if (ownerOf(token) != msg.sender || ownerOf(sacrifice) != msg.sender) revert NotYourToken(); if ( tokenInfo[token].requestTimestamp != 0 || tokenInfo[sacrifice].requestTimestamp != 0 ) revert UpgradePending(); if (tokenInfo[token].upgrade > 0 || tokenInfo[sacrifice].upgrade > 0) revert TokenAlreadyUpgraded(); uint256 requestId = chainlinkContract.requestRandomWords( chainlinkKeyHash, chainlinkSubscriptionId, chainlinkConfirmations, chainlinkGasLimit, 1 ); requestIdToToken[requestId] = token; tokenInfo[token].requestTimestamp = uint64(block.timestamp); _burn(sacrifice, false); emit TokenUpgradeRequested(token, requestId, sacrifice); } /// @notice Callback invoked by chainlink function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override { uint256 token = requestIdToToken[requestId]; TokenInfo memory info = tokenInfo[token]; if (info.requestTimestamp == 0) revert TokenNotMarkedForUpgrade(); if (info.upgrade > 0) revert TokenAlreadyUpgraded(); uint64 upgradeId = upgradeRarity[randomWords[0] % upgradeRarity.length]; tokenInfo[token].upgrade = upgradeId; tokenInfo[token].requestTimestamp = 0; emit TokenUpgraded(token, upgradeId); } /// @notice Failsafe in case a request wasn't fulfilled by chainlink /// @dev Can only be called by contract owner after 24h, /// @dev by which time the request will have been cancelled by chainlink. /// @dev This uses the blockhash of the previous block as a source of randomness, /// @dev which is acceptable in this case because all requests will come from the /// @dev contract owner. function forceUpgrade(uint256 requestId) external onlyOwner { uint256 token = requestIdToToken[requestId]; TokenInfo memory info = tokenInfo[token]; uint256 ts = info.requestTimestamp; if (ts == 0) revert TokenNotMarkedForUpgrade(); if (info.upgrade > 0) revert TokenAlreadyUpgraded(); if (block.timestamp - ts < 86400) revert UpgradeRequestTooRecent(); // Invalidate chainlink request tokenInfo[token].requestTimestamp = 0; uint64 upgradeId = upgradeRarity[ uint256(blockhash(block.number - 1)) % upgradeRarity.length ]; tokenInfo[token].upgrade = upgradeId; emit TokenUpgraded(token, upgradeId); } /// @notice Detaches an upgrade function detachUpgrade(uint256 token) external { if (ownerOf(token) != msg.sender) revert NotYourToken(); TokenInfo memory info = tokenInfo[token]; if (info.upgrade == 0) revert TokenHasNoUpgrade(); if (address(traitsContract) == address(0)) revert TraitsContractNotConfigured(); uint64 upgradeId = info.upgrade; tokenInfo[token].upgrade = 0; traitsContract.tokenize(msg.sender, upgradeId, 1); emit UpgradeTokenized(token, upgradeId); } /// @notice Attaches an upgrade function attachUpgrade(uint256 token, uint64 upgradeId) external { if (ownerOf(token) != msg.sender) revert NotYourToken(); TokenInfo memory info = tokenInfo[token]; if (info.upgrade > 0) revert TokenAlreadyUpgraded(); if (!compatibleUpgrades[upgradeId]) revert IncompatibleUpgrade(); if (info.requestTimestamp > 0) revert UpgradePending(); if (address(traitsContract) == address(0)) revert TraitsContractNotConfigured(); tokenInfo[token].upgrade = upgradeId; traitsContract.detokenize(msg.sender, upgradeId, 1); emit TokenUpgraded(token, upgradeId); } /// @notice Get the current upgrade for a given token function tokenUpgrade(uint256 token) external view returns (uint64) { return tokenInfo[token].upgrade; } /* -------- Config -------- */ /// @notice Sets the trait tokenizer contract function setTraitTokenizerContract(address _addr) external onlyOwner { traitsContract = ITraitTokenizer(_addr); } /// @notice Configures upgrade rarity function configureUpgrades(uint64[] memory upgrades, uint64[] memory rarity) external onlyOwner { for (uint256 i = 0; i < upgrades.length; i++) { uint64 upgradeId = upgrades[i]; uint64 amount = rarity[i]; while (amount > 0) { upgradeRarity.push(upgradeId); amount--; } compatibleUpgrades[upgradeId] = true; } } /// @notice Adds a compatible upgrade. Does not make it available through the sacrifice mechanism function addCompatibleUpgrade(uint256 upgradeId) external onlyOwner { compatibleUpgrades[upgradeId] = true; } /// @notice Enables upgrading function enableUpgrading() external onlyOwner { upgradingEnabled = true; } /// @notice Disables upgrading function disableUpgrading() external onlyOwner { upgradingEnabled = false; } /// @notice Configures chainlink function configureChainlink( bytes32 _keyHash, uint64 _subscription, uint16 _confirmations, uint32 _gasLimit ) external onlyOwner { chainlinkKeyHash = _keyHash; chainlinkSubscriptionId = _subscription; chainlinkConfirmations = _confirmations; chainlinkGasLimit = _gasLimit; } /// @notice Sets base URIs per upgradeId function setBaseURIs(uint256[] memory upgradeIds, string[] memory uris) external onlyOwner { for (uint256 i = 0; i < upgradeIds.length; i++) { baseURIs[upgradeIds[i]] = uris[i]; } } /* ------- Other ------- */ /// @dev Used to get the URI for a given token function tokenURI(uint256 token) public view virtual override returns (string memory) { if (!_exists(token)) revert URIQueryForNonexistentToken(); string memory baseURI = baseURIs[tokenInfo[token].upgrade]; return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, _toString(token))) : ""; } /// @dev Collection starts at 1 function _startTokenId() internal pure override returns (uint256) { return 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.1.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev ERC721 token receiver interface. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, * including the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at `_startTokenId()` * (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Mask of an entry in packed address data. uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with `_mintERC2309`. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309` // is required to cause an overflow, which is unrealistic. uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The tokenId of the next token to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See `_packedOwnershipOf` implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see `_totalMinted`. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to `_startTokenId()` unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view returns (uint256) { return _burnCounter; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes of the XOR of // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165 // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)` return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX); _packedAddressData[owner] = packed; } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & BITMASK_BURNED == 0) { // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. // // We can directly compare the packed value. // If the address is zero, packed is zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP); ownership.burned = packed & BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA); } /** * Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, BITMASK_ADDRESS) // `owner | (block.timestamp << BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << BITPOS_NEXT_INITIALIZED`. result := shl(BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned. } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 tokenId = startTokenId; uint256 end = startTokenId + quantity; do { emit Transfer(address(0), to, tokenId++); } while (tokenId < end); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`. assembly { // Compute the slot. mstore(0x00, tokenId) mstore(0x20, tokenApprovalsPtr.slot) approvedAddressSlot := keccak256(0x00, 0x40) // Load the slot's value from storage. approvedAddress := sload(approvedAddressSlot) } } /** * @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`. */ function _isOwnerOrApproved( address approvedAddress, address from, address msgSender ) private pure returns (bool result) { assembly { // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from := and(from, BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, BITMASK_ADDRESS) // `msgSender == from || msgSender == approvedAddress`. result := or(eq(msgSender, from), eq(msgSender, approvedAddress)) } } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (BITMASK_BURNED | BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. * This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. * This includes minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function _toString(uint256 value) internal pure returns (string memory ptr) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128. ptr := add(mload(0x40), 128) // Update the free memory pointer to allocate. mstore(0x40, ptr) // Cache the end of the memory to calculate the length later. let end := ptr // We write the string from the rightmost digit to the leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // Costs a bit more than early returning for the zero case, // but cheaper in terms of deployment and overall runtime costs. for { // Initialize and perform the first pass without check. let temp := value // Move the pointer 1 byte leftwards to point to an empty character slot. ptr := sub(ptr, 1) // Write the character to the pointer. 48 is the ASCII index of '0'. mstore8(ptr, add(48, mod(temp, 10))) temp := div(temp, 10) } temp { // Keep dividing `temp` until zero. temp := div(temp, 10) } { // Body of the for loop. ptr := sub(ptr, 1) mstore8(ptr, add(48, mod(temp, 10))) } let length := sub(end, ptr) // Move the pointer 32 bytes leftwards to make room for the length. ptr := sub(ptr, 32) // Store the length. mstore(ptr, length) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface VRFCoordinatorV2Interface { /** * @notice Get configuration relevant for making requests * @return minimumRequestConfirmations global min for request confirmations * @return maxGasLimit global max for request gas limit * @return s_provingKeyHashes list of registered key hashes */ function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory ); /** * @notice Request a set of random words. * @param keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * @param subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * @param minimumRequestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * @param callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * @param numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords( bytes32 keyHash, uint64 subId, uint16 minimumRequestConfirmations, uint32 callbackGasLimit, uint32 numWords ) external returns (uint256 requestId); /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); */ function createSubscription() external returns (uint64 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return reqCount - number of requests for this subscription, determines fee tier. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription(uint64 subId) external view returns ( uint96 balance, uint64 reqCount, address owner, address[] memory consumers ); /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint64 subId) external; /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint64 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint64 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint64 subId, address to) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinator * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords), * @dev see (VRFCoordinatorInterface for a description of the arguments). * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) { vrfCoordinator = _vrfCoordinator; } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external { if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); } fulfillRandomWords(requestId, randomWords); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.1.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of an ERC721A compliant contract. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set through `_extraData`. uint24 extraData; } /** * @dev Returns the total amount of tokens stored by the contract. * * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens. */ function totalSupply() external view returns (uint256); // ============================== // 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); // ============================== // IERC721 // ============================== /** * @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 be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns 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); // ============================== // IERC721Metadata // ============================== /** * @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); // ============================== // IERC2309 // ============================== /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` (inclusive) is transferred from `from` to `to`, * as defined in the ERC2309 standard. See `_mintERC2309` for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"killabearsAddress","type":"address"},{"internalType":"address","name":"chainlinkAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"IncompatibleUpgrade","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotYourToken","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SupplyOverflow","type":"error"},{"inputs":[],"name":"TokenAlreadyUpgraded","type":"error"},{"inputs":[],"name":"TokenHasNoUpgrade","type":"error"},{"inputs":[],"name":"TokenNotMarkedForUpgrade","type":"error"},{"inputs":[],"name":"TokensAreTheSame","type":"error"},{"inputs":[],"name":"TraitsContractNotConfigured","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"UpgradePending","type":"error"},{"inputs":[],"name":"UpgradeRequestTooRecent","type":"error"},{"inputs":[],"name":"UpgradingNotStarted","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"token","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"sacrifice","type":"uint256"}],"name":"TokenUpgradeRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"token","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"upgrade","type":"uint64"}],"name":"TokenUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"token","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"upgrade","type":"uint64"}],"name":"UpgradeTokenized","type":"event"},{"inputs":[{"internalType":"uint256","name":"upgradeId","type":"uint256"}],"name":"addCompatibleUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"qty","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint64","name":"upgradeId","type":"uint64"}],"name":"attachUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"baseURIs","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkConfirmations","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkContract","outputs":[{"internalType":"contract VRFCoordinatorV2Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkGasLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkKeyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkSubscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"compatibleUpgrades","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"uint64","name":"_subscription","type":"uint64"},{"internalType":"uint16","name":"_confirmations","type":"uint16"},{"internalType":"uint32","name":"_gasLimit","type":"uint32"}],"name":"configureChainlink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"upgrades","type":"uint64[]"},{"internalType":"uint64[]","name":"rarity","type":"uint64[]"}],"name":"configureUpgrades","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"detachUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableUpgrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableUpgrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"forceUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"killabearsContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestIdToToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"upgradeIds","type":"uint256[]"},{"internalType":"string[]","name":"uris","type":"string[]"}],"name":"setBaseURIs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setTraitTokenizerContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenInfo","outputs":[{"internalType":"uint64","name":"upgrade","type":"uint64"},{"internalType":"uint64","name":"requestTimestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"tokenUpgrade","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traitsContract","outputs":[{"internalType":"contract ITraitTokenizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"},{"internalType":"uint256","name":"sacrifice","type":"uint256"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"upgradeRarity","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"upgradingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162002e0238038062002e02833981016040819052620000349162000255565b6040805180820182526009808252684b494c4c414249545360b81b60208084018281528551808701909652928552840152815184939162000079916002919062000192565b5080516200008f90600390602084019062000192565b5050600160005550620000a23362000140565b60601b6001600160601b0319166080526040805180820190915260208082527f68747470733a2f2f626974732e6b696c6c6162656172732e636f6d2f6e66742f81830190815260008052600a909152905162000120917f13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e39162000192565b506001600160601b0319606092831b811660a052911b1660c052620002c9565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001a0906200028c565b90600052602060002090601f016020900481019282620001c457600085556200020f565b82601f10620001df57805160ff19168380011785556200020f565b828001600101855582156200020f579182015b828111156200020f578251825591602001919060010190620001f2565b506200021d92915062000221565b5090565b5b808211156200021d576000815560010162000222565b80516001600160a01b03811681146200025057600080fd5b919050565b6000806040838503121562000268578182fd5b620002738362000238565b9150620002836020840162000238565b90509250929050565b600181811c90821680620002a157607f821691505b60208210811415620002c357634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c60c05160601c612ae46200031e6000396000818161059301526111b00152600081816103fe015281816115fa0152611699015260008181610c720152610cb40152612ae46000f3fe608060405234801561001057600080fd5b50600436106102745760003560e01c80639156420611610151578063c76af6ec116100c3578063e60aa98911610087578063e60aa9891461061c578063e7bad88e1461062f578063e985e9c514610658578063f1ce3f9814610694578063f2fde38b146106a7578063f9fd9ef6146106ba57600080fd5b8063c76af6ec14610568578063c87b56dd1461057b578063caf89f891461058e578063cc33c875146105b5578063ce22369c1461060957600080fd5b8063a4efae6b11610115578063a4efae6b146104d6578063a91cf6c114610502578063b88d4fde14610522578063c093afdb14610535578063c293514b14610548578063c35506c01461055b57600080fd5b8063915642061461047257806395d89b411461048557806397dc4a131461048d5780639d5951e7146104a0578063a22cb465146104c357600080fd5b806327dd8ee7116101ea57806350b06509116101ae57806350b06509146103f957806360ad0999146104205780636352211e1461043357806370a0823114610446578063715018a6146104595780638da5cb5b1461046157600080fd5b806327dd8ee71461038f57806342842e0e146103a2578063451450ec146103b55780634586fb4e146103c85780634a17600a146103d157600080fd5b8063095ea7b31161023c578063095ea7b3146102fe5780631424f3641461031157806318160ddd146103245780631fe543e31461033e57806320c5780c1461035157806323b872dd1461037c57600080fd5b806301faed7b1461027957806301ffc9a71461028357806303b328c2146102ab57806306fdde03146102be578063081812fc146102d3575b600080fd5b6102816106c2565b005b610296610291366004612742565b610701565b60405190151581526020015b60405180910390f35b6102816102b936600461277a565b610753565b6102c6610908565b6040516102a291906128c8565b6102e66102e136600461277a565b61099a565b6040516001600160a01b0390911681526020016102a2565b61028161030c366004612574565b6109de565b61028161031f366004612805565b610a7e565b60015460005403600019015b6040519081526020016102a2565b61028161034c3660046127aa565b610c67565b601154610364906001600160401b031681565b6040516001600160401b0390911681526020016102a2565b61028161038a366004612487565b610cef565b61028161039d366004612684565b610e8a565b6102816103b0366004612487565b610fd1565b6102816103c33660046127e4565b610fec565b61033060105481565b6011546103e690600160401b900461ffff1681565b60405161ffff90911681526020016102a2565b6102e67f000000000000000000000000000000000000000000000000000000000000000081565b61028161042e36600461277a565b6112b7565b6102e661044136600461277a565b611435565b610330610454366004612417565b611440565b61028161148e565b6008546001600160a01b03166102e6565b6102c661048036600461277a565b6114c4565b6102c661155e565b61028161049b36600461277a565b61156d565b6102966104ae36600461277a565b600c6020526000908152604090205460ff1681565b6102816104d1366004612543565b611795565b6011546104ed90600160501b900463ffffffff1681565b60405163ffffffff90911681526020016102a2565b61033061051036600461277a565b600e6020526000908152604090205481565b6102816105303660046124c7565b61182b565b6009546102e6906001600160a01b031681565b61028161055636600461277a565b611875565b600f546102969060ff1681565b61028161057636600461259f565b6118ba565b6102c661058936600461277a565b611978565b6102e67f000000000000000000000000000000000000000000000000000000000000000081565b6105e96105c336600461277a565b600d602052600090815260409020546001600160401b0380821691600160401b90041682565b604080516001600160401b039384168152929091166020830152016102a2565b6102816106173660046126e4565b611a9f565b61028161062a366004612417565b611b1e565b61036461063d36600461277a565b6000908152600d60205260409020546001600160401b031690565b61029661066636600461244f565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6103646106a236600461277a565b611b6a565b6102816106b5366004612417565b611ba7565b610281611c42565b6008546001600160a01b031633146106f55760405162461bcd60e51b81526004016106ec906128db565b60405180910390fd5b600f805460ff19169055565b60006301ffc9a760e01b6001600160e01b03198316148061073257506380ac58cd60e01b6001600160e01b03198316145b8061074d5750635b5e139f60e01b6001600160e01b03198316145b92915050565b6008546001600160a01b0316331461077d5760405162461bcd60e51b81526004016106ec906128db565b6000818152600e6020908152604080832054808452600d8352928190208151808301909252546001600160401b038082168352600160401b9091041691810182905290806107de5760405163b232fe6d60e01b815260040160405180910390fd5b81516001600160401b0316156108075760405163744b78d160e01b815260040160405180910390fd5b62015180610815824261297b565b101561083457604051630714a68f60e21b815260040160405180910390fd5b6000838152600d60205260408120805467ffffffffffffffff60401b19169055600b805461086360014361297b565b61086e919040612a37565b8154811061088c57634e487b7160e01b600052603260045260246000fd5b60009182526020808320600483040154878452600d9091526040808420805460039094166008026101000a9092046001600160401b031667ffffffffffffffff19909316831790915551909250829186917f44d316f35f1585befa5892f02f608a238384a24e0a70abcbe9daeebaad0882d79190a35050505050565b606060028054610917906129e1565b80601f0160208091040260200160405190810160405280929190818152602001828054610943906129e1565b80156109905780601f1061096557610100808354040283529160200191610990565b820191906000526020600020905b81548152906001019060200180831161097357829003601f168201915b5050505050905090565b60006109a582611c7b565b6109c2576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006109e982611435565b9050336001600160a01b03821614610a2257610a058133610666565b610a22576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b33610a8883611435565b6001600160a01b031614610aaf57604051630247f98760e21b815260040160405180910390fd5b6000828152600d60209081526040918290208251808401909352546001600160401b03808216808552600160401b909204169183019190915215610b065760405163744b78d160e01b815260040160405180910390fd5b6001600160401b0382166000908152600c602052604090205460ff16610b3f576040516312abc46160e31b815260040160405180910390fd5b60208101516001600160401b031615610b6b5760405163dfa2608f60e01b815260040160405180910390fd5b6009546001600160a01b0316610b945760405163d71ea6b560e01b815260040160405180910390fd5b6000838152600d602052604090819020805467ffffffffffffffff19166001600160401b038516908117909155600954915163054f3da360e51b81523360048201526024810191909152600160448201526001600160a01b039091169063a9e7b46090606401600060405180830381600087803b158015610c1457600080fd5b505af1158015610c28573d6000803e3d6000fd5b50506040516001600160401b03851692508591507f44d316f35f1585befa5892f02f608a238384a24e0a70abcbe9daeebaad0882d790600090a3505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610ce15760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044016106ec565b610ceb8282611cb0565b5050565b6000610cfa82611e17565b9050836001600160a01b0316816001600160a01b031614610d2d5760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054610d598187335b6001600160a01b039081169116811491141790565b610d8457610d678633610666565b610d8457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610dab57604051633a954ecd60e21b815260040160405180910390fd5b8015610db657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b8316610e415760018401600081815260046020526040902054610e3f576000548114610e3f5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6008546001600160a01b03163314610eb45760405162461bcd60e51b81526004016106ec906128db565b60005b8251811015610fcc576000838281518110610ee257634e487b7160e01b600052603260045260246000fd5b602002602001015190506000838381518110610f0e57634e487b7160e01b600052603260045260246000fd5b602002602001015190505b6001600160401b03811615610f9757600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db96004820401805460039092166008026101000a6001600160401b03818102199093169285160291909117905580610f8f816129be565b915050610f19565b506001600160401b03166000908152600c60205260409020805460ff1916600117905580610fc481612a1c565b915050610eb7565b505050565b610fcc8383836040518060200160405280600081525061182b565b600f5460ff1615801561100a57506008546001600160a01b03163314155b15611028576040516368189eb560e11b815260040160405180910390fd5b8082141561104957604051633d4cfcc560e11b815260040160405180910390fd5b3361105383611435565b6001600160a01b031614158061107a57503361106e82611435565b6001600160a01b031614155b1561109857604051630247f98760e21b815260040160405180910390fd5b6000828152600d6020526040902054600160401b90046001600160401b03161515806110e157506000818152600d6020526040902054600160401b90046001600160401b031615155b156110ff5760405163dfa2608f60e01b815260040160405180910390fd5b6000828152600d60205260409020546001600160401b031615158061113a57506000818152600d60205260409020546001600160401b031615155b156111585760405163744b78d160e01b815260040160405180910390fd5b6010546011546040516305d3b1d360e41b815260048101929092526001600160401b0381166024830152600160401b810461ffff166044830152600160501b900463ffffffff166064820152600160848201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635d3b1d309060a401602060405180830381600087803b1580156111fc57600080fd5b505af1158015611210573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112349190612792565b6000818152600e60209081526040808320879055868352600d9091528120805467ffffffffffffffff60401b1916600160401b426001600160401b031602179055909150611283908390611e80565b8181847fa666185d66393db48e038164c16d89525f3cd9df1defc67024195173b3ed675b60405160405180910390a4505050565b336112c182611435565b6001600160a01b0316146112e857604051630247f98760e21b815260040160405180910390fd5b6000818152600d60209081526040918290208251808401909352546001600160401b03808216808552600160401b909204169183019190915261133e57604051635e459f5960e11b815260040160405180910390fd5b6009546001600160a01b03166113675760405163d71ea6b560e01b815260040160405180910390fd5b80516000838152600d602052604090819020805467ffffffffffffffff1916905560095490516331eae51760e01b81523360048201526001600160401b0383166024820152600160448201526001600160a01b03909116906331eae51790606401600060405180830381600087803b1580156113e257600080fd5b505af11580156113f6573d6000803e3d6000fd5b50506040516001600160401b03841692508591507f23fa758a0952502661ac810e03d50593412c7e53ea0c6602a729986a7be6087f90600090a3505050565b600061074d82611e17565b60006001600160a01b038216611469576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b031633146114b85760405162461bcd60e51b81526004016106ec906128db565b6114c26000611fc3565b565b600a60205260009081526040902080546114dd906129e1565b80601f0160208091040260200160405190810160405280929190818152602001828054611509906129e1565b80156115565780601f1061152b57610100808354040283529160200191611556565b820191906000526020600020905b81548152906001019060200180831161153957829003601f168201915b505050505081565b606060038054610917906129e1565b6008546001600160a01b031633146115975760405162461bcd60e51b81526004016106ec906128db565b600080549060016115a88484612963565b6115b2919061297b565b9050610d058111156115d757604051637ebdee1b60e01b815260040160405180910390fd5b6040516331a9108f60e11b81526004810183905260009081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690636352211e90602401602060405180830381600087803b15801561163e57600080fd5b505af1158015611652573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116769190612433565b90505b82841161178e576040516331a9108f60e11b8152600481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381600087803b1580156116e557600080fd5b505af11580156116f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171d9190612433565b9050816001600160a01b0316816001600160a01b03161415806117405750826020145b1561175b5761174f8284612015565b60019250809150611769565b8261176581612a1c565b9350505b8385141561177b5761177b8184612015565b8461178581612a1c565b95505050611679565b5050505050565b6001600160a01b0382163314156117bf5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611836848484610cef565b6001600160a01b0383163b1561186f57611852848484846120f2565b61186f576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6008546001600160a01b0316331461189f5760405162461bcd60e51b81526004016106ec906128db565b6000908152600c60205260409020805460ff19166001179055565b6008546001600160a01b031633146118e45760405162461bcd60e51b81526004016106ec906128db565b60005b8251811015610fcc5781818151811061191057634e487b7160e01b600052603260045260246000fd5b6020026020010151600a600085848151811061193c57634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000209080519060200190611965929190612238565b508061197081612a1c565b9150506118e7565b606061198382611c7b565b6119a057604051630a14c4b560e41b815260040160405180910390fd5b6000828152600d60209081526040808320546001600160401b03168352600a909152812080546119cf906129e1565b80601f01602080910402602001604051908101604052809291908181526020018280546119fb906129e1565b8015611a485780601f10611a1d57610100808354040283529160200191611a48565b820191906000526020600020905b815481529060010190602001808311611a2b57829003601f168201915b505050505090506000815111611a6d5760405180602001604052806000815250611a98565b80611a77846121e9565b604051602001611a8892919061285c565b6040516020818303038152906040525b9392505050565b6008546001600160a01b03163314611ac95760405162461bcd60e51b81526004016106ec906128db565b6010939093556011805463ffffffff909416600160501b0263ffffffff60501b1961ffff909316600160401b0269ffffffffffffffffffff199095166001600160401b03909416939093179390931716179055565b6008546001600160a01b03163314611b485760405162461bcd60e51b81526004016106ec906128db565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b8181548110611b7a57600080fd5b9060005260206000209060049182820401919006600802915054906101000a90046001600160401b031681565b6008546001600160a01b03163314611bd15760405162461bcd60e51b81526004016106ec906128db565b6001600160a01b038116611c365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ec565b611c3f81611fc3565b50565b6008546001600160a01b03163314611c6c5760405162461bcd60e51b81526004016106ec906128db565b600f805460ff19166001179055565b600081600111158015611c8f575060005482105b801561074d575050600090815260046020526040902054600160e01b161590565b6000828152600e6020908152604080832054808452600d8352928190208151808301909252546001600160401b038082168352600160401b9091041691810182905290611d105760405163b232fe6d60e01b815260040160405180910390fd5b80516001600160401b031615611d395760405163744b78d160e01b815260040160405180910390fd5b6000600b808054905085600081518110611d6357634e487b7160e01b600052603260045260246000fd5b6020026020010151611d759190612a37565b81548110611d9357634e487b7160e01b600052603260045260246000fd5b60009182526020808320600483040154868452600d9091526040808420805460039094166008026101000a9092046001600160401b03166fffffffffffffffffffffffffffffffff19909316831790915551909250829185917f44d316f35f1585befa5892f02f608a238384a24e0a70abcbe9daeebaad0882d79190a35050505050565b60008180600111611e6757600054811015611e6757600081815260046020526040902054600160e01b8116611e65575b80611a98575060001901600081815260046020526040902054611e47565b505b604051636f96cda160e11b815260040160405180910390fd5b6000611e8b83611e17565b905080600080611ea986600090815260066020526040902080549091565b915091508415611ee957611ebe818433610d44565b611ee957611ecc8333610666565b611ee957604051632ce44b5f60e11b815260040160405180910390fd5b8015611ef457600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040902055600160e11b8416611f7b5760018601600081815260046020526040902054611f79576000548114611f795760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000546001600160a01b03831661203e57604051622e076360e81b815260040160405180910390fd5b8161205c5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600081815260056020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48082106120a65760005550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061212790339089908890889060040161288b565b602060405180830381600087803b15801561214157600080fd5b505af1925050508015612171575060408051601f3d908101601f1916820190925261216e9181019061275e565b60015b6121cc573d80801561219f576040519150601f19603f3d011682016040523d82523d6000602084013e6121a4565b606091505b5080516121c4576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b604080516080810191829052607f0190826030600a8206018353600a90045b801561222657600183039250600a81066030018353600a9004612208565b50819003601f19909101908152919050565b828054612244906129e1565b90600052602060002090601f01602090048101928261226657600085556122ac565b82601f1061227f57805160ff19168380011785556122ac565b828001600101855582156122ac579182015b828111156122ac578251825591602001919060010190612291565b506122b89291506122bc565b5090565b5b808211156122b857600081556001016122bd565b60006001600160401b038311156122ea576122ea612a6d565b6122fd601f8401601f1916602001612910565b905082815283838301111561231157600080fd5b828260208301376000602084830101529392505050565b600082601f830112612338578081fd5b8135602061234d61234883612940565b612910565b80838252828201915082860187848660051b890101111561236c578586fd5b855b8581101561238a5781358452928401929084019060010161236e565b5090979650505050505050565b600082601f8301126123a7578081fd5b813560206123b761234883612940565b80838252828201915082860187848660051b89010111156123d6578586fd5b855b8581101561238a576123e9826123fb565b845292840192908401906001016123d8565b80356001600160401b038116811461241257600080fd5b919050565b600060208284031215612428578081fd5b8135611a9881612a83565b600060208284031215612444578081fd5b8151611a9881612a83565b60008060408385031215612461578081fd5b823561246c81612a83565b9150602083013561247c81612a83565b809150509250929050565b60008060006060848603121561249b578081fd5b83356124a681612a83565b925060208401356124b681612a83565b929592945050506040919091013590565b600080600080608085870312156124dc578182fd5b84356124e781612a83565b935060208501356124f781612a83565b92506040850135915060608501356001600160401b03811115612518578182fd5b8501601f81018713612528578182fd5b612537878235602084016122d1565b91505092959194509250565b60008060408385031215612555578182fd5b823561256081612a83565b91506020830135801515811461247c578182fd5b60008060408385031215612586578182fd5b823561259181612a83565b946020939093013593505050565b60008060408084860312156125b2578283fd5b83356001600160401b03808211156125c8578485fd5b6125d487838801612328565b94506020915081860135818111156125ea578485fd5b8601601f810188136125fa578485fd5b803561260861234882612940565b8082825285820191508584018b878560051b8701011115612627578889fd5b885b848110156126725781358781111561263f578a8bfd5b8601603f81018e1361264f578a8bfd5b61265f8e8a8301358c84016122d1565b8552509287019290870190600101612629565b50989b909a5098505050505050505050565b60008060408385031215612696578182fd5b82356001600160401b03808211156126ac578384fd5b6126b886838701612397565b935060208501359150808211156126cd578283fd5b506126da85828601612397565b9150509250929050565b600080600080608085870312156126f9578182fd5b84359350612709602086016123fb565b9250604085013561ffff8116811461271f578283fd5b9150606085013563ffffffff81168114612737578182fd5b939692955090935050565b600060208284031215612753578081fd5b8135611a9881612a98565b60006020828403121561276f578081fd5b8151611a9881612a98565b60006020828403121561278b578081fd5b5035919050565b6000602082840312156127a3578081fd5b5051919050565b600080604083850312156127bc578182fd5b8235915060208301356001600160401b038111156127d8578182fd5b6126da85828601612328565b600080604083850312156127f6578182fd5b50508035926020909101359150565b60008060408385031215612817578182fd5b82359150612827602084016123fb565b90509250929050565b60008151808452612848816020860160208601612992565b601f01601f19169290920160200192915050565b6000835161286e818460208801612992565b835190830190612882818360208801612992565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906128be90830184612830565b9695505050505050565b602081526000611a986020830184612830565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f191681016001600160401b038111828210171561293857612938612a6d565b604052919050565b60006001600160401b0382111561295957612959612a6d565b5060051b60200190565b6000821982111561297657612976612a57565b500190565b60008282101561298d5761298d612a57565b500390565b60005b838110156129ad578181015183820152602001612995565b8381111561186f5750506000910152565b60006001600160401b038216806129d7576129d7612a57565b6000190192915050565b600181811c908216806129f557607f821691505b60208210811415612a1657634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612a3057612a30612a57565b5060010190565b600082612a5257634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611c3f57600080fd5b6001600160e01b031981168114611c3f57600080fdfea26469706673582212203e0a3d5ead290d7df2b26b16700849e74965fddfb7fb1635f679c7da5c93b0cb64736f6c63430008040033000000000000000000000000c99c679c50033bbc5321eb88752e89a93e9e83c5000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102745760003560e01c80639156420611610151578063c76af6ec116100c3578063e60aa98911610087578063e60aa9891461061c578063e7bad88e1461062f578063e985e9c514610658578063f1ce3f9814610694578063f2fde38b146106a7578063f9fd9ef6146106ba57600080fd5b8063c76af6ec14610568578063c87b56dd1461057b578063caf89f891461058e578063cc33c875146105b5578063ce22369c1461060957600080fd5b8063a4efae6b11610115578063a4efae6b146104d6578063a91cf6c114610502578063b88d4fde14610522578063c093afdb14610535578063c293514b14610548578063c35506c01461055b57600080fd5b8063915642061461047257806395d89b411461048557806397dc4a131461048d5780639d5951e7146104a0578063a22cb465146104c357600080fd5b806327dd8ee7116101ea57806350b06509116101ae57806350b06509146103f957806360ad0999146104205780636352211e1461043357806370a0823114610446578063715018a6146104595780638da5cb5b1461046157600080fd5b806327dd8ee71461038f57806342842e0e146103a2578063451450ec146103b55780634586fb4e146103c85780634a17600a146103d157600080fd5b8063095ea7b31161023c578063095ea7b3146102fe5780631424f3641461031157806318160ddd146103245780631fe543e31461033e57806320c5780c1461035157806323b872dd1461037c57600080fd5b806301faed7b1461027957806301ffc9a71461028357806303b328c2146102ab57806306fdde03146102be578063081812fc146102d3575b600080fd5b6102816106c2565b005b610296610291366004612742565b610701565b60405190151581526020015b60405180910390f35b6102816102b936600461277a565b610753565b6102c6610908565b6040516102a291906128c8565b6102e66102e136600461277a565b61099a565b6040516001600160a01b0390911681526020016102a2565b61028161030c366004612574565b6109de565b61028161031f366004612805565b610a7e565b60015460005403600019015b6040519081526020016102a2565b61028161034c3660046127aa565b610c67565b601154610364906001600160401b031681565b6040516001600160401b0390911681526020016102a2565b61028161038a366004612487565b610cef565b61028161039d366004612684565b610e8a565b6102816103b0366004612487565b610fd1565b6102816103c33660046127e4565b610fec565b61033060105481565b6011546103e690600160401b900461ffff1681565b60405161ffff90911681526020016102a2565b6102e67f000000000000000000000000c99c679c50033bbc5321eb88752e89a93e9e83c581565b61028161042e36600461277a565b6112b7565b6102e661044136600461277a565b611435565b610330610454366004612417565b611440565b61028161148e565b6008546001600160a01b03166102e6565b6102c661048036600461277a565b6114c4565b6102c661155e565b61028161049b36600461277a565b61156d565b6102966104ae36600461277a565b600c6020526000908152604090205460ff1681565b6102816104d1366004612543565b611795565b6011546104ed90600160501b900463ffffffff1681565b60405163ffffffff90911681526020016102a2565b61033061051036600461277a565b600e6020526000908152604090205481565b6102816105303660046124c7565b61182b565b6009546102e6906001600160a01b031681565b61028161055636600461277a565b611875565b600f546102969060ff1681565b61028161057636600461259f565b6118ba565b6102c661058936600461277a565b611978565b6102e67f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990981565b6105e96105c336600461277a565b600d602052600090815260409020546001600160401b0380821691600160401b90041682565b604080516001600160401b039384168152929091166020830152016102a2565b6102816106173660046126e4565b611a9f565b61028161062a366004612417565b611b1e565b61036461063d36600461277a565b6000908152600d60205260409020546001600160401b031690565b61029661066636600461244f565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6103646106a236600461277a565b611b6a565b6102816106b5366004612417565b611ba7565b610281611c42565b6008546001600160a01b031633146106f55760405162461bcd60e51b81526004016106ec906128db565b60405180910390fd5b600f805460ff19169055565b60006301ffc9a760e01b6001600160e01b03198316148061073257506380ac58cd60e01b6001600160e01b03198316145b8061074d5750635b5e139f60e01b6001600160e01b03198316145b92915050565b6008546001600160a01b0316331461077d5760405162461bcd60e51b81526004016106ec906128db565b6000818152600e6020908152604080832054808452600d8352928190208151808301909252546001600160401b038082168352600160401b9091041691810182905290806107de5760405163b232fe6d60e01b815260040160405180910390fd5b81516001600160401b0316156108075760405163744b78d160e01b815260040160405180910390fd5b62015180610815824261297b565b101561083457604051630714a68f60e21b815260040160405180910390fd5b6000838152600d60205260408120805467ffffffffffffffff60401b19169055600b805461086360014361297b565b61086e919040612a37565b8154811061088c57634e487b7160e01b600052603260045260246000fd5b60009182526020808320600483040154878452600d9091526040808420805460039094166008026101000a9092046001600160401b031667ffffffffffffffff19909316831790915551909250829186917f44d316f35f1585befa5892f02f608a238384a24e0a70abcbe9daeebaad0882d79190a35050505050565b606060028054610917906129e1565b80601f0160208091040260200160405190810160405280929190818152602001828054610943906129e1565b80156109905780601f1061096557610100808354040283529160200191610990565b820191906000526020600020905b81548152906001019060200180831161097357829003601f168201915b5050505050905090565b60006109a582611c7b565b6109c2576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006109e982611435565b9050336001600160a01b03821614610a2257610a058133610666565b610a22576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b33610a8883611435565b6001600160a01b031614610aaf57604051630247f98760e21b815260040160405180910390fd5b6000828152600d60209081526040918290208251808401909352546001600160401b03808216808552600160401b909204169183019190915215610b065760405163744b78d160e01b815260040160405180910390fd5b6001600160401b0382166000908152600c602052604090205460ff16610b3f576040516312abc46160e31b815260040160405180910390fd5b60208101516001600160401b031615610b6b5760405163dfa2608f60e01b815260040160405180910390fd5b6009546001600160a01b0316610b945760405163d71ea6b560e01b815260040160405180910390fd5b6000838152600d602052604090819020805467ffffffffffffffff19166001600160401b038516908117909155600954915163054f3da360e51b81523360048201526024810191909152600160448201526001600160a01b039091169063a9e7b46090606401600060405180830381600087803b158015610c1457600080fd5b505af1158015610c28573d6000803e3d6000fd5b50506040516001600160401b03851692508591507f44d316f35f1585befa5892f02f608a238384a24e0a70abcbe9daeebaad0882d790600090a3505050565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091614610ce15760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091660248201526044016106ec565b610ceb8282611cb0565b5050565b6000610cfa82611e17565b9050836001600160a01b0316816001600160a01b031614610d2d5760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054610d598187335b6001600160a01b039081169116811491141790565b610d8457610d678633610666565b610d8457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610dab57604051633a954ecd60e21b815260040160405180910390fd5b8015610db657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b8316610e415760018401600081815260046020526040902054610e3f576000548114610e3f5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6008546001600160a01b03163314610eb45760405162461bcd60e51b81526004016106ec906128db565b60005b8251811015610fcc576000838281518110610ee257634e487b7160e01b600052603260045260246000fd5b602002602001015190506000838381518110610f0e57634e487b7160e01b600052603260045260246000fd5b602002602001015190505b6001600160401b03811615610f9757600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db96004820401805460039092166008026101000a6001600160401b03818102199093169285160291909117905580610f8f816129be565b915050610f19565b506001600160401b03166000908152600c60205260409020805460ff1916600117905580610fc481612a1c565b915050610eb7565b505050565b610fcc8383836040518060200160405280600081525061182b565b600f5460ff1615801561100a57506008546001600160a01b03163314155b15611028576040516368189eb560e11b815260040160405180910390fd5b8082141561104957604051633d4cfcc560e11b815260040160405180910390fd5b3361105383611435565b6001600160a01b031614158061107a57503361106e82611435565b6001600160a01b031614155b1561109857604051630247f98760e21b815260040160405180910390fd5b6000828152600d6020526040902054600160401b90046001600160401b03161515806110e157506000818152600d6020526040902054600160401b90046001600160401b031615155b156110ff5760405163dfa2608f60e01b815260040160405180910390fd5b6000828152600d60205260409020546001600160401b031615158061113a57506000818152600d60205260409020546001600160401b031615155b156111585760405163744b78d160e01b815260040160405180910390fd5b6010546011546040516305d3b1d360e41b815260048101929092526001600160401b0381166024830152600160401b810461ffff166044830152600160501b900463ffffffff166064820152600160848201526000907f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699096001600160a01b031690635d3b1d309060a401602060405180830381600087803b1580156111fc57600080fd5b505af1158015611210573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112349190612792565b6000818152600e60209081526040808320879055868352600d9091528120805467ffffffffffffffff60401b1916600160401b426001600160401b031602179055909150611283908390611e80565b8181847fa666185d66393db48e038164c16d89525f3cd9df1defc67024195173b3ed675b60405160405180910390a4505050565b336112c182611435565b6001600160a01b0316146112e857604051630247f98760e21b815260040160405180910390fd5b6000818152600d60209081526040918290208251808401909352546001600160401b03808216808552600160401b909204169183019190915261133e57604051635e459f5960e11b815260040160405180910390fd5b6009546001600160a01b03166113675760405163d71ea6b560e01b815260040160405180910390fd5b80516000838152600d602052604090819020805467ffffffffffffffff1916905560095490516331eae51760e01b81523360048201526001600160401b0383166024820152600160448201526001600160a01b03909116906331eae51790606401600060405180830381600087803b1580156113e257600080fd5b505af11580156113f6573d6000803e3d6000fd5b50506040516001600160401b03841692508591507f23fa758a0952502661ac810e03d50593412c7e53ea0c6602a729986a7be6087f90600090a3505050565b600061074d82611e17565b60006001600160a01b038216611469576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b031633146114b85760405162461bcd60e51b81526004016106ec906128db565b6114c26000611fc3565b565b600a60205260009081526040902080546114dd906129e1565b80601f0160208091040260200160405190810160405280929190818152602001828054611509906129e1565b80156115565780601f1061152b57610100808354040283529160200191611556565b820191906000526020600020905b81548152906001019060200180831161153957829003601f168201915b505050505081565b606060038054610917906129e1565b6008546001600160a01b031633146115975760405162461bcd60e51b81526004016106ec906128db565b600080549060016115a88484612963565b6115b2919061297b565b9050610d058111156115d757604051637ebdee1b60e01b815260040160405180910390fd5b6040516331a9108f60e11b81526004810183905260009081906001600160a01b037f000000000000000000000000c99c679c50033bbc5321eb88752e89a93e9e83c51690636352211e90602401602060405180830381600087803b15801561163e57600080fd5b505af1158015611652573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116769190612433565b90505b82841161178e576040516331a9108f60e11b8152600481018590526000907f000000000000000000000000c99c679c50033bbc5321eb88752e89a93e9e83c56001600160a01b031690636352211e90602401602060405180830381600087803b1580156116e557600080fd5b505af11580156116f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171d9190612433565b9050816001600160a01b0316816001600160a01b03161415806117405750826020145b1561175b5761174f8284612015565b60019250809150611769565b8261176581612a1c565b9350505b8385141561177b5761177b8184612015565b8461178581612a1c565b95505050611679565b5050505050565b6001600160a01b0382163314156117bf5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611836848484610cef565b6001600160a01b0383163b1561186f57611852848484846120f2565b61186f576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6008546001600160a01b0316331461189f5760405162461bcd60e51b81526004016106ec906128db565b6000908152600c60205260409020805460ff19166001179055565b6008546001600160a01b031633146118e45760405162461bcd60e51b81526004016106ec906128db565b60005b8251811015610fcc5781818151811061191057634e487b7160e01b600052603260045260246000fd5b6020026020010151600a600085848151811061193c57634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000209080519060200190611965929190612238565b508061197081612a1c565b9150506118e7565b606061198382611c7b565b6119a057604051630a14c4b560e41b815260040160405180910390fd5b6000828152600d60209081526040808320546001600160401b03168352600a909152812080546119cf906129e1565b80601f01602080910402602001604051908101604052809291908181526020018280546119fb906129e1565b8015611a485780601f10611a1d57610100808354040283529160200191611a48565b820191906000526020600020905b815481529060010190602001808311611a2b57829003601f168201915b505050505090506000815111611a6d5760405180602001604052806000815250611a98565b80611a77846121e9565b604051602001611a8892919061285c565b6040516020818303038152906040525b9392505050565b6008546001600160a01b03163314611ac95760405162461bcd60e51b81526004016106ec906128db565b6010939093556011805463ffffffff909416600160501b0263ffffffff60501b1961ffff909316600160401b0269ffffffffffffffffffff199095166001600160401b03909416939093179390931716179055565b6008546001600160a01b03163314611b485760405162461bcd60e51b81526004016106ec906128db565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b8181548110611b7a57600080fd5b9060005260206000209060049182820401919006600802915054906101000a90046001600160401b031681565b6008546001600160a01b03163314611bd15760405162461bcd60e51b81526004016106ec906128db565b6001600160a01b038116611c365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ec565b611c3f81611fc3565b50565b6008546001600160a01b03163314611c6c5760405162461bcd60e51b81526004016106ec906128db565b600f805460ff19166001179055565b600081600111158015611c8f575060005482105b801561074d575050600090815260046020526040902054600160e01b161590565b6000828152600e6020908152604080832054808452600d8352928190208151808301909252546001600160401b038082168352600160401b9091041691810182905290611d105760405163b232fe6d60e01b815260040160405180910390fd5b80516001600160401b031615611d395760405163744b78d160e01b815260040160405180910390fd5b6000600b808054905085600081518110611d6357634e487b7160e01b600052603260045260246000fd5b6020026020010151611d759190612a37565b81548110611d9357634e487b7160e01b600052603260045260246000fd5b60009182526020808320600483040154868452600d9091526040808420805460039094166008026101000a9092046001600160401b03166fffffffffffffffffffffffffffffffff19909316831790915551909250829185917f44d316f35f1585befa5892f02f608a238384a24e0a70abcbe9daeebaad0882d79190a35050505050565b60008180600111611e6757600054811015611e6757600081815260046020526040902054600160e01b8116611e65575b80611a98575060001901600081815260046020526040902054611e47565b505b604051636f96cda160e11b815260040160405180910390fd5b6000611e8b83611e17565b905080600080611ea986600090815260066020526040902080549091565b915091508415611ee957611ebe818433610d44565b611ee957611ecc8333610666565b611ee957604051632ce44b5f60e11b815260040160405180910390fd5b8015611ef457600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040902055600160e11b8416611f7b5760018601600081815260046020526040902054611f79576000548114611f795760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000546001600160a01b03831661203e57604051622e076360e81b815260040160405180910390fd5b8161205c5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600081815260056020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48082106120a65760005550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061212790339089908890889060040161288b565b602060405180830381600087803b15801561214157600080fd5b505af1925050508015612171575060408051601f3d908101601f1916820190925261216e9181019061275e565b60015b6121cc573d80801561219f576040519150601f19603f3d011682016040523d82523d6000602084013e6121a4565b606091505b5080516121c4576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b604080516080810191829052607f0190826030600a8206018353600a90045b801561222657600183039250600a81066030018353600a9004612208565b50819003601f19909101908152919050565b828054612244906129e1565b90600052602060002090601f01602090048101928261226657600085556122ac565b82601f1061227f57805160ff19168380011785556122ac565b828001600101855582156122ac579182015b828111156122ac578251825591602001919060010190612291565b506122b89291506122bc565b5090565b5b808211156122b857600081556001016122bd565b60006001600160401b038311156122ea576122ea612a6d565b6122fd601f8401601f1916602001612910565b905082815283838301111561231157600080fd5b828260208301376000602084830101529392505050565b600082601f830112612338578081fd5b8135602061234d61234883612940565b612910565b80838252828201915082860187848660051b890101111561236c578586fd5b855b8581101561238a5781358452928401929084019060010161236e565b5090979650505050505050565b600082601f8301126123a7578081fd5b813560206123b761234883612940565b80838252828201915082860187848660051b89010111156123d6578586fd5b855b8581101561238a576123e9826123fb565b845292840192908401906001016123d8565b80356001600160401b038116811461241257600080fd5b919050565b600060208284031215612428578081fd5b8135611a9881612a83565b600060208284031215612444578081fd5b8151611a9881612a83565b60008060408385031215612461578081fd5b823561246c81612a83565b9150602083013561247c81612a83565b809150509250929050565b60008060006060848603121561249b578081fd5b83356124a681612a83565b925060208401356124b681612a83565b929592945050506040919091013590565b600080600080608085870312156124dc578182fd5b84356124e781612a83565b935060208501356124f781612a83565b92506040850135915060608501356001600160401b03811115612518578182fd5b8501601f81018713612528578182fd5b612537878235602084016122d1565b91505092959194509250565b60008060408385031215612555578182fd5b823561256081612a83565b91506020830135801515811461247c578182fd5b60008060408385031215612586578182fd5b823561259181612a83565b946020939093013593505050565b60008060408084860312156125b2578283fd5b83356001600160401b03808211156125c8578485fd5b6125d487838801612328565b94506020915081860135818111156125ea578485fd5b8601601f810188136125fa578485fd5b803561260861234882612940565b8082825285820191508584018b878560051b8701011115612627578889fd5b885b848110156126725781358781111561263f578a8bfd5b8601603f81018e1361264f578a8bfd5b61265f8e8a8301358c84016122d1565b8552509287019290870190600101612629565b50989b909a5098505050505050505050565b60008060408385031215612696578182fd5b82356001600160401b03808211156126ac578384fd5b6126b886838701612397565b935060208501359150808211156126cd578283fd5b506126da85828601612397565b9150509250929050565b600080600080608085870312156126f9578182fd5b84359350612709602086016123fb565b9250604085013561ffff8116811461271f578283fd5b9150606085013563ffffffff81168114612737578182fd5b939692955090935050565b600060208284031215612753578081fd5b8135611a9881612a98565b60006020828403121561276f578081fd5b8151611a9881612a98565b60006020828403121561278b578081fd5b5035919050565b6000602082840312156127a3578081fd5b5051919050565b600080604083850312156127bc578182fd5b8235915060208301356001600160401b038111156127d8578182fd5b6126da85828601612328565b600080604083850312156127f6578182fd5b50508035926020909101359150565b60008060408385031215612817578182fd5b82359150612827602084016123fb565b90509250929050565b60008151808452612848816020860160208601612992565b601f01601f19169290920160200192915050565b6000835161286e818460208801612992565b835190830190612882818360208801612992565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906128be90830184612830565b9695505050505050565b602081526000611a986020830184612830565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f191681016001600160401b038111828210171561293857612938612a6d565b604052919050565b60006001600160401b0382111561295957612959612a6d565b5060051b60200190565b6000821982111561297657612976612a57565b500190565b60008282101561298d5761298d612a57565b500390565b60005b838110156129ad578181015183820152602001612995565b8381111561186f5750506000910152565b60006001600160401b038216806129d7576129d7612a57565b6000190192915050565b600181811c908216806129f557607f821691505b60208210811415612a1657634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612a3057612a30612a57565b5060010190565b600082612a5257634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611c3f57600080fd5b6001600160e01b031981168114611c3f57600080fdfea26469706673582212203e0a3d5ead290d7df2b26b16700849e74965fddfb7fb1635f679c7da5c93b0cb64736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c99c679c50033bbc5321eb88752e89a93e9e83c5000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
-----Decoded View---------------
Arg [0] : killabearsAddress (address): 0xc99c679C50033Bbc5321EB88752E89a93e9e83C5
Arg [1] : chainlinkAddress (address): 0x271682DEB8C4E0901D1a1550aD2e64D568E69909
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000c99c679c50033bbc5321eb88752e89a93e9e83c5
Arg [1] : 000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.