ERC-721
Source Code
Overview
Max Total Supply
116 RPB
Holders
27
Transfers
-
0
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
RoguePitBoss
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
interface DigitexNFT {
function getHostessIndexByTokenId(uint256 _tokenId) external view returns (uint256 _hostess);
}
contract RoguePitBoss is ERC721Royalty, VRFConsumerBaseV2, ERC721URIStorage, Ownable {
uint256 tokenId = 1;
event NFTMinted(uint256 requestId, address recipient, uint256 currentPrice, uint256 tokenId, Boss boss);
event DayAndPriceUpdated(uint256 currentDay, uint256 currentPrice);
event NFTRequested(uint256 requestId, address sender, uint256 currentPrice, uint256 tokenId);
// Chainlink VRF variables
VRFCoordinatorV2Interface COORDINATOR;
uint64 s_subscriptionId;
bytes32 keyHash = 0x68d24f9a037a649944964c2a1ebd0b2918f4a243d2a99701cc22b548cf2daff0; // Arbitrum mainnet 150 gwei gas lane
uint32 callbackGasLimit = 1000000;
uint16 requestConfirmations = 1;
uint32 numWords = 1;
mapping(uint256 => address) public s_requestIdToSender; // a mapping from requestId to the address that made that request
// NFT mint variables
uint256 startDate = 1694876400; // 9/16/23 15.00 pm UTC
uint256 currentDay = ((block.timestamp - startDate) + 86400) / 86400; // solidity rounds down so add extra day before division.
uint256 startPrice = 150000000000000000; // 0.15 ETH
uint256 currentPrice = startPrice + ((currentDay - 1) * 10000000000000000); // makes price rise by 0.01 ETH per day
uint256 maxSupply = 200; // maximum supply of 200 NFTS, cannot be edited
mapping(uint256 => uint256) public s_tokenIdToBoss;
string[] internal s_bossTokenURIs = [
"ipfs://QmVxHd73XKPeC1SVrvycen5JuWHZNXCyzcgQYG1FQf9GJX",
"ipfs://QmYrWP8JTxaTTsZQyrAtU59M1MD9BbU3B7i1WgqamZ8Sug",
"ipfs://Qmd8hh1r5E4e6aRYxQR6oB9mZd5ooszhrx7gfNQfi348dM",
"ipfs://QmZwn7fcdPbdcfnM4CGawGbrv1R5o9ud938mHbgvMxG1S2",
"ipfs://QmSVxQpC4kkX1PmAtCEMcnhb5vPoXADw9fAByhdcunsE8m",
"ipfs://QmSbTQj3cTMf1dda8577GVFoARdoHynotJ2hcScQmFiXx3",
"ipfs://Qmezfwoc3HPdcGpoWFndwnmpthjybx85YeuxAE6HC2TYfH",
"ipfs://QmVdkzL1jbqCqtHgwYtAt2qsoekLbo5WkpJBoMGkuyXgCt"
];
// [JackpotJake, RickyRoulette, SpinMasterSam, LuckyLou, JokerJoe, RollinRay, DiamondDave, CashKingCole]
constructor(
uint64 subscriptionId
)
ERC721("Rogue Pit Bosses", "RPB")
VRFConsumerBaseV2(0x41034678D6C633D8a95c75e1138A360a28bA15d1) // Arbitrum mainnet
Ownable(msg.sender)
{
COORDINATOR = VRFCoordinatorV2Interface(
0x41034678D6C633D8a95c75e1138A360a28bA15d1 // Arbitrum mainnet
);
s_subscriptionId = subscriptionId;
_setDefaultRoyalty(msg.sender, 1000);
}
address DigitexNFTAddress = 0xb03892814accca985E8AeC2F9fEdAC52b1Eb6759;
address nftOwnerAdmin = 0xBaA3C9086DCf6dadF7f9B71180f5026C3843929a;
// Assumes the Chainlink subscription is funded sufficiently.
function requestNFT()
external payable
returns (uint256 requestId)
{
if (tokenId > 116) {
require(msg.value >= currentPrice, "Not enough ETH sent; check price!");
}
if (tokenId > maxSupply) {
revert("The maximum supply of 200 has been reached, no more NFTs can be minted.");
}
if (tokenId < 107) { // take same rarity from corresponding DHRC NFT with same tokenId
uint256 _boss = DigitexNFT(DigitexNFTAddress).getHostessIndexByTokenId(tokenId);
_safeMint(nftOwnerAdmin, tokenId);
_setTokenURI(tokenId, s_bossTokenURIs[_boss]);
s_tokenIdToBoss[tokenId] = _boss;
tokenId += 1;
return _boss;
}
if (tokenId > 106) { // get random number from Chainlink VRF to determine rarity
// Will revert if subscription is not set and funded.
requestId = COORDINATOR.requestRandomWords(
keyHash,
s_subscriptionId,
requestConfirmations,
callbackGasLimit,
numWords
);
s_requestIdToSender[requestId] = msg.sender; // map the caller to their respective requestIDs.
emit NFTRequested(requestId, msg.sender, currentPrice, tokenId);
return requestId;
}
}
function getChanceArray() public pure returns (uint8[8] memory){
// index 0: 0.5% chance: JackpotJake
// index 1: 1% chance: RickyRoulette
// index 2: 3.5% chance: SpinMasterSam
// index 3: 7.5% chance: LuckyLou
// index 4: 12.5% chance: JokerJoe
// index 5: 25% chance: RollinRay
// index 6: 25% chance: DiamondDave
// index 7: 25% chance: CashKingCole
return [1, 3, 10, 25, 50, 100, 150, 200];
}
enum Boss {
JackpotJake, // 0th item, 0.5% chance
RickyRoulette, // 1st item, 1% chance
SpinMasterSam, // 2nd item, 3.5% chance
LuckyLou, // 3rd item, 7.5% chance
JokerJoe, // 4th item, 12.5% chance
RollinRay, // 5th item, 25% chance
DiamondDave, // 6th item, 25% chance
CashKingCole // 7th item, 25% chance
}
function getBossRarity(uint256 randomNumber) public pure returns (Boss)
{
uint256 cumulativeSum = 0;
uint8[8] memory chanceArray = getChanceArray();
// loop through chanceArray: [1, 3, 10, 25, 50, 100, 150, 200]
for (uint256 i = 0; i < chanceArray.length; i++) {
if (
randomNumber >= cumulativeSum && randomNumber < chanceArray[i]
) {
// if randomNumber:
// 0 => JackpotJake, 0.5% chance
// 1-2 => RickyRoulette, 1% chance
// 3-9 => SpinMasterSam, 3.5% chance
// 10-24 => LuckyLou, 7.5% chance
// 25-49 => JokerJoe, 12.5% chance
// 50-99 => RollinRay, 25% chance
// 100-149 => DiamondDave, 25% chance
// 150-199 => CashKingCole, 25% chance
return Boss(i);
}
cumulativeSum = chanceArray[i];
}
}
function fulfillRandomWords(
uint256 _requestId,
uint256[] memory _randomWords
) internal override {
address nftOwner = s_requestIdToSender[_requestId]; // map the requestId to whoever sent the request for Randomness
uint256 randomNumber = _randomWords[0] % 200; // get a random number between 0 - 199
Boss boss = getBossRarity(randomNumber); // get which random Boss to mint
_safeMint(nftOwner, tokenId);
_setTokenURI(tokenId, s_bossTokenURIs[uint256(boss)]);
s_tokenIdToBoss[tokenId] = uint256(boss);
tokenId += 1;
emit NFTMinted(_requestId, nftOwner, currentPrice, tokenId, boss);
}
function updateDayAndPrice() external {
currentDay = ((block.timestamp - startDate) + 86400) / 86400; // change to 3600 to test
currentPrice = startPrice + ((currentDay - 1) * 10000000000000000);// 0.01
emit DayAndPriceUpdated(currentDay, currentPrice);
}
function updateStartPrice(uint256 newPrice) external {
startPrice = newPrice;
}
// The following functions are overrides required by Solidity.
// function _burn(uint256 _tokenId) internal override(ERC721) { // had to remove ERC721URIStorage
// super._burn(_tokenId);
// }
function tokenURI(uint256 _tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(_tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Royalty, ERC721URIStorage)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function totalSupply() public view returns (uint256) {
return tokenId - 1;
}
function getTokenURIs(uint256 index) public view returns (string memory) {
return s_bossTokenURIs[index];
}
function getBossByTokenId(uint256 _tokenId) public view returns (string memory) {
if (_tokenId > 0 && _tokenId < tokenId) {
uint256 _boss = s_tokenIdToBoss[_tokenId];
if (_boss == 0) {return "Jackpot Jake (100%)";}
if (_boss == 1) {return "Ricky Roulette (90%)";}
if (_boss == 2) {return "Spin Master Sam (80%)";}
if (_boss == 3) {return "Lucky Lou (70%)";}
if (_boss == 4) {return "Joker Joe (60%)";}
if (_boss == 5) {return "Rollin' Ray (50%)";}
if (_boss == 6) {return "Diamond Dave (40%)";}
if (_boss == 7) {return "Cash King Cole (30%)";}
} else {
return "Invalid Token ID";
}
}
function getBossIndexByTokenId(uint256 _tokenId) public view returns (uint256 _boss) {
if (_tokenId > 0 && _tokenId < tokenId) {
_boss = s_tokenIdToBoss[_tokenId];
}
}
function getMaxSupply() public view returns (uint256) {
return maxSupply;
}
function getCurrentDay() public view returns (uint256) {
return currentDay;
}
function getStartDate() public view returns (uint256) {
return startDate;
}
function getCurrentPrice() public view returns (uint256) {
return currentPrice;
}
function withdraw() public onlyOwner {
(bool success, ) = msg.sender.call{value: address(this).balance}("");
require(success, "Withdrawal failed");
}
}// 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;
/*
* @notice Check to see if there exists a request commitment consumers
* for all consumers and keyhashes for a given sub.
* @param subId - ID of the subscription
* @return true if there exists at least one unfulfilled request for the subscription, false
* otherwise.
*/
function pendingRequestExists(uint64 subId) external view returns (bool);
}// 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 (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4906.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
import {IERC721} from "./IERC721.sol";
/// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC165, IERC721 {
/// @dev This event emits when the metadata of a token is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFT.
event MetadataUpdate(uint256 _tokenId);
/// @dev This event emits when the metadata of a range of tokens is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFTs.
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC721} from "../token/ERC721/IERC721.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.20;
import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);
/**
* @dev The default royalty receiver is invalid.
*/
error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);
/**
* @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);
/**
* @dev The royalty receiver for `tokenId` is invalid.
*/
error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
}
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
}
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.20;
import {IERC721} from "./IERC721.sol";
import {IERC721Receiver} from "./IERC721Receiver.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
mapping(uint256 tokenId => address) private _owners;
mapping(address owner => uint256) private _balances;
mapping(uint256 tokenId => address) private _tokenApprovals;
mapping(address owner => mapping(address operator => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual returns (uint256) {
if (owner == address(0)) {
revert ERC721InvalidOwner(address(0));
}
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual returns (address) {
return _requireOwned(tokenId);
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
_requireOwned(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual {
_approve(to, tokenId, _msgSender());
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual returns (address) {
_requireOwned(tokenId);
return _getApproved(tokenId);
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
// Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
address previousOwner = _update(to, tokenId, _msgSender());
if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
transferFrom(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
/**
* @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
*
* IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
* core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
* consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
* `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
*/
function _getApproved(uint256 tokenId) internal view virtual returns (address) {
return _tokenApprovals[tokenId];
}
/**
* @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
* particular (ignoring whether it is owned by `owner`).
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
return
spender != address(0) &&
(owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
}
/**
* @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
* Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
* the `spender` for the specific `tokenId`.
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
if (!_isAuthorized(owner, spender, tokenId)) {
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else {
revert ERC721InsufficientApproval(spender, tokenId);
}
}
}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
* a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
*
* WARNING: Increasing an account's balance using this function tends to be paired with an override of the
* {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
* remain consistent with one another.
*/
function _increaseBalance(address account, uint128 value) internal virtual {
unchecked {
_balances[account] += value;
}
}
/**
* @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
* (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
*
* The `auth` argument is optional. If the value passed is non 0, then this function will check that
* `auth` is either the owner of the token, or approved to operate on the token (by the owner).
*
* Emits a {Transfer} event.
*
* NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
*/
function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
address from = _ownerOf(tokenId);
// Perform (optional) operator check
if (auth != address(0)) {
_checkAuthorized(from, auth, tokenId);
}
// Execute the update
if (from != address(0)) {
// Clear approval. No need to re-authorize or emit the Approval event
_approve(address(0), tokenId, address(0), false);
unchecked {
_balances[from] -= 1;
}
}
if (to != address(0)) {
unchecked {
_balances[to] += 1;
}
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
return from;
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner != address(0)) {
revert ERC721InvalidSender(address(0));
}
}
/**
* @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
_checkOnERC721Received(address(0), to, tokenId, data);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal {
address previousOwner = _update(address(0), tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
* are aware of the ERC721 standard to prevent tokens from being forever locked.
*
* `data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is like {safeTransferFrom} in the sense that it invokes
* {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `tokenId` token must exist and be owned by `from`.
* - `to` cannot be the zero address.
* - `from` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId) internal {
_safeTransfer(from, to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
* either the owner of the token, or approved to operate on all tokens held by this owner.
*
* Emits an {Approval} event.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address to, uint256 tokenId, address auth) internal {
_approve(to, tokenId, auth, true);
}
/**
* @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
* emitted in the context of transfers.
*/
function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
// Avoid reading the owner unless necessary
if (emitEvent || auth != address(0)) {
address owner = _requireOwned(tokenId);
// We do not use _isAuthorized because single-token approvals should not be able to call approve
if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
revert ERC721InvalidApprover(auth);
}
if (emitEvent) {
emit Approval(owner, to, tokenId);
}
}
_tokenApprovals[tokenId] = to;
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Requirements:
* - operator can't be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC721InvalidOperator(operator);
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
* Returns the owner.
*
* Overrides to ownership logic should be done to {_ownerOf}.
*/
function _requireOwned(uint256 tokenId) internal view returns (address) {
address owner = _ownerOf(tokenId);
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
return owner;
}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
* recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param data bytes optional data to send along with the call
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
if (to.code.length > 0) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
if (retval != IERC721Receiver.onERC721Received.selector) {
revert ERC721InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
revert ERC721InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Royalty.sol)
pragma solidity ^0.8.20;
import {ERC721} from "../ERC721.sol";
import {ERC2981} from "../../common/ERC2981.sol";
/**
* @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment
* information.
*
* Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually
* for specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*/
abstract contract ERC721Royalty is ERC2981, ERC721 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
return super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721URIStorage.sol)
pragma solidity ^0.8.20;
import {ERC721} from "../ERC721.sol";
import {Strings} from "../../../utils/Strings.sol";
import {IERC4906} from "../../../interfaces/IERC4906.sol";
import {IERC165} from "../../../interfaces/IERC165.sol";
/**
* @dev ERC721 token with storage based token URI management.
*/
abstract contract ERC721URIStorage is IERC4906, ERC721 {
using Strings for uint256;
// Interface ID as defined in ERC-4906. This does not correspond to a traditional interface ID as ERC-4906 only
// defines events and does not include any external function.
bytes4 private constant ERC4906_INTERFACE_ID = bytes4(0x49064906);
// Optional mapping for token URIs
mapping(uint256 tokenId => string) private _tokenURIs;
/**
* @dev See {IERC165-supportsInterface}
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
return interfaceId == ERC4906_INTERFACE_ID || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
_requireOwned(tokenId);
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via string.concat).
if (bytes(_tokenURI).length > 0) {
return string.concat(base, _tokenURI);
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Emits {MetadataUpdate}.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
_tokenURIs[tokenId] = _tokenURI;
emit MetadataUpdate(tokenId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.20;
import {IERC721} from "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.20;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be
* reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}{
"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
Contract ABI
API[{"inputs":[{"internalType":"uint64","name":"subscriptionId","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"currentDay","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currentPrice","type":"uint256"}],"name":"DayAndPriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"currentPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"enum RoguePitBoss.Boss","name":"boss","type":"uint8"}],"name":"NFTMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"currentPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NFTRequested","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":"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"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","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":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getBossByTokenId","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getBossIndexByTokenId","outputs":[{"internalType":"uint256","name":"_boss","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"randomNumber","type":"uint256"}],"name":"getBossRarity","outputs":[{"internalType":"enum RoguePitBoss.Boss","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChanceArray","outputs":[{"internalType":"uint8[8]","name":"","type":"uint8[8]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getCurrentDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStartDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTokenURIs","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"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":[],"name":"requestNFT","outputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"s_requestIdToSender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"s_tokenIdToBoss","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":"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":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","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":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateDayAndPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"updateStartPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040526001600a557f68d24f9a037a649944964c2a1ebd0b2918f4a243d2a99701cc22b548cf2daff0600c55600d80546001600160501b03191666010001000f4240179055636505c2f0600f819055620151809062000061904262000532565b6200007090620151806200054e565b6200007c919062000564565b601055670214e8348c4f000060115560016010546200009c919062000532565b620000af90662386f26fc1000062000584565b601154620000be91906200054e565b60125560c860135560408051610160810190915260356101008201818152829162002c10610120840139815260200160405180606001604052806035815260200162002caf60359139815260200160405180606001604052806035815260200162002bdb60359139815260200160405180606001604052806035815260200162002c7a60359139815260200160405180606001604052806035815260200162002ba660359139815260200160405180606001604052806035815260200162002ce460359139815260200160405180606001604052806035815260200162002d1960359139815260200160405180606001604052806035815260200162002c45603591399052620001d39060159060086200044e565b50601680546001600160a01b031990811673b03892814accca985e8aec2f9fedac52b1eb6759179091556017805490911673baa3c9086dcf6dadf7f9b71180f5026c3843929a17905534801562000228575f80fd5b5060405162002d4e38038062002d4e8339810160408190526200024b916200059e565b337341034678d6c633d8a95c75e1138a360a28ba15d16040518060400160405280601081526020016f526f6775652050697420426f7373657360801b8152506040518060400160405280600381526020016229282160e91b8152508160029081620002b791906200066d565b506003620002c682826200066d565b5050506001600160a01b039081166080528116620002fe57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b620003098162000358565b50600b80546001600160401b038316600160a01b026001600160e01b0319909116177341034678d6c633d8a95c75e1138a360a28ba15d117905562000351336103e8620003a9565b5062000735565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6127106001600160601b038216811015620003ea57604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401620002f5565b6001600160a01b0383166200041557604051635b6cc80560e11b81525f6004820152602401620002f5565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b909102175f55565b828054828255905f5260205f2090810192821562000497579160200282015b828111156200049757825182906200048690826200066d565b50916020019190600101906200046d565b50620004a5929150620004a9565b5090565b80821115620004a5575f620004bf8282620004c9565b50600101620004a9565b508054620004d790620005e1565b5f825580601f10620004e7575050565b601f0160209004905f5260205f209081019062000505919062000508565b50565b5b80821115620004a5575f815560010162000509565b634e487b7160e01b5f52601160045260245ffd5b818103818111156200054857620005486200051e565b92915050565b808201808211156200054857620005486200051e565b5f826200057f57634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176200054857620005486200051e565b5f60208284031215620005af575f80fd5b81516001600160401b0381168114620005c6575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c90821680620005f657607f821691505b6020821081036200061557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111562000668575f81815260208120601f850160051c81016020861015620006435750805b601f850160051c820191505b8181101562000664578281556001016200064f565b5050505b505050565b81516001600160401b03811115620006895762000689620005cd565b620006a1816200069a8454620005e1565b846200061b565b602080601f831160018114620006d7575f8415620006bf5750858301515b5f19600386901b1c1916600185901b17855562000664565b5f85815260208120601f198616915b828110156200070757888601518255948401946001909101908401620006e6565b50858210156200072557878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b608051612451620007555f395f81816107dc015261081e01526124515ff3fe6080604052600436106101f1575f3560e01c80636352211e1161010857806395d89b411161009d578063c87b56dd1161006d578063c87b56dd14610595578063e985e9c5146105b4578063eb91d37e146105d3578063f20be5cd146105e7578063f2fde38b14610606575f80fd5b806395d89b411461050f578063a22cb46514610523578063a36f573b14610542578063b88d4fde14610576575f80fd5b8063715018a6116100d8578063715018a6146104c257806378f305c6146104d65780637abd25d1146104ea5780638da5cb5b146104f2575f80fd5b80636352211e1461045157806364224120146104705780636d66f9fe1461048f57806370a08231146104a3575f80fd5b806323b872dd116101895780633ccfd60b116101595780633ccfd60b146103d55780633e6968b6146103e957806342842e0e146103fd5780634c0f38c21461041c5780635dacf5f414610430575f80fd5b806323b872dd1461032e57806326f8d7041461034d57806327825cd6146103785780632a55205a14610397575f80fd5b8063095ea7b3116101c4578063095ea7b3146102ae57806318160ddd146102cf5780631a20d6f1146102e35780631fe543e31461030f575f80fd5b806301ffc9a7146101f5578063050c88881461022957806306fdde0314610256578063081812fc14610277575b5f80fd5b348015610200575f80fd5b5061021461020f366004611d90565b610625565b60405190151581526020015b60405180910390f35b348015610234575f80fd5b50610248610243366004611dab565b610635565b604051908152602001610220565b348015610261575f80fd5b5061026a610660565b6040516102209190611e0f565b348015610282575f80fd5b50610296610291366004611dab565b6106f0565b6040516001600160a01b039091168152602001610220565b3480156102b9575f80fd5b506102cd6102c8366004611e37565b610717565b005b3480156102da575f80fd5b50610248610726565b3480156102ee575f80fd5b506103026102fd366004611dab565b61073b565b6040516102209190611e93565b34801561031a575f80fd5b506102cd610329366004611ee6565b6107d1565b348015610339575f80fd5b506102cd610348366004611f93565b61085a565b348015610358575f80fd5b50610248610367366004611dab565b60146020525f908152604090205481565b348015610383575f80fd5b5061026a610392366004611dab565b6108e3565b3480156103a2575f80fd5b506103b66103b1366004611fcc565b610afb565b604080516001600160a01b039093168352602083019190915201610220565b3480156103e0575f80fd5b506102cd610ba4565b3480156103f4575f80fd5b50601054610248565b348015610408575f80fd5b506102cd610417366004611f93565b610c38565b348015610427575f80fd5b50601354610248565b34801561043b575f80fd5b50610444610c57565b6040516102209190611fec565b34801561045c575f80fd5b5061029661046b366004611dab565b610ca5565b34801561047b575f80fd5b5061026a61048a366004611dab565b610caf565b34801561049a575f80fd5b506102cd610d5a565b3480156104ae575f80fd5b506102486104bd366004612020565b610dfa565b3480156104cd575f80fd5b506102cd610e3f565b3480156104e1575f80fd5b50600f54610248565b610248610e52565b3480156104fd575f80fd5b506009546001600160a01b0316610296565b34801561051a575f80fd5b5061026a611206565b34801561052e575f80fd5b506102cd61053d366004612039565b611215565b34801561054d575f80fd5b5061029661055c366004611dab565b600e6020525f90815260409020546001600160a01b031681565b348015610581575f80fd5b506102cd610590366004612072565b611220565b3480156105a0575f80fd5b5061026a6105af366004611dab565b611237565b3480156105bf575f80fd5b506102146105ce36600461212b565b611242565b3480156105de575f80fd5b50601254610248565b3480156105f2575f80fd5b506102cd610601366004611dab565b601155565b348015610611575f80fd5b506102cd610620366004612020565b61126f565b5f61062f826112a9565b92915050565b5f80821180156106465750600a5482105b1561065b57505f818152601460205260409020545b919050565b60606002805461066f9061215c565b80601f016020809104026020016040519081016040528092919081815260200182805461069b9061215c565b80156106e65780601f106106bd576101008083540402835291602001916106e6565b820191905f5260205f20905b8154815290600101906020018083116106c957829003601f168201915b5050505050905090565b5f6106fa826112cd565b505f828152600660205260409020546001600160a01b031661062f565b610722828233611305565b5050565b5f6001600a5461073691906121a2565b905090565b5f8080610746610c57565b90505f5b60088110156107c95782851015801561077b5750818160088110610770576107706121b5565b602002015160ff1685105b1561079b5780600781111561079257610792611e5f565b95945050505050565b8181600881106107ad576107ad6121b5565b602002015160ff169250806107c1816121c9565b91505061074a565b505050919050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108505760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b6107228282611312565b6001600160a01b03821661088357604051633250574960e11b81525f6004820152602401610847565b5f61088f838333611420565b9050836001600160a01b0316816001600160a01b0316146108dd576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610847565b50505050565b60605f821180156108f55750600a5482105b15610acf575f82815260146020526040812054908190036109415750506040805180820190915260138152724a61636b706f74204a616b652028313030252960681b6020820152919050565b8060010361097b5750506040805180820190915260148152735269636b7920526f756c6574746520283930252960601b6020820152919050565b806002036109b65750506040805180820190915260158152745370696e204d61737465722053616d20283830252960581b6020820152919050565b806003036109eb57505060408051808201909152600f81526e4c75636b79204c6f7520283730252960881b6020820152919050565b80600403610a2057505060408051808201909152600f81526e4a6f6b6572204a6f6520283630252960881b6020820152919050565b80600503610a57575050604080518082019091526011815270526f6c6c696e272052617920283530252960781b6020820152919050565b80600603610a8f5750506040805180820190915260128152714469616d6f6e64204461766520283430252960701b6020820152919050565b80600703610ac957505060408051808201909152601481527343617368204b696e6720436f6c6520283330252960601b6020820152919050565b50919050565b505060408051808201909152601081526f125b9d985b1a5908151bdad95b88125160821b602082015290565b5f8281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610b6e5750604080518082019091525f546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090610b8c906001600160601b0316876121e1565b610b96919061220c565b915196919550909350505050565b610bac611512565b6040515f90339047908381818185875af1925050503d805f8114610beb576040519150601f19603f3d011682016040523d82523d5f602084013e610bf0565b606091505b5050905080610c355760405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606401610847565b50565b610c5283838360405180602001604052805f815250611220565b505050565b610c5f611d5c565b5060408051610100810182526001815260036020820152600a918101919091526019606082015260326080820152606460a0820152609660c082015260c860e082015290565b5f61062f826112cd565b606060158281548110610cc457610cc46121b5565b905f5260205f20018054610cd79061215c565b80601f0160208091040260200160405190810160405280929190818152602001828054610d039061215c565b8015610d4e5780601f10610d2557610100808354040283529160200191610d4e565b820191905f5260205f20905b815481529060010190602001808311610d3157829003601f168201915b50505050509050919050565b62015180600f5442610d6c91906121a2565b610d79906201518061221f565b610d83919061220c565b6010819055610d94906001906121a2565b610da590662386f26fc100006121e1565b601154610db2919061221f565b60128190556010546040517f029cd2e698d46531fa6add97e0b61f5c3e6eb14962469cd0c5039a72852e715592610df0928252602082015260400190565b60405180910390a1565b5f6001600160a01b038216610e24576040516322718ad960e21b81525f6004820152602401610847565b506001600160a01b03165f9081526005602052604090205490565b610e47611512565b610e505f61153f565b565b5f6074600a541115610eba57601254341015610eba5760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768204554482073656e743b20636865636b2070726963656044820152602160f81b6064820152608401610847565b601354600a541115610f445760405162461bcd60e51b815260206004820152604760248201527f546865206d6178696d756d20737570706c79206f66203230302068617320626560448201527f656e20726561636865642c206e6f206d6f7265204e4654732063616e2062652060648201526636b4b73a32b21760c91b608482015260a401610847565b606b600a5410156110ba57601654600a54604051639a9fb2b360e01b815260048101919091525f916001600160a01b031690639a9fb2b390602401602060405180830381865afa158015610f9a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fbe9190612232565b601754600a54919250610fdc916001600160a01b0390911690611590565b611089600a5460158381548110610ff557610ff56121b5565b905f5260205f200180546110089061215c565b80601f01602080910402602001604051908101604052809291908181526020018280546110349061215c565b801561107f5780601f106110565761010080835404028352916020019161107f565b820191905f5260205f20905b81548152906001019060200180831161106257829003601f168201915b50505050506115a9565b600a80545f908152601460205260408120839055815460019291906110af90849061221f565b909155509092915050565b606a600a54111561120357600b54600c54600d546040516305d3b1d360e41b81526004810192909252600160a01b830467ffffffffffffffff166024830152640100000000810461ffff16604483015263ffffffff808216606484015266010000000000009091041660848201526001600160a01b0390911690635d3b1d309060a4016020604051808303815f875af1158015611159573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061117d9190612232565b5f818152600e60205260409081902080546001600160a01b03191633908117909155601254600a5492519394507f980373df14649a4ccc4a5d4edefa19d9fd2934534cd4764155c87aa9602d3a22936111f893869392919384526001600160a01b039290921660208401526040830152606082015260800190565b60405180910390a190565b90565b60606003805461066f9061215c565b6107223383836115f8565b61122b84848461085a565b6108dd84848484611696565b606061062f826117bc565b6001600160a01b039182165f90815260076020908152604080832093909416825291909152205460ff1690565b611277611512565b6001600160a01b0381166112a057604051631e4fbdf760e01b81525f6004820152602401610847565b610c358161153f565b5f6001600160e01b03198216632483248360e11b148061062f575061062f826118c7565b5f818152600460205260408120546001600160a01b03168061062f57604051637e27328960e01b815260048101849052602401610847565b610c5283838360016118d1565b5f828152600e602052604081205482516001600160a01b03909116919060c89084908390611342576113426121b5565b60200260200101516113549190612249565b90505f6113608261073b565b905061136e83600a54611590565b611398600a54601583600781111561138857611388611e5f565b81548110610ff557610ff56121b5565b8060078111156113aa576113aa611e5f565b600a80545f908152601460205260408120929092558054600192906113d090849061221f565b9091555050601254600a546040517fc3d68b76619c2c97fa4c30c0bd9c5258b16b8a34536710449c80f71362f381c79261141192899288929190879061225c565b60405180910390a15050505050565b5f828152600460205260408120546001600160a01b039081169083161561144c5761144c8184866119d5565b6001600160a01b03811615611486576114675f855f806118d1565b6001600160a01b0381165f90815260056020526040902080545f190190555b6001600160a01b038516156114b4576001600160a01b0385165f908152600560205260409020805460010190555b5f8481526004602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6009546001600160a01b03163314610e505760405163118cdaa760e01b8152336004820152602401610847565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b610722828260405180602001604052805f815250611a39565b5f8281526008602052604090206115c082826122e4565b506040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b6001600160a01b03821661162a57604051630b61174360e31b81526001600160a01b0383166004820152602401610847565b6001600160a01b038381165f81815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b156108dd57604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906116d89033908890879087906004016123a0565b6020604051808303815f875af1925050508015611712575060408051601f3d908101601f1916820190925261170f918101906123d2565b60015b611779573d80801561173f576040519150601f19603f3d011682016040523d82523d5f602084013e611744565b606091505b5080515f0361177157604051633250574960e11b81526001600160a01b0385166004820152602401610847565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146117b557604051633250574960e11b81526001600160a01b0385166004820152602401610847565b5050505050565b60606117c7826112cd565b505f82815260086020526040812080546117e09061215c565b80601f016020809104026020016040519081016040528092919081815260200182805461180c9061215c565b80156118575780601f1061182e57610100808354040283529160200191611857565b820191905f5260205f20905b81548152906001019060200180831161183a57829003601f168201915b505050505090505f61187360408051602081019091525f815290565b905080515f03611884575092915050565b8151156118b657808260405160200161189e9291906123ed565b60405160208183030381529060405292505050919050565b6118bf84611a4f565b949350505050565b5f61062f82611ac0565b80806118e557506001600160a01b03821615155b156119a6575f6118f4846112cd565b90506001600160a01b038316158015906119205750826001600160a01b0316816001600160a01b031614155b801561193357506119318184611242565b155b1561195c5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610847565b81156119a45783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260066020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6119e0838383611aff565b610c52576001600160a01b038316611a0e57604051637e27328960e01b815260048101829052602401610847565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610847565b611a438383611b60565b610c525f848484611696565b6060611a5a826112cd565b505f611a7060408051602081019091525f815290565b90505f815111611a8e5760405180602001604052805f815250611ab9565b80611a9884611bc1565b604051602001611aa99291906123ed565b6040516020818303038152906040525b9392505050565b5f6001600160e01b031982166380ac58cd60e01b1480611af057506001600160e01b03198216635b5e139f60e01b145b8061062f575061062f82611c51565b5f6001600160a01b038316158015906118bf5750826001600160a01b0316846001600160a01b03161480611b385750611b388484611242565b806118bf5750505f908152600660205260409020546001600160a01b03908116911614919050565b6001600160a01b038216611b8957604051633250574960e11b81525f6004820152602401610847565b5f611b9583835f611420565b90506001600160a01b03811615610c52576040516339e3563760e11b81525f6004820152602401610847565b60605f611bcd83611c85565b60010190505f8167ffffffffffffffff811115611bec57611bec611ea1565b6040519080825280601f01601f191660200182016040528015611c16576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611c2057509392505050565b5f6001600160e01b0319821663152a902d60e11b148061062f57506301ffc9a760e01b6001600160e01b031983161461062f565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611cc35772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611cef576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611d0d57662386f26fc10000830492506010015b6305f5e1008310611d25576305f5e100830492506008015b6127108310611d3957612710830492506004015b60648310611d4b576064830492506002015b600a831061062f5760010192915050565b6040518061010001604052806008906020820280368337509192915050565b6001600160e01b031981168114610c35575f80fd5b5f60208284031215611da0575f80fd5b8135611ab981611d7b565b5f60208284031215611dbb575f80fd5b5035919050565b5f5b83811015611ddc578181015183820152602001611dc4565b50505f910152565b5f8151808452611dfb816020860160208601611dc2565b601f01601f19169290920160200192915050565b602081525f611ab96020830184611de4565b80356001600160a01b038116811461065b575f80fd5b5f8060408385031215611e48575f80fd5b611e5183611e21565b946020939093013593505050565b634e487b7160e01b5f52602160045260245ffd5b60088110611e8f57634e487b7160e01b5f52602160045260245ffd5b9052565b6020810161062f8284611e73565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611ede57611ede611ea1565b604052919050565b5f8060408385031215611ef7575f80fd5b8235915060208084013567ffffffffffffffff80821115611f16575f80fd5b818601915086601f830112611f29575f80fd5b813581811115611f3b57611f3b611ea1565b8060051b9150611f4c848301611eb5565b8181529183018401918481019089841115611f65575f80fd5b938501935b83851015611f8357843582529385019390850190611f6a565b8096505050505050509250929050565b5f805f60608486031215611fa5575f80fd5b611fae84611e21565b9250611fbc60208501611e21565b9150604084013590509250925092565b5f8060408385031215611fdd575f80fd5b50508035926020909101359150565b610100810181835f5b600881101561201757815160ff16835260209283019290910190600101611ff5565b50505092915050565b5f60208284031215612030575f80fd5b611ab982611e21565b5f806040838503121561204a575f80fd5b61205383611e21565b915060208301358015158114612067575f80fd5b809150509250929050565b5f805f8060808587031215612085575f80fd5b61208e85611e21565b9350602061209d818701611e21565b935060408601359250606086013567ffffffffffffffff808211156120c0575f80fd5b818801915088601f8301126120d3575f80fd5b8135818111156120e5576120e5611ea1565b6120f7601f8201601f19168501611eb5565b9150808252898482850101111561210c575f80fd5b80848401858401375f8482840101525080935050505092959194509250565b5f806040838503121561213c575f80fd5b61214583611e21565b915061215360208401611e21565b90509250929050565b600181811c9082168061217057607f821691505b602082108103610ac957634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8181038181111561062f5761062f61218e565b634e487b7160e01b5f52603260045260245ffd5b5f600182016121da576121da61218e565b5060010190565b808202811582820484141761062f5761062f61218e565b634e487b7160e01b5f52601260045260245ffd5b5f8261221a5761221a6121f8565b500490565b8082018082111561062f5761062f61218e565b5f60208284031215612242575f80fd5b5051919050565b5f82612257576122576121f8565b500690565b8581526001600160a01b0385166020820152604081018490526060810183905260a0810161228d6080830184611e73565b9695505050505050565b601f821115610c52575f81815260208120601f850160051c810160208610156122bd5750805b601f850160051c820191505b818110156122dc578281556001016122c9565b505050505050565b815167ffffffffffffffff8111156122fe576122fe611ea1565b6123128161230c845461215c565b84612297565b602080601f831160018114612345575f841561232e5750858301515b5f19600386901b1c1916600185901b1785556122dc565b5f85815260208120601f198616915b8281101561237357888601518255948401946001909101908401612354565b508582101561239057878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f9061228d90830184611de4565b5f602082840312156123e2575f80fd5b8151611ab981611d7b565b5f83516123fe818460208801611dc2565b835190830190612412818360208801611dc2565b0194935050505056fea2646970667358221220b45e0a31f793f2720f0e252f90bb6c8eb5d95b1ffdb4932a4b4a89c3e153f4af64736f6c63430008140033697066733a2f2f516d535678517043346b6b5831506d417443454d636e68623576506f584144773966414279686463756e7345386d697066733a2f2f516d6438686831723545346536615259785152366f42396d5a64356f6f737a6872783767664e516669333438644d697066733a2f2f516d567848643733584b50654331535672767963656e354a7557485a4e5843797a63675159473146516639474a58697066733a2f2f516d56646b7a4c316a6271437174486777597441743271736f656b4c626f35576b704a426f4d476b757958674374697066733a2f2f516d5a776e3766636450626463666e4d3443476177476272763152356f3975643933386d486267764d7847315332697066733a2f2f516d59725750384a5478615454735a51797241745535394d314d44394262553342376931576771616d5a38537567697066733a2f2f516d536254516a3363544d6631646461383537374756466f4152646f48796e6f744a3268635363516d4669587833697066733a2f2f516d657a66776f63334850646347706f57466e64776e6d7074686a796278383559657578414536484332545966480000000000000000000000000000000000000000000000000000000000000062
Deployed Bytecode
0x6080604052600436106101f1575f3560e01c80636352211e1161010857806395d89b411161009d578063c87b56dd1161006d578063c87b56dd14610595578063e985e9c5146105b4578063eb91d37e146105d3578063f20be5cd146105e7578063f2fde38b14610606575f80fd5b806395d89b411461050f578063a22cb46514610523578063a36f573b14610542578063b88d4fde14610576575f80fd5b8063715018a6116100d8578063715018a6146104c257806378f305c6146104d65780637abd25d1146104ea5780638da5cb5b146104f2575f80fd5b80636352211e1461045157806364224120146104705780636d66f9fe1461048f57806370a08231146104a3575f80fd5b806323b872dd116101895780633ccfd60b116101595780633ccfd60b146103d55780633e6968b6146103e957806342842e0e146103fd5780634c0f38c21461041c5780635dacf5f414610430575f80fd5b806323b872dd1461032e57806326f8d7041461034d57806327825cd6146103785780632a55205a14610397575f80fd5b8063095ea7b3116101c4578063095ea7b3146102ae57806318160ddd146102cf5780631a20d6f1146102e35780631fe543e31461030f575f80fd5b806301ffc9a7146101f5578063050c88881461022957806306fdde0314610256578063081812fc14610277575b5f80fd5b348015610200575f80fd5b5061021461020f366004611d90565b610625565b60405190151581526020015b60405180910390f35b348015610234575f80fd5b50610248610243366004611dab565b610635565b604051908152602001610220565b348015610261575f80fd5b5061026a610660565b6040516102209190611e0f565b348015610282575f80fd5b50610296610291366004611dab565b6106f0565b6040516001600160a01b039091168152602001610220565b3480156102b9575f80fd5b506102cd6102c8366004611e37565b610717565b005b3480156102da575f80fd5b50610248610726565b3480156102ee575f80fd5b506103026102fd366004611dab565b61073b565b6040516102209190611e93565b34801561031a575f80fd5b506102cd610329366004611ee6565b6107d1565b348015610339575f80fd5b506102cd610348366004611f93565b61085a565b348015610358575f80fd5b50610248610367366004611dab565b60146020525f908152604090205481565b348015610383575f80fd5b5061026a610392366004611dab565b6108e3565b3480156103a2575f80fd5b506103b66103b1366004611fcc565b610afb565b604080516001600160a01b039093168352602083019190915201610220565b3480156103e0575f80fd5b506102cd610ba4565b3480156103f4575f80fd5b50601054610248565b348015610408575f80fd5b506102cd610417366004611f93565b610c38565b348015610427575f80fd5b50601354610248565b34801561043b575f80fd5b50610444610c57565b6040516102209190611fec565b34801561045c575f80fd5b5061029661046b366004611dab565b610ca5565b34801561047b575f80fd5b5061026a61048a366004611dab565b610caf565b34801561049a575f80fd5b506102cd610d5a565b3480156104ae575f80fd5b506102486104bd366004612020565b610dfa565b3480156104cd575f80fd5b506102cd610e3f565b3480156104e1575f80fd5b50600f54610248565b610248610e52565b3480156104fd575f80fd5b506009546001600160a01b0316610296565b34801561051a575f80fd5b5061026a611206565b34801561052e575f80fd5b506102cd61053d366004612039565b611215565b34801561054d575f80fd5b5061029661055c366004611dab565b600e6020525f90815260409020546001600160a01b031681565b348015610581575f80fd5b506102cd610590366004612072565b611220565b3480156105a0575f80fd5b5061026a6105af366004611dab565b611237565b3480156105bf575f80fd5b506102146105ce36600461212b565b611242565b3480156105de575f80fd5b50601254610248565b3480156105f2575f80fd5b506102cd610601366004611dab565b601155565b348015610611575f80fd5b506102cd610620366004612020565b61126f565b5f61062f826112a9565b92915050565b5f80821180156106465750600a5482105b1561065b57505f818152601460205260409020545b919050565b60606002805461066f9061215c565b80601f016020809104026020016040519081016040528092919081815260200182805461069b9061215c565b80156106e65780601f106106bd576101008083540402835291602001916106e6565b820191905f5260205f20905b8154815290600101906020018083116106c957829003601f168201915b5050505050905090565b5f6106fa826112cd565b505f828152600660205260409020546001600160a01b031661062f565b610722828233611305565b5050565b5f6001600a5461073691906121a2565b905090565b5f8080610746610c57565b90505f5b60088110156107c95782851015801561077b5750818160088110610770576107706121b5565b602002015160ff1685105b1561079b5780600781111561079257610792611e5f565b95945050505050565b8181600881106107ad576107ad6121b5565b602002015160ff169250806107c1816121c9565b91505061074a565b505050919050565b336001600160a01b037f00000000000000000000000041034678d6c633d8a95c75e1138a360a28ba15d116146108505760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000041034678d6c633d8a95c75e1138a360a28ba15d11660248201526044015b60405180910390fd5b6107228282611312565b6001600160a01b03821661088357604051633250574960e11b81525f6004820152602401610847565b5f61088f838333611420565b9050836001600160a01b0316816001600160a01b0316146108dd576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610847565b50505050565b60605f821180156108f55750600a5482105b15610acf575f82815260146020526040812054908190036109415750506040805180820190915260138152724a61636b706f74204a616b652028313030252960681b6020820152919050565b8060010361097b5750506040805180820190915260148152735269636b7920526f756c6574746520283930252960601b6020820152919050565b806002036109b65750506040805180820190915260158152745370696e204d61737465722053616d20283830252960581b6020820152919050565b806003036109eb57505060408051808201909152600f81526e4c75636b79204c6f7520283730252960881b6020820152919050565b80600403610a2057505060408051808201909152600f81526e4a6f6b6572204a6f6520283630252960881b6020820152919050565b80600503610a57575050604080518082019091526011815270526f6c6c696e272052617920283530252960781b6020820152919050565b80600603610a8f5750506040805180820190915260128152714469616d6f6e64204461766520283430252960701b6020820152919050565b80600703610ac957505060408051808201909152601481527343617368204b696e6720436f6c6520283330252960601b6020820152919050565b50919050565b505060408051808201909152601081526f125b9d985b1a5908151bdad95b88125160821b602082015290565b5f8281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610b6e5750604080518082019091525f546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090610b8c906001600160601b0316876121e1565b610b96919061220c565b915196919550909350505050565b610bac611512565b6040515f90339047908381818185875af1925050503d805f8114610beb576040519150601f19603f3d011682016040523d82523d5f602084013e610bf0565b606091505b5050905080610c355760405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606401610847565b50565b610c5283838360405180602001604052805f815250611220565b505050565b610c5f611d5c565b5060408051610100810182526001815260036020820152600a918101919091526019606082015260326080820152606460a0820152609660c082015260c860e082015290565b5f61062f826112cd565b606060158281548110610cc457610cc46121b5565b905f5260205f20018054610cd79061215c565b80601f0160208091040260200160405190810160405280929190818152602001828054610d039061215c565b8015610d4e5780601f10610d2557610100808354040283529160200191610d4e565b820191905f5260205f20905b815481529060010190602001808311610d3157829003601f168201915b50505050509050919050565b62015180600f5442610d6c91906121a2565b610d79906201518061221f565b610d83919061220c565b6010819055610d94906001906121a2565b610da590662386f26fc100006121e1565b601154610db2919061221f565b60128190556010546040517f029cd2e698d46531fa6add97e0b61f5c3e6eb14962469cd0c5039a72852e715592610df0928252602082015260400190565b60405180910390a1565b5f6001600160a01b038216610e24576040516322718ad960e21b81525f6004820152602401610847565b506001600160a01b03165f9081526005602052604090205490565b610e47611512565b610e505f61153f565b565b5f6074600a541115610eba57601254341015610eba5760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768204554482073656e743b20636865636b2070726963656044820152602160f81b6064820152608401610847565b601354600a541115610f445760405162461bcd60e51b815260206004820152604760248201527f546865206d6178696d756d20737570706c79206f66203230302068617320626560448201527f656e20726561636865642c206e6f206d6f7265204e4654732063616e2062652060648201526636b4b73a32b21760c91b608482015260a401610847565b606b600a5410156110ba57601654600a54604051639a9fb2b360e01b815260048101919091525f916001600160a01b031690639a9fb2b390602401602060405180830381865afa158015610f9a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fbe9190612232565b601754600a54919250610fdc916001600160a01b0390911690611590565b611089600a5460158381548110610ff557610ff56121b5565b905f5260205f200180546110089061215c565b80601f01602080910402602001604051908101604052809291908181526020018280546110349061215c565b801561107f5780601f106110565761010080835404028352916020019161107f565b820191905f5260205f20905b81548152906001019060200180831161106257829003601f168201915b50505050506115a9565b600a80545f908152601460205260408120839055815460019291906110af90849061221f565b909155509092915050565b606a600a54111561120357600b54600c54600d546040516305d3b1d360e41b81526004810192909252600160a01b830467ffffffffffffffff166024830152640100000000810461ffff16604483015263ffffffff808216606484015266010000000000009091041660848201526001600160a01b0390911690635d3b1d309060a4016020604051808303815f875af1158015611159573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061117d9190612232565b5f818152600e60205260409081902080546001600160a01b03191633908117909155601254600a5492519394507f980373df14649a4ccc4a5d4edefa19d9fd2934534cd4764155c87aa9602d3a22936111f893869392919384526001600160a01b039290921660208401526040830152606082015260800190565b60405180910390a190565b90565b60606003805461066f9061215c565b6107223383836115f8565b61122b84848461085a565b6108dd84848484611696565b606061062f826117bc565b6001600160a01b039182165f90815260076020908152604080832093909416825291909152205460ff1690565b611277611512565b6001600160a01b0381166112a057604051631e4fbdf760e01b81525f6004820152602401610847565b610c358161153f565b5f6001600160e01b03198216632483248360e11b148061062f575061062f826118c7565b5f818152600460205260408120546001600160a01b03168061062f57604051637e27328960e01b815260048101849052602401610847565b610c5283838360016118d1565b5f828152600e602052604081205482516001600160a01b03909116919060c89084908390611342576113426121b5565b60200260200101516113549190612249565b90505f6113608261073b565b905061136e83600a54611590565b611398600a54601583600781111561138857611388611e5f565b81548110610ff557610ff56121b5565b8060078111156113aa576113aa611e5f565b600a80545f908152601460205260408120929092558054600192906113d090849061221f565b9091555050601254600a546040517fc3d68b76619c2c97fa4c30c0bd9c5258b16b8a34536710449c80f71362f381c79261141192899288929190879061225c565b60405180910390a15050505050565b5f828152600460205260408120546001600160a01b039081169083161561144c5761144c8184866119d5565b6001600160a01b03811615611486576114675f855f806118d1565b6001600160a01b0381165f90815260056020526040902080545f190190555b6001600160a01b038516156114b4576001600160a01b0385165f908152600560205260409020805460010190555b5f8481526004602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6009546001600160a01b03163314610e505760405163118cdaa760e01b8152336004820152602401610847565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b610722828260405180602001604052805f815250611a39565b5f8281526008602052604090206115c082826122e4565b506040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b6001600160a01b03821661162a57604051630b61174360e31b81526001600160a01b0383166004820152602401610847565b6001600160a01b038381165f81815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b156108dd57604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906116d89033908890879087906004016123a0565b6020604051808303815f875af1925050508015611712575060408051601f3d908101601f1916820190925261170f918101906123d2565b60015b611779573d80801561173f576040519150601f19603f3d011682016040523d82523d5f602084013e611744565b606091505b5080515f0361177157604051633250574960e11b81526001600160a01b0385166004820152602401610847565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146117b557604051633250574960e11b81526001600160a01b0385166004820152602401610847565b5050505050565b60606117c7826112cd565b505f82815260086020526040812080546117e09061215c565b80601f016020809104026020016040519081016040528092919081815260200182805461180c9061215c565b80156118575780601f1061182e57610100808354040283529160200191611857565b820191905f5260205f20905b81548152906001019060200180831161183a57829003601f168201915b505050505090505f61187360408051602081019091525f815290565b905080515f03611884575092915050565b8151156118b657808260405160200161189e9291906123ed565b60405160208183030381529060405292505050919050565b6118bf84611a4f565b949350505050565b5f61062f82611ac0565b80806118e557506001600160a01b03821615155b156119a6575f6118f4846112cd565b90506001600160a01b038316158015906119205750826001600160a01b0316816001600160a01b031614155b801561193357506119318184611242565b155b1561195c5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610847565b81156119a45783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260066020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6119e0838383611aff565b610c52576001600160a01b038316611a0e57604051637e27328960e01b815260048101829052602401610847565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610847565b611a438383611b60565b610c525f848484611696565b6060611a5a826112cd565b505f611a7060408051602081019091525f815290565b90505f815111611a8e5760405180602001604052805f815250611ab9565b80611a9884611bc1565b604051602001611aa99291906123ed565b6040516020818303038152906040525b9392505050565b5f6001600160e01b031982166380ac58cd60e01b1480611af057506001600160e01b03198216635b5e139f60e01b145b8061062f575061062f82611c51565b5f6001600160a01b038316158015906118bf5750826001600160a01b0316846001600160a01b03161480611b385750611b388484611242565b806118bf5750505f908152600660205260409020546001600160a01b03908116911614919050565b6001600160a01b038216611b8957604051633250574960e11b81525f6004820152602401610847565b5f611b9583835f611420565b90506001600160a01b03811615610c52576040516339e3563760e11b81525f6004820152602401610847565b60605f611bcd83611c85565b60010190505f8167ffffffffffffffff811115611bec57611bec611ea1565b6040519080825280601f01601f191660200182016040528015611c16576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611c2057509392505050565b5f6001600160e01b0319821663152a902d60e11b148061062f57506301ffc9a760e01b6001600160e01b031983161461062f565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611cc35772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611cef576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611d0d57662386f26fc10000830492506010015b6305f5e1008310611d25576305f5e100830492506008015b6127108310611d3957612710830492506004015b60648310611d4b576064830492506002015b600a831061062f5760010192915050565b6040518061010001604052806008906020820280368337509192915050565b6001600160e01b031981168114610c35575f80fd5b5f60208284031215611da0575f80fd5b8135611ab981611d7b565b5f60208284031215611dbb575f80fd5b5035919050565b5f5b83811015611ddc578181015183820152602001611dc4565b50505f910152565b5f8151808452611dfb816020860160208601611dc2565b601f01601f19169290920160200192915050565b602081525f611ab96020830184611de4565b80356001600160a01b038116811461065b575f80fd5b5f8060408385031215611e48575f80fd5b611e5183611e21565b946020939093013593505050565b634e487b7160e01b5f52602160045260245ffd5b60088110611e8f57634e487b7160e01b5f52602160045260245ffd5b9052565b6020810161062f8284611e73565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611ede57611ede611ea1565b604052919050565b5f8060408385031215611ef7575f80fd5b8235915060208084013567ffffffffffffffff80821115611f16575f80fd5b818601915086601f830112611f29575f80fd5b813581811115611f3b57611f3b611ea1565b8060051b9150611f4c848301611eb5565b8181529183018401918481019089841115611f65575f80fd5b938501935b83851015611f8357843582529385019390850190611f6a565b8096505050505050509250929050565b5f805f60608486031215611fa5575f80fd5b611fae84611e21565b9250611fbc60208501611e21565b9150604084013590509250925092565b5f8060408385031215611fdd575f80fd5b50508035926020909101359150565b610100810181835f5b600881101561201757815160ff16835260209283019290910190600101611ff5565b50505092915050565b5f60208284031215612030575f80fd5b611ab982611e21565b5f806040838503121561204a575f80fd5b61205383611e21565b915060208301358015158114612067575f80fd5b809150509250929050565b5f805f8060808587031215612085575f80fd5b61208e85611e21565b9350602061209d818701611e21565b935060408601359250606086013567ffffffffffffffff808211156120c0575f80fd5b818801915088601f8301126120d3575f80fd5b8135818111156120e5576120e5611ea1565b6120f7601f8201601f19168501611eb5565b9150808252898482850101111561210c575f80fd5b80848401858401375f8482840101525080935050505092959194509250565b5f806040838503121561213c575f80fd5b61214583611e21565b915061215360208401611e21565b90509250929050565b600181811c9082168061217057607f821691505b602082108103610ac957634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8181038181111561062f5761062f61218e565b634e487b7160e01b5f52603260045260245ffd5b5f600182016121da576121da61218e565b5060010190565b808202811582820484141761062f5761062f61218e565b634e487b7160e01b5f52601260045260245ffd5b5f8261221a5761221a6121f8565b500490565b8082018082111561062f5761062f61218e565b5f60208284031215612242575f80fd5b5051919050565b5f82612257576122576121f8565b500690565b8581526001600160a01b0385166020820152604081018490526060810183905260a0810161228d6080830184611e73565b9695505050505050565b601f821115610c52575f81815260208120601f850160051c810160208610156122bd5750805b601f850160051c820191505b818110156122dc578281556001016122c9565b505050505050565b815167ffffffffffffffff8111156122fe576122fe611ea1565b6123128161230c845461215c565b84612297565b602080601f831160018114612345575f841561232e5750858301515b5f19600386901b1c1916600185901b1785556122dc565b5f85815260208120601f198616915b8281101561237357888601518255948401946001909101908401612354565b508582101561239057878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f9061228d90830184611de4565b5f602082840312156123e2575f80fd5b8151611ab981611d7b565b5f83516123fe818460208801611dc2565b835190830190612412818360208801611dc2565b0194935050505056fea2646970667358221220b45e0a31f793f2720f0e252f90bb6c8eb5d95b1ffdb4932a4b4a89c3e153f4af64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000062
-----Decoded View---------------
Arg [0] : subscriptionId (uint64): 98
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000062
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.